summaryrefslogtreecommitdiff
path: root/Libraries
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
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')
-rw-r--r--Libraries/LibGUI/GToolBar.cpp16
-rw-r--r--Libraries/LibGUI/GToolBar.h1
2 files changed, 14 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 });
}
diff --git a/Libraries/LibGUI/GToolBar.h b/Libraries/LibGUI/GToolBar.h
index f03d0148bc..6719fcc787 100644
--- a/Libraries/LibGUI/GToolBar.h
+++ b/Libraries/LibGUI/GToolBar.h
@@ -18,6 +18,7 @@ public:
protected:
explicit GToolBar(GWidget* parent);
+ explicit GToolBar(Orientation, GWidget* parent);
virtual void paint_event(GPaintEvent&) override;