27class AAbstractTypeableView
29 public AAbstractTypeable,
30 public std::conditional_t<aui::derived_from<Super, IFontView>, std::monostate, IFontView>
34 AAbstractTypeableView() {
36 if (this->hasFocus() && mCursorBlinkCount < 60) {
37 mCursorBlinkVisible = !mCursorBlinkVisible;
38 mCursorBlinkCount += 1;
52 &AAbstractTypeable::setText,
59 void onKeyDown(AInput::Key key)
override {
60 Super::onKeyDown(key);
61 if (key == AInput::ESCAPE) {
64 AAbstractTypeable::handleKey(key);
65 if (key == AInput::Key::RETURN && !AInput::isKeyDown(AInput::LSHIFT) && !AInput::isKeyDown(AInput::RSHIFT)) {
66 emit this->actionButtonPressed;
70 void onKeyRepeat(AInput::Key key)
override {
71 Super::onKeyRepeat(key);
72 AAbstractTypeable::handleKey(key);
75 void onFocusLost()
override {
77 if (mTextChangedFlag) {
78 mTextChangedFlag =
false;
80 emit textChanged(text());
86 Super::onPointerPressed(event);
87 ACursorSelectable::handleMousePressed(event);
88 updateCursorBlinking();
92 Super::onPointerDoubleClicked(event);
93 ACursorSelectable::handleMouseDoubleClicked(event);
94 updateCursorBlinking();
98 Super::onPointerMove(pos, event);
99 ACursorSelectable::handleMouseMove(pos);
103 Super::onPointerReleased(event);
106 if (event.
pointerIndex != APointerIndex::button(AInput::RBUTTON)) {
107 ACursorSelectable::handleMouseReleased(event);
111 bool wantsTouchscreenKeyboard()
override {
115 bool handlesNonMouseNavigation()
override {
119 void onFocusAcquired()
override {
120 Super::onFocusAcquired();
121 updateCursorBlinking();
124 void invalidateAllStyles()
override {
126 this->invalidateAllStylesFont();
127 Super::invalidateAllStyles();
130 bool isLButtonPressed()
override {
131 return this->isPressed();
134 void drawCursor(
IRenderer& renderer, glm::ivec2 position) {
135 if (!this->hasFocus()) {
138 drawCursorImpl(renderer, position, this->getFontStyle().size);
142 AMenuModel composeContextMenu()
override {
143 return composeContextMenuImpl();
146 void commitStyle()
override {
147 Super::commitStyle();
148 this->commitStyleFont();
151 int getVerticalAlignmentOffset() noexcept {
152 return (glm::max)(0, int(glm::ceil((Super::getContentHeight() - this->getFontStyle().size) / 2.0)));
155 void cursorSelectableRedraw()
override {
159 void onSelectionChanged()
override {
160 onCursorIndexChanged();
161 if (selectionChanged)
emit selectionChanged(selection());
165 void emitTextChanged(
const AString& text)
override {
166 emit textChanged(text);
169 void emitTextChanging(
const AString& text)
override {
170 emit textChanging(text);
173 void emitActionButtonPressed()
override {
174 emit actionButtonPressed;
177 void typeableInvalidateFont()
override {
178 this->invalidateFont();
static decltype(auto) connect(const Signal &signal, Object *object, Function &&function)
Connects signal to the slot of the specified object.
Definition AObject.h:86
APointerIndex pointerIndex
Which button of the pointing device is triggered the event (AInput::LBUTTON if not present) or finger...
Definition APointerReleasedEvent.h:28