mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 16:45:07 +00:00
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
parent
2d39da5405
commit
c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions
|
@ -29,14 +29,16 @@
|
|||
#include <LibGUI/GMenuItem.h>
|
||||
#include <LibGUI/GWindowServerConnection.h>
|
||||
|
||||
GMenuItem::GMenuItem(unsigned menu_id, Type type)
|
||||
namespace GUI {
|
||||
|
||||
MenuItem::MenuItem(unsigned menu_id, Type type)
|
||||
: m_type(type)
|
||||
, m_menu_id(menu_id)
|
||||
{
|
||||
}
|
||||
|
||||
GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&& action)
|
||||
: m_type(Action)
|
||||
MenuItem::MenuItem(unsigned menu_id, NonnullRefPtr<Action>&& action)
|
||||
: m_type(Type::Action)
|
||||
, m_menu_id(menu_id)
|
||||
, m_action(move(action))
|
||||
{
|
||||
|
@ -47,20 +49,20 @@ GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&& action)
|
|||
m_checked = m_action->is_checked();
|
||||
}
|
||||
|
||||
GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GMenu>&& submenu)
|
||||
: m_type(Submenu)
|
||||
MenuItem::MenuItem(unsigned menu_id, NonnullRefPtr<Menu>&& submenu)
|
||||
: m_type(Type::Submenu)
|
||||
, m_menu_id(menu_id)
|
||||
, m_submenu(move(submenu))
|
||||
{
|
||||
}
|
||||
|
||||
GMenuItem::~GMenuItem()
|
||||
MenuItem::~MenuItem()
|
||||
{
|
||||
if (m_action)
|
||||
m_action->unregister_menu_item({}, *this);
|
||||
}
|
||||
|
||||
void GMenuItem::set_enabled(bool enabled)
|
||||
void MenuItem::set_enabled(bool enabled)
|
||||
{
|
||||
if (m_enabled == enabled)
|
||||
return;
|
||||
|
@ -68,7 +70,7 @@ void GMenuItem::set_enabled(bool enabled)
|
|||
update_window_server();
|
||||
}
|
||||
|
||||
void GMenuItem::set_checked(bool checked)
|
||||
void MenuItem::set_checked(bool checked)
|
||||
{
|
||||
ASSERT(is_checkable());
|
||||
if (m_checked == checked)
|
||||
|
@ -77,11 +79,13 @@ void GMenuItem::set_checked(bool checked)
|
|||
update_window_server();
|
||||
}
|
||||
|
||||
void GMenuItem::update_window_server()
|
||||
void MenuItem::update_window_server()
|
||||
{
|
||||
if (m_menu_id < 0)
|
||||
return;
|
||||
auto& action = *m_action;
|
||||
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
|
||||
GWindowServerConnection::the().send_sync<WindowServer::UpdateMenuItem>(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, shortcut_text);
|
||||
WindowServerConnection::the().send_sync<WindowServer::UpdateMenuItem>(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, shortcut_text);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue