From ab375117ba4e0549fa0b893c3f96a166042f43b9 Mon Sep 17 00:00:00 2001 From: geequlim Date: Thu, 9 Feb 2017 22:46:35 +0800 Subject: Add STRETCH_KEEP_ASPECT_COVERED to TextureRect StretchMode Make TextureButton to the same resize behavior with TextureRect --- scene/gui/texture_button.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scene/gui/texture_button.h') diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h index ef4d4d5b5b..e1d1079ceb 100644 --- a/scene/gui/texture_button.h +++ b/scene/gui/texture_button.h @@ -31,22 +31,28 @@ #include "scene/gui/base_button.h" #include "scene/resources/bit_mask.h" +#include "scene/gui/texture_rect.h" class TextureButton : public BaseButton { GDCLASS( TextureButton, BaseButton ); +public: + typedef TextureRect::StretchMode StretchMode; + +private: Ref normal; Ref pressed; Ref hover; Ref disabled; Ref focused; Ref click_mask; - Size2 scale; + bool expand; + StretchMode stretch_mode; protected: - virtual bool has_point(const Point2& p_point) const; virtual Size2 get_minimum_size() const; + virtual bool has_point(const Point2& p_point) const; void _notification(int p_what); static void _bind_methods(); @@ -66,8 +72,11 @@ public: Ref get_focused_texture() const; Ref get_click_mask() const; - void set_texture_scale(Size2 p_scale); - Size2 get_texture_scale() const; + bool get_expand() const; + void set_expand(bool p_expand); + + void set_stretch_mode(StretchMode stretch_mode); + StretchMode get_stretch_mode() const; TextureButton(); }; -- cgit v1.2.3