Fix ButtonGroup broken layout

This commit is contained in:
MarianoGNU 2015-10-19 17:46:13 -03:00
parent ede0cf20bb
commit 6df7d92379
4 changed files with 25 additions and 23 deletions

View File

@ -155,6 +155,6 @@ void ButtonGroup::_bind_methods() {
} }
ButtonGroup::ButtonGroup() ButtonGroup::ButtonGroup() : BoxContainer(true)
{ {
} }

View File

@ -29,14 +29,14 @@
#ifndef BUTTON_GROUP_H #ifndef BUTTON_GROUP_H
#define BUTTON_GROUP_H #define BUTTON_GROUP_H
#include "scene/gui/control.h" #include "scene/gui/box_container.h"
class BaseButton; class BaseButton;
class ButtonGroup : public Control { class ButtonGroup : public BoxContainer {
OBJ_TYPE(ButtonGroup,Control); OBJ_TYPE(ButtonGroup,BoxContainer);
Set<BaseButton*> buttons; Set<BaseButton*> buttons;

View File

@ -299,6 +299,10 @@ void make_default_theme() {
t->set_constant("hseparation","MenuButton", 3 ); t->set_constant("hseparation","MenuButton", 3 );
// ButtonGroup
t->set_stylebox("panel","ButtonGroup", memnew( StyleBoxEmpty ));
// CheckBox // CheckBox
Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty ); Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );

View File

@ -572,8 +572,7 @@ ThemeEditor::ThemeEditor() {
cbx->set_text("CheckBox"); cbx->set_text("CheckBox");
first_vb->add_child(cbx ); first_vb->add_child(cbx );
/* TODO: This is not working properly, controls are overlapping*/
/*
ButtonGroup *bg = memnew( ButtonGroup ); ButtonGroup *bg = memnew( ButtonGroup );
bg->set_v_size_flags(SIZE_EXPAND_FILL); bg->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *gbvb = memnew( VBoxContainer ); VBoxContainer *gbvb = memnew( VBoxContainer );
@ -587,7 +586,6 @@ ThemeEditor::ThemeEditor() {
gbvb->add_child(rbx2); gbvb->add_child(rbx2);
bg->add_child(gbvb); bg->add_child(gbvb);
first_vb->add_child(bg); first_vb->add_child(bg);
*/
MenuButton* test_menu_button = memnew( MenuButton ); MenuButton* test_menu_button = memnew( MenuButton );
test_menu_button->set_text("MenuButton"); test_menu_button->set_text("MenuButton");