mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibGUI+WindowServer: Add support for enabled/disabled actions.
The enabled state of a GAction now propagates both to any toolbar buttons and any menu items linked to the action. Toolbar buttons are painted in a grayed out style when disabled. Menu items are gray when disabled. :^)
This commit is contained in:
parent
32e5c8c689
commit
054c982181
20 changed files with 308 additions and 53 deletions
|
@ -7,6 +7,8 @@
|
|||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <SharedGraphics/TextAlignment.h>
|
||||
|
||||
class GAction;
|
||||
|
||||
class GButton : public GWidget {
|
||||
public:
|
||||
explicit GButton(GWidget* parent);
|
||||
|
@ -35,6 +37,8 @@ public:
|
|||
|
||||
void click();
|
||||
|
||||
void set_action(GAction&);
|
||||
|
||||
virtual const char* class_name() const override { return "GButton"; }
|
||||
|
||||
private:
|
||||
|
@ -49,6 +53,7 @@ private:
|
|||
RetainPtr<GraphicsBitmap> m_icon;
|
||||
ButtonStyle m_button_style { ButtonStyle::Normal };
|
||||
TextAlignment m_text_alignment { TextAlignment::Center };
|
||||
WeakPtr<GAction> m_action;
|
||||
bool m_being_pressed { false };
|
||||
bool m_hovered { false };
|
||||
bool m_checkable { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue