diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-09-11 11:48:31 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-09-11 11:48:31 -0300 |
commit | b874cede201d354dfbf8147ab07621bda845a28c (patch) | |
tree | 736cecb919d104daaa904d16caae2dfd944472fd /scene/gui | |
parent | 95eb7466df890dcbed9eb8e8bda15bd9235db9c0 (diff) |
Add argument options for the theme override functions in Control
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/control.cpp | 29 | ||||
-rw-r--r-- | scene/gui/control.h | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 269bd09b17..a5bee32a69 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2406,6 +2406,35 @@ bool Control::is_visibility_clip_disabled() const { return data.disable_visibility_clip; } +void Control::get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const { + + Node::get_argument_options(p_function,p_idx,r_options); + + if (p_idx==0) { + List<StringName> sn; + String pf = p_function; + if (pf=="add_color_override" || pf=="has_color" || pf=="has_color_override" || pf=="get_color") { + Theme::get_default()->get_color_list(get_type(),&sn); + } else if (pf=="add_style_override" || pf=="has_style" || pf=="has_style_override" || pf=="get_style") { + Theme::get_default()->get_stylebox_list(get_type(),&sn); + } else if (pf=="add_font_override" || pf=="has_font" || pf=="has_font_override" || pf=="get_font") { + Theme::get_default()->get_font_list(get_type(),&sn); + } else if (pf=="add_constant_override" || pf=="has_constant" || pf=="has_constant_override" || pf=="get_constant") { + Theme::get_default()->get_constant_list(get_type(),&sn); + } else if (pf=="add_color_override" || pf=="has_color" || pf=="has_color_override" || pf=="get_color") { + Theme::get_default()->get_color_list(get_type(),&sn); + } + + sn.sort_custom<StringName::AlphCompare>(); + for (List<StringName>::Element *E=sn.front();E;E=E->next()) { + r_options->push_back("\""+E->get()+"\""); + } + } + + +} + + void Control::_bind_methods() { diff --git a/scene/gui/control.h b/scene/gui/control.h index 558439efbf..37efd80970 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -407,6 +407,8 @@ public: void set_disable_visibility_clip(bool p_ignore); bool is_visibility_clip_disabled() const; + virtual void get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const; + Control(); ~Control(); |