diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 01:04:31 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 01:07:03 -0300 |
commit | a503f8aadcb8cbc85bde589fb25ea06e599b367b (patch) | |
tree | 070ebbf0dd6af2d43c5519f5e32045b3512f0e9e /scene/gui/base_button.h | |
parent | 68c008ca8d87a1f72fcf17467ee43714954e9ce4 (diff) | |
download | redot-engine-a503f8aadcb8cbc85bde589fb25ea06e599b367b.tar.gz |
Groundbreaking!! Godot resources can now be flagged to be local to the scene being edited!
This means that each time this scene is instanced, the resource will be unique!
As such, thanks to this, the following features were implemented:
-ButtonGroup is no longer a control, it's now a resource local to the scene
-ViewportTexture can be created from the editor and set to any object, making ViewportSprite and other kind of nodes obsolete!
Diffstat (limited to 'scene/gui/base_button.h')
-rw-r--r-- | scene/gui/base_button.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index ed39b34aa8..898c19e811 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -59,9 +59,11 @@ class BaseButton : public Control { } status; - ButtonGroup *group; + Ref<ButtonGroup> button_group; + void _unpress_group(); + protected: @@ -109,11 +111,29 @@ public: virtual String get_tooltip(const Point2& p_pos) const; + void set_button_group(const Ref<ButtonGroup>& p_group); + Ref<ButtonGroup> get_button_group() const; + BaseButton(); ~BaseButton(); }; -VARIANT_ENUM_CAST( BaseButton::DrawMode ); +VARIANT_ENUM_CAST( BaseButton::DrawMode ) + + +class ButtonGroup : public Resource { + + GDCLASS(ButtonGroup,Resource) +friend class BaseButton; + Set<BaseButton*> buttons; +protected: + static void _bind_methods(); +public: + + BaseButton* get_pressed_button(); + void get_buttons(List<BaseButton*> *r_buttons); + ButtonGroup(); +}; #endif |