mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
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.
This commit is contained in:
parent
99a00dc39b
commit
1084eaea0b
Notes:
sideshowbarker
2024-07-17 08:26:35 +09:00
Author: https://github.com/thankyouverycool
Commit: 1084eaea0b
Pull-request: https://github.com/SerenityOS/serenity/pull/14706
Issue: https://github.com/SerenityOS/serenity/issues/14634
Reviewed-by: https://github.com/FireFox317
2 changed files with 8 additions and 8 deletions
|
@ -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<BoxLayout>(orientation);
|
||||
layout()->set_spacing(0);
|
||||
layout()->set_margins({ 2, 2, 2, 2 });
|
||||
|
@ -96,7 +96,7 @@ ErrorOr<NonnullRefPtr<GUI::Button>> Toolbar::try_add_action(Action& action)
|
|||
TRY(m_items.try_ensure_capacity(m_items.size() + 1));
|
||||
|
||||
auto button = TRY(try_add<ToolbarButton>(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;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
virtual Optional<UISize> 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<Item> m_items;
|
||||
const Gfx::Orientation m_orientation;
|
||||
int m_button_size { 16 };
|
||||
int m_button_size { 24 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue