diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp index 8d1fa80b847..c92d7f26960 100644 --- a/scene/gui/button_group.cpp +++ b/scene/gui/button_group.cpp @@ -155,6 +155,6 @@ void ButtonGroup::_bind_methods() { } -ButtonGroup::ButtonGroup() +ButtonGroup::ButtonGroup() : BoxContainer(true) { } diff --git a/scene/gui/button_group.h b/scene/gui/button_group.h index 24edf949940..74e847e9377 100644 --- a/scene/gui/button_group.h +++ b/scene/gui/button_group.h @@ -29,14 +29,14 @@ #ifndef BUTTON_GROUP_H #define BUTTON_GROUP_H -#include "scene/gui/control.h" +#include "scene/gui/box_container.h" class BaseButton; -class ButtonGroup : public Control { +class ButtonGroup : public BoxContainer { - OBJ_TYPE(ButtonGroup,Control); + OBJ_TYPE(ButtonGroup,BoxContainer); Set buttons; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 5a99538a5f2..9f25337c3d4 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -299,6 +299,10 @@ void make_default_theme() { t->set_constant("hseparation","MenuButton", 3 ); + // ButtonGroup + + t->set_stylebox("panel","ButtonGroup", memnew( StyleBoxEmpty )); + // CheckBox Ref cbx_empty = memnew( StyleBoxEmpty ); diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 55e8f164d6f..63ba57bfc0a 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -568,26 +568,24 @@ 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 ); + 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); - */ + + 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");