summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/GToolBar.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-08 21:09:34 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-09 00:41:00 +0100
commit0d2495e4e772e3e6a7d24b53bf8e958e35c956a1 (patch)
tree31165cb57e5ef5995e51b7c472fcb06966bba4c2 /Libraries/LibGUI/GToolBar.cpp
parentd016d5e365ca7fabee627cf68032a3667fd29a37 (diff)
downloadserenity-0d2495e4e772e3e6a7d24b53bf8e958e35c956a1.zip
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.
Diffstat (limited to 'Libraries/LibGUI/GToolBar.cpp')
-rw-r--r--Libraries/LibGUI/GToolBar.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Libraries/LibGUI/GToolBar.cpp b/Libraries/LibGUI/GToolBar.cpp
index 6f11c8af18..058d5a2c66 100644
--- a/Libraries/LibGUI/GToolBar.cpp
+++ b/Libraries/LibGUI/GToolBar.cpp
@@ -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 });
}