1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibGUI: Add mimic_pressed to Button to signify being virtually clicked

A button that is "mimic pressed" is drawn like it is being clicked when
it isn't necessarily actually being pressed. This lets programs which
keyboard based input that mirrors a button to show visual feedback when
a key is pressed.
This commit is contained in:
ForLoveOfCats 2022-02-06 13:40:07 -05:00 committed by Linus Groh
parent 1fd16232d3
commit e8f6a650ad
2 changed files with 11 additions and 1 deletions

View file

@ -53,6 +53,9 @@ public:
bool another_button_has_focus() const { return m_another_button_has_focus; }
void set_mimic_pressed(bool mimic_pressed);
bool is_mimic_pressed() const { return m_mimic_pressed; };
protected:
explicit Button(String text = {});
virtual void mousedown_event(MouseEvent&) override;
@ -67,6 +70,7 @@ private:
WeakPtr<Action> m_action;
int m_icon_spacing { 4 };
bool m_another_button_has_focus { false };
bool m_mimic_pressed { false };
};
}