mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check marks in menus. There are a bunch of places to make use of this. This patch only takes advantage of it in the FileManager for the view type actions.
This commit is contained in:
parent
9ff36afeaa
commit
8f81a3f9dd
15 changed files with 148 additions and 20 deletions
|
@ -1,10 +1,12 @@
|
|||
#include "WSMenuItem.h"
|
||||
#include "WSMenu.h"
|
||||
|
||||
WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled)
|
||||
WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled, bool checkable, bool checked)
|
||||
: m_menu(menu)
|
||||
, m_type(Text)
|
||||
, m_enabled(enabled)
|
||||
, m_checkable(checkable)
|
||||
, m_checked(checked)
|
||||
, m_identifier(identifier)
|
||||
, m_text(text)
|
||||
, m_shortcut_text(shortcut_text)
|
||||
|
@ -28,3 +30,11 @@ void WSMenuItem::set_enabled(bool enabled)
|
|||
m_enabled = enabled;
|
||||
m_menu.redraw();
|
||||
}
|
||||
|
||||
void WSMenuItem::set_checked(bool checked)
|
||||
{
|
||||
if (m_checked == checked)
|
||||
return;
|
||||
m_checked = checked;
|
||||
m_menu.redraw();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue