mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +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
|
@ -1,18 +1,30 @@
|
|||
#include "WSMenuItem.h"
|
||||
#include "WSMenu.h"
|
||||
|
||||
WSMenuItem::WSMenuItem(unsigned identifier, const String& text, const String& shortcut_text)
|
||||
: m_type(Text)
|
||||
WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled)
|
||||
: m_menu(menu)
|
||||
, m_type(Text)
|
||||
, m_enabled(enabled)
|
||||
, m_identifier(identifier)
|
||||
, m_text(text)
|
||||
, m_shortcut_text(shortcut_text)
|
||||
{
|
||||
}
|
||||
|
||||
WSMenuItem::WSMenuItem(Type type)
|
||||
: m_type(type)
|
||||
WSMenuItem::WSMenuItem(WSMenu& menu, Type type)
|
||||
: m_menu(menu)
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
WSMenuItem::~WSMenuItem()
|
||||
{
|
||||
}
|
||||
|
||||
void WSMenuItem::set_enabled(bool enabled)
|
||||
{
|
||||
if (m_enabled == enabled)
|
||||
return;
|
||||
m_enabled = enabled;
|
||||
m_menu.redraw();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue