mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
LibGUI: Allow construction of vertical GToolBars
There's currently a small paint glitch for vertical toolbars due to the way StylePainter::paint_surface() draws a MidGray line at the bottom of whatever a "surface" is supposed to be.
This commit is contained in:
parent
d016d5e365
commit
0d2495e4e7
Notes:
sideshowbarker
2024-07-19 11:19:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0d2495e4e77
2 changed files with 14 additions and 3 deletions
|
@ -5,11 +5,21 @@
|
|||
#include <LibGUI/GToolBar.h>
|
||||
|
||||
GToolBar::GToolBar(GWidget* parent)
|
||||
: GToolBar(Orientation::Horizontal, parent)
|
||||
{
|
||||
}
|
||||
|
||||
GToolBar::GToolBar(Orientation orientation, GWidget* parent)
|
||||
: GWidget(parent)
|
||||
{
|
||||
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
set_preferred_size(0, 28);
|
||||
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
if (orientation == Orientation::Horizontal) {
|
||||
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
set_preferred_size(0, 28);
|
||||
} else {
|
||||
set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
set_preferred_size(28, 0);
|
||||
}
|
||||
set_layout(make<GBoxLayout>(orientation));
|
||||
layout()->set_spacing(0);
|
||||
layout()->set_margins({ 2, 2, 2, 2 });
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
|
||||
protected:
|
||||
explicit GToolBar(GWidget* parent);
|
||||
explicit GToolBar(Orientation, GWidget* parent);
|
||||
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue