mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +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
|
@ -28,8 +28,8 @@
|
|||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GWindowServerConnection.h>
|
||||
|
||||
TaskbarButton::TaskbarButton(const WindowIdentifier& identifier, GWidget* parent)
|
||||
: GButton(parent)
|
||||
TaskbarButton::TaskbarButton(const WindowIdentifier& identifier, GUI::Widget* parent)
|
||||
: GUI::Button(parent)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
}
|
||||
|
@ -38,17 +38,17 @@ TaskbarButton::~TaskbarButton()
|
|||
{
|
||||
}
|
||||
|
||||
void TaskbarButton::context_menu_event(GContextMenuEvent&)
|
||||
void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&)
|
||||
{
|
||||
GWindowServerConnection::the().post_message(WindowServer::WM_PopupWindowMenu(m_identifier.client_id(), m_identifier.window_id(), screen_relative_rect().location()));
|
||||
GUI::WindowServerConnection::the().post_message(WindowServer::WM_PopupWindowMenu(m_identifier.client_id(), m_identifier.window_id(), screen_relative_rect().location()));
|
||||
}
|
||||
|
||||
void TaskbarButton::resize_event(GResizeEvent& event)
|
||||
void TaskbarButton::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
GWindowServerConnection::the().post_message(
|
||||
GUI::WindowServerConnection::the().post_message(
|
||||
WindowServer::WM_SetWindowTaskbarRect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect()));
|
||||
return GButton::resize_event(event);
|
||||
return GUI::Button::resize_event(event);
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
#include "WindowIdentifier.h"
|
||||
#include <LibGUI/GButton.h>
|
||||
|
||||
class TaskbarButton final : public GButton {
|
||||
class TaskbarButton final : public GUI::Button {
|
||||
C_OBJECT(TaskbarButton)
|
||||
public:
|
||||
TaskbarButton(const WindowIdentifier&, GWidget* parent);
|
||||
TaskbarButton(const WindowIdentifier&, GUI::Widget* parent);
|
||||
virtual ~TaskbarButton() override;
|
||||
|
||||
private:
|
||||
virtual void context_menu_event(GContextMenuEvent&) override;
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
virtual void context_menu_event(GUI::ContextMenuEvent&) override;
|
||||
virtual void resize_event(GUI::ResizeEvent&) override;
|
||||
|
||||
WindowIdentifier m_identifier;
|
||||
};
|
||||
|
|
|
@ -39,16 +39,16 @@
|
|||
|
||||
TaskbarWindow::TaskbarWindow()
|
||||
{
|
||||
set_window_type(GWindowType::Taskbar);
|
||||
set_window_type(GUI::WindowType::Taskbar);
|
||||
set_title("Taskbar");
|
||||
|
||||
on_screen_rect_change(GDesktop::the().rect());
|
||||
on_screen_rect_change(GUI::Desktop::the().rect());
|
||||
|
||||
GDesktop::the().on_rect_change = [this](const Rect& rect) { on_screen_rect_change(rect); };
|
||||
GUI::Desktop::the().on_rect_change = [this](const Rect& rect) { on_screen_rect_change(rect); };
|
||||
|
||||
auto widget = GFrame::construct();
|
||||
auto widget = GUI::Frame::construct();
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GHBoxLayout>());
|
||||
widget->set_layout(make<GUI::HBoxLayout>());
|
||||
widget->layout()->set_margins({ 3, 2, 3, 2 });
|
||||
widget->layout()->set_spacing(3);
|
||||
widget->set_frame_thickness(1);
|
||||
|
@ -69,9 +69,9 @@ TaskbarWindow::~TaskbarWindow()
|
|||
|
||||
void TaskbarWindow::create_quick_launch_bar()
|
||||
{
|
||||
auto quick_launch_bar = GFrame::construct(main_widget());
|
||||
quick_launch_bar->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
quick_launch_bar->set_layout(make<GHBoxLayout>());
|
||||
auto quick_launch_bar = GUI::Frame::construct(main_widget());
|
||||
quick_launch_bar->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
quick_launch_bar->set_layout(make<GUI::HBoxLayout>());
|
||||
quick_launch_bar->layout()->set_spacing(3);
|
||||
quick_launch_bar->layout()->set_margins({ 3, 0, 3, 0 });
|
||||
quick_launch_bar->set_frame_thickness(1);
|
||||
|
@ -93,8 +93,8 @@ void TaskbarWindow::create_quick_launch_bar()
|
|||
auto app_executable = af->read_entry("App", "Executable");
|
||||
auto app_icon_path = af->read_entry("Icons", "16x16");
|
||||
|
||||
auto button = GButton::construct(quick_launch_bar);
|
||||
button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
auto button = GUI::Button::construct(quick_launch_bar);
|
||||
button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
button->set_preferred_size(22, 22);
|
||||
button->set_button_style(ButtonStyle::CoolBar);
|
||||
|
||||
|
@ -127,28 +127,28 @@ void TaskbarWindow::on_screen_rect_change(const Rect& rect)
|
|||
set_rect(new_rect);
|
||||
}
|
||||
|
||||
NonnullRefPtr<GButton> TaskbarWindow::create_button(const WindowIdentifier& identifier)
|
||||
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier)
|
||||
{
|
||||
auto button = TaskbarButton::construct(identifier, main_widget());
|
||||
button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
button->set_preferred_size(140, 22);
|
||||
button->set_checkable(true);
|
||||
button->set_text_alignment(TextAlignment::CenterLeft);
|
||||
return button;
|
||||
}
|
||||
|
||||
static bool should_include_window(GWindowType window_type)
|
||||
static bool should_include_window(GUI::WindowType window_type)
|
||||
{
|
||||
return window_type == GWindowType::Normal;
|
||||
return window_type == GUI::WindowType::Normal;
|
||||
}
|
||||
|
||||
void TaskbarWindow::wm_event(GWMEvent& event)
|
||||
void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
||||
{
|
||||
WindowIdentifier identifier { event.client_id(), event.window_id() };
|
||||
switch (event.type()) {
|
||||
case GEvent::WM_WindowRemoved: {
|
||||
case GUI::Event::WM_WindowRemoved: {
|
||||
#ifdef EVENT_DEBUG
|
||||
auto& removed_event = static_cast<GWMWindowRemovedEvent&>(event);
|
||||
auto& removed_event = static_cast<GUI::WMWindowRemovedEvent&>(event);
|
||||
dbgprintf("WM_WindowRemoved: client_id=%d, window_id=%d\n",
|
||||
removed_event.client_id(),
|
||||
removed_event.window_id());
|
||||
|
@ -157,9 +157,9 @@ void TaskbarWindow::wm_event(GWMEvent& event)
|
|||
update();
|
||||
break;
|
||||
}
|
||||
case GEvent::WM_WindowRectChanged: {
|
||||
case GUI::Event::WM_WindowRectChanged: {
|
||||
#ifdef EVENT_DEBUG
|
||||
auto& changed_event = static_cast<GWMWindowRectChangedEvent&>(event);
|
||||
auto& changed_event = static_cast<GUI::WMWindowRectChangedEvent&>(event);
|
||||
dbgprintf("WM_WindowRectChanged: client_id=%d, window_id=%d, rect=%s\n",
|
||||
changed_event.client_id(),
|
||||
changed_event.window_id(),
|
||||
|
@ -168,8 +168,8 @@ void TaskbarWindow::wm_event(GWMEvent& event)
|
|||
break;
|
||||
}
|
||||
|
||||
case GEvent::WM_WindowIconBitmapChanged: {
|
||||
auto& changed_event = static_cast<GWMWindowIconBitmapChangedEvent&>(event);
|
||||
case GUI::Event::WM_WindowIconBitmapChanged: {
|
||||
auto& changed_event = static_cast<GUI::WMWindowIconBitmapChangedEvent&>(event);
|
||||
#ifdef EVENT_DEBUG
|
||||
dbgprintf("WM_WindowIconBitmapChanged: client_id=%d, window_id=%d, icon_buffer_id=%d\n",
|
||||
changed_event.client_id(),
|
||||
|
@ -184,8 +184,8 @@ void TaskbarWindow::wm_event(GWMEvent& event)
|
|||
break;
|
||||
}
|
||||
|
||||
case GEvent::WM_WindowStateChanged: {
|
||||
auto& changed_event = static_cast<GWMWindowStateChangedEvent&>(event);
|
||||
case GUI::Event::WM_WindowStateChanged: {
|
||||
auto& changed_event = static_cast<GUI::WMWindowStateChangedEvent&>(event);
|
||||
#ifdef EVENT_DEBUG
|
||||
dbgprintf("WM_WindowStateChanged: client_id=%d, window_id=%d, title=%s, rect=%s, is_active=%u, is_minimized=%u\n",
|
||||
changed_event.client_id(),
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
|
||||
class TaskbarWindow final : public GWindow {
|
||||
class TaskbarWindow final : public GUI::Window {
|
||||
C_OBJECT(TaskbarWindow)
|
||||
public:
|
||||
TaskbarWindow();
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
private:
|
||||
void create_quick_launch_bar();
|
||||
void on_screen_rect_change(const Rect&);
|
||||
NonnullRefPtr<GButton> create_button(const WindowIdentifier&);
|
||||
NonnullRefPtr<GUI::Button> create_button(const WindowIdentifier&);
|
||||
|
||||
virtual void wm_event(GWMEvent&) override;
|
||||
virtual void wm_event(GUI::WMEvent&) override;
|
||||
};
|
||||
|
|
|
@ -52,9 +52,9 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
|
|||
window->set_button(aid_create_button(identifier));
|
||||
window->button()->on_click = [window = window.ptr(), identifier](auto&) {
|
||||
if (window->is_minimized() || !window->is_active()) {
|
||||
GWindowServerConnection::the().post_message(WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
GUI::WindowServerConnection::the().post_message(WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
} else {
|
||||
GWindowServerConnection::the().post_message(WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
|
||||
GUI::WindowServerConnection::the().post_message(WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
|
||||
}
|
||||
};
|
||||
auto& window_ref = *window;
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
Rect rect() const { return m_rect; }
|
||||
void set_rect(const Rect& rect) { m_rect = rect; }
|
||||
|
||||
GButton* button() { return m_button; }
|
||||
void set_button(GButton* button) { m_button = button; }
|
||||
GUI::Button* button() { return m_button; }
|
||||
void set_button(GUI::Button* button) { m_button = button; }
|
||||
|
||||
void set_active(bool active) { m_active = active; }
|
||||
bool is_active() const { return m_active; }
|
||||
|
@ -68,7 +68,7 @@ private:
|
|||
WindowIdentifier m_identifier;
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
RefPtr<GButton> m_button;
|
||||
RefPtr<GUI::Button> m_button;
|
||||
RefPtr<GraphicsBitmap> m_icon;
|
||||
bool m_active { false };
|
||||
bool m_minimized { false };
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
Window& ensure_window(const WindowIdentifier&);
|
||||
void remove_window(const WindowIdentifier&);
|
||||
|
||||
Function<NonnullRefPtr<GButton>(const WindowIdentifier&)> aid_create_button;
|
||||
Function<NonnullRefPtr<GUI::Button>(const WindowIdentifier&)> aid_create_button;
|
||||
|
||||
private:
|
||||
HashMap<WindowIdentifier, NonnullOwnPtr<Window>> m_windows;
|
||||
|
|
|
@ -36,7 +36,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
GApplication app(argc, argv);
|
||||
GUI::Application app(argc, argv);
|
||||
|
||||
if (pledge("stdio shared_buffer accept proc exec rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue