1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +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:
Andreas Kling 2020-02-02 15:07:41 +01:00
parent 2d39da5405
commit c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions

View file

@ -30,11 +30,11 @@
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
class AudioWidget final : public GWidget {
class AudioWidget final : public GUI::Widget {
C_OBJECT(AudioWidget)
public:
AudioWidget()
: GWidget(nullptr)
: GUI::Widget(nullptr)
{
m_audio_client = make<AClientConnection>();
m_audio_client->on_muted_state_change = [this](bool muted) {
@ -50,17 +50,17 @@ public:
virtual ~AudioWidget() override {}
private:
virtual void mousedown_event(GMouseEvent& event) override
virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GMouseButton::Left)
if (event.button() != GUI::MouseButton::Left)
return;
m_audio_client->set_muted(!m_audio_muted);
update();
}
virtual void paint_event(GPaintEvent& event) override
virtual void paint_event(GUI::PaintEvent& event) override
{
GPainter painter(*this);
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
painter.clear_rect(event.rect(), Color::from_rgba(0));
auto& audio_bitmap = m_audio_muted ? *m_muted_bitmap : *m_unmuted_bitmap;
@ -80,16 +80,16 @@ int main(int argc, char** argv)
return 1;
}
GApplication app(argc, argv);
GUI::Application app(argc, argv);
if (pledge("stdio shared_buffer accept rpath unix", nullptr) < 0) {
perror("pledge");
return 1;
}
auto window = GWindow::construct();
auto window = GUI::Window::construct();
window->set_has_alpha_channel(true);
window->set_window_type(GWindowType::MenuApplet);
window->set_window_type(GUI::WindowType::MenuApplet);
window->resize(12, 16);
auto widget = AudioWidget::construct();

View file

@ -33,11 +33,11 @@
#include <LibGUI/GWindow.h>
#include <stdio.h>
class GraphWidget final : public GWidget {
class GraphWidget final : public GUI::Widget {
C_OBJECT(GraphWidget)
public:
GraphWidget()
: GWidget(nullptr)
: GUI::Widget(nullptr)
{
start_timer(1000);
}
@ -59,9 +59,9 @@ private:
update();
}
virtual void paint_event(GPaintEvent& event) override
virtual void paint_event(GUI::PaintEvent& event) override
{
GPainter painter(*this);
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
painter.fill_rect(event.rect(), Color::Black);
int i = m_cpu_history.capacity() - m_cpu_history.size();
@ -74,9 +74,9 @@ private:
}
}
virtual void mousedown_event(GMouseEvent& event) override
virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GMouseButton::Left)
if (event.button() != GUI::MouseButton::Left)
return;
pid_t pid = fork();
if (pid < 0) {
@ -117,15 +117,15 @@ 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");
return 1;
}
auto window = GWindow::construct();
window->set_window_type(GWindowType::MenuApplet);
auto window = GUI::Window::construct();
window->set_window_type(GUI::WindowType::MenuApplet);
window->resize(30, 16);
auto widget = GraphWidget::construct();

View file

@ -33,11 +33,11 @@
#include <stdio.h>
#include <time.h>
class ClockWidget final : public GWidget {
class ClockWidget final : public GUI::Widget {
C_OBJECT(ClockWidget)
public:
ClockWidget()
: GWidget(nullptr)
: GUI::Widget(nullptr)
{
m_time_width = Font::default_bold_font().width("2222-22-22 22:22:22");
@ -61,7 +61,7 @@ public:
private:
static int menubar_menu_margin() { return 2; }
virtual void paint_event(GPaintEvent& event) override
virtual void paint_event(GUI::PaintEvent& event) override
{
time_t now = time(nullptr);
auto* tm = localtime(&now);
@ -74,7 +74,7 @@ private:
tm->tm_min,
tm->tm_sec);
GPainter painter(*this);
GUI::Painter painter(*this);
painter.fill_rect(event.rect(), palette().window());
painter.draw_text(event.rect(), time_text, Font::default_font(), TextAlignment::Center, palette().window_text());
}
@ -95,15 +95,15 @@ int main(int argc, char** argv)
return 1;
}
GApplication app(argc, argv);
GUI::Application app(argc, argv);
if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
auto window = GWindow::construct();
window->set_window_type(GWindowType::MenuApplet);
auto window = GUI::Window::construct();
window->set_window_type(GUI::WindowType::MenuApplet);
auto widget = ClockWidget::construct();