From 63006f6f6f55573d55c14fcb9f7b6eeb6444aeb6 Mon Sep 17 00:00:00 2001 From: Mariano Javier Suligoy Date: Sun, 1 Mar 2015 21:07:50 -0300 Subject: [PATCH] Register CheckBox class to create it using editor. --- scene/gui/base_button.cpp | 5 +++-- scene/register_scene_types.cpp | 2 ++ tools/editor/plugins/theme_editor_plugin.cpp | 20 ++++++++++++++++++++ tools/editor/plugins/theme_editor_plugin.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 01676876214..bbe15da1cc9 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -279,12 +279,12 @@ void BaseButton::set_disabled(bool p_disabled) { set_focus_mode(FOCUS_NONE); else set_focus_mode(FOCUS_ALL); -}; +} bool BaseButton::is_disabled() const { return status.disabled; -}; +} void BaseButton::set_pressed(bool p_pressed) { @@ -391,6 +391,7 @@ void BaseButton::_bind_methods() { ADD_SIGNAL( MethodInfo("toggled", PropertyInfo( Variant::BOOL,"pressed") ) ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "disabled"), _SCS("set_disabled"), _SCS("is_disabled")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "toggle_mode"), _SCS("set_toggle_mode"), _SCS("is_toggle_mode")); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "is_pressed"), _SCS("set_pressed"), _SCS("is_pressed")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press")); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index ff525203bfa..02a9b605080 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -53,6 +53,7 @@ #include "scene/gui/color_picker.h" #include "scene/gui/texture_frame.h" #include "scene/gui/menu_button.h" +#include "scene/gui/check_box.h" #include "scene/gui/check_button.h" #include "scene/gui/tab_container.h" #include "scene/gui/panel_container.h" @@ -287,6 +288,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index ccbd9231185..bd6fb37b29c 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -568,6 +568,26 @@ ThemeEditor::ThemeEditor() { CheckButton *cb = memnew( CheckButton ); cb->set_text("CheckButton"); first_vb->add_child(cb ); + CheckBox *cbx = memnew( CheckBox ); + cbx->set_text("CheckBox"); + first_vb->add_child(cbx ); + + /* TODO: This is not working properly, controls are overlapping*/ + /* + ButtonGroup *bg = memnew( ButtonGroup ); + bg->set_v_size_flags(SIZE_EXPAND_FILL); + VBoxContainer *gbvb = memnew( VBoxContainer ); + gbvb->set_v_size_flags(SIZE_EXPAND_FILL); + CheckBox *rbx1 = memnew( CheckBox ); + rbx1->set_text("CheckBox Radio1"); + rbx1->set_pressed(true); + gbvb->add_child(rbx1); + CheckBox *rbx2 = memnew( CheckBox ); + rbx2->set_text("CheckBox Radio2"); + gbvb->add_child(rbx2); + bg->add_child(gbvb); + first_vb->add_child(bg); + */ MenuButton* test_menu_button = memnew( MenuButton ); test_menu_button->set_text("MenuButton"); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 98156422ee4..83432b92320 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -33,6 +33,8 @@ #include "scene/gui/texture_frame.h" #include "scene/gui/option_button.h" #include "scene/gui/file_dialog.h" +#include "scene/gui/check_box.h" +#include "scene/gui/button_group.h" #include "tools/editor/editor_node.h"