aboutsummaryrefslogtreecommitdiff
path: root/scene/resources/style_box.h
diff options
context:
space:
mode:
authorZher Huei Lee2017-08-12 09:13:19 +0800
committerZher Huei Lee2017-08-12 09:57:56 +0800
commitb6ec3f02f0865d88a2d21269c708da038b899161 (patch)
tree73a9f5304018ecdef5fc60173f9b3beb338c49c5 /scene/resources/style_box.h
parent23f6d3fa69935c90c6cdcee342ae99d226e9b4ab (diff)
downloadgodot-b6ec3f02f0865d88a2d21269c708da038b899161.tar.gz
godot-b6ec3f02f0865d88a2d21269c708da038b899161.tar.zst
godot-b6ec3f02f0865d88a2d21269c708da038b899161.zip
Added Tile and TileFit to StyleBoxes
Was already implemented for Patch9 boxes, but wasn't exposed here. Allows for use in other GUI elements like panels and buttons.
Diffstat (limited to 'scene/resources/style_box.h')
-rw-r--r--scene/resources/style_box.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 64ce3528a..955d09c16 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -77,6 +77,14 @@ class StyleBoxTexture : public StyleBox {
GDCLASS(StyleBoxTexture, StyleBox);
+public:
+ enum AxisStretchMode {
+ AXIS_STRETCH_MODE_STRETCH,
+ AXIS_STRETCH_MODE_TILE,
+ AXIS_STRETCH_MODE_TILE_FIT,
+ };
+
+private:
float expand_margin[4];
float margin[4];
Rect2 region_rect;
@@ -84,6 +92,8 @@ class StyleBoxTexture : public StyleBox {
Ref<Texture> normal_map;
bool draw_center;
Color modulate;
+ AxisStretchMode axis_h;
+ AxisStretchMode axis_v;
protected:
virtual float get_style_margin(Margin p_margin) const;
@@ -109,6 +119,12 @@ public:
bool get_draw_center() const;
virtual Size2 get_center_size() const;
+ void set_h_axis_stretch_mode(AxisStretchMode p_mode);
+ AxisStretchMode get_h_axis_stretch_mode() const;
+
+ void set_v_axis_stretch_mode(AxisStretchMode p_mode);
+ AxisStretchMode get_v_axis_stretch_mode() const;
+
void set_modulate(const Color &p_modulate);
Color get_modulate() const;
@@ -118,6 +134,8 @@ public:
~StyleBoxTexture();
};
+VARIANT_ENUM_CAST(StyleBoxTexture::AxisStretchMode)
+
class StyleBoxFlat : public StyleBox {
GDCLASS(StyleBoxFlat, StyleBox);