26class AAbstractTypeableView
28 public AAbstractTypeable,
29 public std::conditional_t<aui::derived_from<Super, IFontView>, std::monostate, IFontView>
33 AAbstractTypeableView() {
35 if (this->hasFocus() && mCursorBlinkCount < 60) {
36 mCursorBlinkVisible = !mCursorBlinkVisible;
37 mCursorBlinkCount += 1;
51 &AAbstractTypeable::setText,
58 void onKeyDown(AInput::Key key)
override {
59 Super::onKeyDown(key);
60 AAbstractTypeable::handleKey(key);
61 if (key == AInput::Key::RETURN && !AInput::isKeyDown(AInput::LSHIFT) && !AInput::isKeyDown(AInput::RSHIFT)) {
62 emit this->actionButtonPressed;
66 void onKeyRepeat(AInput::Key key)
override {
67 Super::onKeyRepeat(key);
68 AAbstractTypeable::handleKey(key);
71 void onFocusLost()
override {
73 if (mTextChangedFlag) {
74 mTextChangedFlag =
false;
76 emit textChanged(text());
82 Super::onPointerPressed(event);
83 ACursorSelectable::handleMousePressed(event);
84 updateCursorBlinking();
88 Super::onPointerDoubleClicked(event);
89 ACursorSelectable::handleMouseDoubleClicked(event);
90 updateCursorBlinking();
94 Super::onPointerMove(pos, event);
95 ACursorSelectable::handleMouseMove(pos);
99 Super::onPointerReleased(event);
102 if (event.
pointerIndex != APointerIndex::button(AInput::RBUTTON)) {
103 ACursorSelectable::handleMouseReleased(event);
107 bool wantsTouchscreenKeyboard()
override {
111 bool handlesNonMouseNavigation()
override {
115 void onFocusAcquired()
override {
116 Super::onFocusAcquired();
117 updateCursorBlinking();
120 void invalidateAllStyles()
override {
122 this->invalidateAllStylesFont();
123 Super::invalidateAllStyles();
126 bool isLButtonPressed()
override {
127 return this->isPressed();
130 void drawCursor(
IRenderer& renderer, glm::ivec2 position) {
131 if (!this->hasFocus()) {
134 drawCursorImpl(renderer, position, this->getFontStyle().size);
138 AMenuModel composeContextMenu()
override {
139 return composeContextMenuImpl();
142 void commitStyle()
override {
143 Super::commitStyle();
144 this->commitStyleFont();
147 int getVerticalAlignmentOffset() noexcept {
148 return (glm::max)(0, int(glm::ceil((Super::getContentHeight() - this->getFontStyle().size) / 2.0)));
151 void cursorSelectableRedraw()
override {
155 void onSelectionChanged()
override {
156 onCursorIndexChanged();
157 if (selectionChanged)
emit selectionChanged(selection());
161 void emitTextChanged(
const AString& text)
override {
162 emit textChanged(text);
165 void emitTextChanging(
const AString& text)
override {
166 emit textChanging(text);
169 void emitActionButtonPressed()
override {
170 emit actionButtonPressed;
173 void typeableInvalidateFont()
override {
174 this->invalidateFont();
static void connect(const Signal &signal, Object *object, Function &&function)
Connects signal to the slot of the specified object.
Definition AObject.h:65
APointerIndex pointerIndex
Which button of the pointing device is triggered the event (AInput::LBUTTON if not present) or finger...
Definition APointerReleasedEvent.h:28