aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeLayout.h
diff options
context:
space:
mode:
authorBastien Bouclet2019-12-28 10:43:58 +0100
committerBastien Bouclet2020-01-04 10:56:25 +0100
commit346d53b0342d8a1d543887560a28cc45f211d9ad (patch)
tree61deeb53375e2968303ddc8265f102fcc6d33724 /gui/ThemeLayout.h
parentc0d8b6d9fc73abc8de4575686e0776e3468d37b2 (diff)
downloadscummvm-rg350-346d53b0342d8a1d543887560a28cc45f211d9ad.tar.gz
scummvm-rg350-346d53b0342d8a1d543887560a28cc45f211d9ad.tar.bz2
scummvm-rg350-346d53b0342d8a1d543887560a28cc45f211d9ad.zip
GUI: Add finer control over cross-direction alignment for layout items
Previously it was only possible to specify whether items where aligned to the start or centered in the cross direction of the layouts. It is now additionally possible to align the items to the far end of the cross direction or to resize them to match the size of the layout. Terminology and behavior are loosely based on CSS's flexbox containers.
Diffstat (limited to 'gui/ThemeLayout.h')
-rw-r--r--gui/ThemeLayout.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h
index a99de5a99c..0bfe7f7f22 100644
--- a/gui/ThemeLayout.h
+++ b/gui/ThemeLayout.h
@@ -52,6 +52,14 @@ public:
kLayoutSpace
};
+ /// Cross-direction alignment of layout children.
+ enum ItemAlign {
+ kItemAlignStart, ///< Items are aligned to the left for vertical layouts or to the top for horizontal layouts
+ kItemAlignCenter, ///< Items are centered in the container
+ kItemAlignEnd, ///< Items are aligned to the right for vertical layouts or to the bottom for horizontal layouts
+ kItemAlignStretch ///< Items are resized to match the size of the layout in the cross-direction
+ };
+
ThemeLayout(ThemeLayout *p) :
_parent(p), _x(0), _y(0), _w(-1), _h(-1),
_defaultW(-1), _defaultH(-1),
@@ -167,11 +175,10 @@ protected:
class ThemeLayoutStacked : public ThemeLayout {
public:
- ThemeLayoutStacked(ThemeLayout *p, LayoutType type, int spacing, bool center) :
- ThemeLayout(p), _type(type), _centered(center) {
+ ThemeLayoutStacked(ThemeLayout *p, LayoutType type, int spacing, ItemAlign itemAlign) :
+ ThemeLayout(p), _type(type), _itemAlign(itemAlign) {
assert((type == kLayoutVertical) || (type == kLayoutHorizontal));
_spacing = spacing;
- _centered = center;
}
void reflowLayout(Widget *widgetChain) override {
@@ -208,7 +215,7 @@ protected:
}
const LayoutType _type;
- bool _centered;
+ ItemAlign _itemAlign;
int8 _spacing;
};