mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibGUI: Allow Buttons to set themselves as default
Several apps were implementing this behavior ad hoc. This provides a standard API as well as a comfy visual cue for default return key behavior.
This commit is contained in:
parent
aefe3ef539
commit
f77ac3a73c
6 changed files with 42 additions and 10 deletions
|
@ -48,6 +48,11 @@ public:
|
|||
|
||||
void set_menu(RefPtr<GUI::Menu>);
|
||||
|
||||
bool is_default() const;
|
||||
void set_default(bool);
|
||||
|
||||
bool another_button_has_focus() const { return m_another_button_has_focus; }
|
||||
|
||||
protected:
|
||||
explicit Button(String text = {});
|
||||
virtual void mousedown_event(MouseEvent&) override;
|
||||
|
@ -61,6 +66,7 @@ private:
|
|||
Gfx::TextAlignment m_text_alignment { Gfx::TextAlignment::Center };
|
||||
WeakPtr<Action> m_action;
|
||||
int m_icon_spacing { 4 };
|
||||
bool m_another_button_has_focus { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue