diff --git a/Libraries/LibGUI/ColorPicker.cpp b/Libraries/LibGUI/ColorPicker.cpp index e58059481e..b18ee73cac 100644 --- a/Libraries/LibGUI/ColorPicker.cpp +++ b/Libraries/LibGUI/ColorPicker.cpp @@ -28,83 +28,218 @@ #include #include #include +#include +#include #include -#include +#include +#include #include namespace GUI { -ColorPicker::ColorPicker(Color color, Window* parent_window) +ColorPicker::ColorPicker(Color color, Window* parent_window, String title) : Dialog(parent_window) , m_color(color) { - set_title("Edit Color"); - build(); + set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/color-chooser.png")); + set_title(title); + set_resizable(false); + resize(530, 325); + + build_ui(); } ColorPicker::~ColorPicker() { } -void ColorPicker::build() +void ColorPicker::build_ui() { - auto& horizontal_container = set_main_widget(); - horizontal_container.set_fill_with_background_color(true); - horizontal_container.set_layout(); - horizontal_container.layout()->set_margins({ 4, 4, 4, 4 }); + auto& root_container = set_main_widget(); + root_container.set_layout(); + root_container.layout()->set_margins({ 4, 4, 4, 4 }); + root_container.set_fill_with_background_color(true); - auto& left_vertical_container = horizontal_container.add(); - left_vertical_container.set_layout(); + auto& tab_widget = root_container.add(); - auto& right_vertical_container = horizontal_container.add(); - right_vertical_container.set_layout(); + auto tab_palette = tab_widget.add_tab("Palette"); + tab_palette->set_size_policy(SizePolicy::Fill, SizePolicy::Fill); + tab_palette->set_layout(); + tab_palette->layout()->set_margins({ 4, 4, 4, 4 }); + tab_palette->layout()->set_spacing(4); + build_ui_palette(*tab_palette); + + auto tab_custom_color = tab_widget.add_tab("Custom Color"); + tab_custom_color->set_size_policy(SizePolicy::Fill, SizePolicy::Fill); + tab_custom_color->set_layout(); + tab_custom_color->layout()->set_margins({ 4, 4, 4, 4 }); + tab_custom_color->layout()->set_spacing(4); + + build_ui_custom(*tab_custom_color); + + auto& button_container = root_container.add(); + button_container.set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); + button_container.set_preferred_size(0, 22); + button_container.set_layout(); + button_container.layout()->set_spacing(4); + button_container.layout()->add_spacer(); + + auto& cancel_button = button_container.add