1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 14: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:
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

@ -31,31 +31,33 @@
#include <LibGUI/GSpinBox.h>
#include <LibGUI/GWidget.h>
GColorPicker::GColorPicker(Color color, Core::Object* parent)
: GDialog(parent)
namespace GUI {
ColorPicker::ColorPicker(Color color, Core::Object* parent)
: Dialog(parent)
, m_color(color)
{
set_title("Edit Color");
build();
}
GColorPicker::~GColorPicker()
ColorPicker::~ColorPicker()
{
}
void GColorPicker::build()
void ColorPicker::build()
{
auto horizontal_container = GWidget::construct();
auto horizontal_container = Widget::construct();
horizontal_container->set_fill_with_background_color(true);
horizontal_container->set_layout(make<GHBoxLayout>());
horizontal_container->set_layout(make<HBoxLayout>());
horizontal_container->layout()->set_margins({ 4, 4, 4, 4 });
set_main_widget(horizontal_container);
auto left_vertical_container = GWidget::construct(horizontal_container.ptr());
left_vertical_container->set_layout(make<GVBoxLayout>());
auto left_vertical_container = Widget::construct(horizontal_container.ptr());
left_vertical_container->set_layout(make<VBoxLayout>());
auto right_vertical_container = GWidget::construct(horizontal_container.ptr());
right_vertical_container->set_layout(make<GVBoxLayout>());
auto right_vertical_container = Widget::construct(horizontal_container.ptr());
right_vertical_container->set_layout(make<VBoxLayout>());
enum RGBComponent {
Red,
@ -63,27 +65,27 @@ void GColorPicker::build()
Blue
};
m_preview_widget = GFrame::construct(right_vertical_container);
m_preview_widget = Frame::construct(right_vertical_container);
auto pal = m_preview_widget->palette();
pal.set_color(ColorRole::Background, m_color);
m_preview_widget->set_fill_with_background_color(true);
m_preview_widget->set_palette(pal);
right_vertical_container->layout()->add_spacer();
auto cancel_button = GButton::construct("Cancel", right_vertical_container);
auto cancel_button = Button::construct("Cancel", right_vertical_container);
cancel_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
cancel_button->set_preferred_size(0, 20);
cancel_button->on_click = [&](auto&) {
done(GDialog::ExecCancel);
done(Dialog::ExecCancel);
};
auto ok_button = GButton::construct("Okay", right_vertical_container);
auto ok_button = Button::construct("Okay", right_vertical_container);
ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
ok_button->set_preferred_size(0, 20);
ok_button->on_click = [&](auto&) {
done(GDialog::ExecOK);
done(Dialog::ExecOK);
};
auto make_spinbox = [&](RGBComponent component, int initial_value) {
auto spinbox = GSpinBox::construct(left_vertical_container);
auto spinbox = SpinBox::construct(left_vertical_container);
spinbox->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
spinbox->set_preferred_size(0, 20);
spinbox->set_min(0);
@ -110,3 +112,5 @@ void GColorPicker::build()
make_spinbox(Green, m_color.green());
make_spinbox(Blue, m_color.blue());
}
}