From 1084eaea0b053485bbecf781e7b7028685d72427 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Wed, 27 Jul 2022 07:45:54 -0400 Subject: LibGUI: Remove button padding on Toolbar construction And assume 24x24 button sizes by default. There currently aren't any toolbars with custom button sizes, but if the need arises, they can always determine their own padding. --- Userland/Libraries/LibGUI/Toolbar.cpp | 12 ++++++------ Userland/Libraries/LibGUI/Toolbar.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Userland/Libraries/LibGUI') diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index 0f4c3769ea..be7e10e71b 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -26,11 +26,11 @@ Toolbar::Toolbar(Orientation orientation, int button_size) : m_orientation(orientation) , m_button_size(button_size) { - if (m_orientation == Orientation::Horizontal) { - set_fixed_height(button_size + 8); - } else { - set_fixed_width(button_size + 8); - } + if (m_orientation == Orientation::Horizontal) + set_fixed_height(button_size); + else + set_fixed_width(button_size); + set_layout(orientation); layout()->set_spacing(0); layout()->set_margins({ 2, 2, 2, 2 }); @@ -96,7 +96,7 @@ ErrorOr> Toolbar::try_add_action(Action& action) TRY(m_items.try_ensure_capacity(m_items.size() + 1)); auto button = TRY(try_add(action)); - button->set_fixed_size(m_button_size + 8, m_button_size + 8); + button->set_fixed_size(m_button_size, m_button_size); m_items.unchecked_append(move(item)); return button; diff --git a/Userland/Libraries/LibGUI/Toolbar.h b/Userland/Libraries/LibGUI/Toolbar.h index 1c5e2686cf..05c7eff3e2 100644 --- a/Userland/Libraries/LibGUI/Toolbar.h +++ b/Userland/Libraries/LibGUI/Toolbar.h @@ -28,7 +28,7 @@ public: virtual Optional calculated_preferred_size() const override; protected: - explicit Toolbar(Gfx::Orientation = Gfx::Orientation::Horizontal, int button_size = 16); + explicit Toolbar(Gfx::Orientation = Gfx::Orientation::Horizontal, int button_size = 24); virtual void paint_event(PaintEvent&) override; @@ -44,7 +44,7 @@ private: }; NonnullOwnPtrVector m_items; const Gfx::Orientation m_orientation; - int m_button_size { 16 }; + int m_button_size { 24 }; }; } -- cgit v1.2.3