diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-03-22 14:55:36 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-03-22 14:55:36 -0300 |
commit | 6d813c81b814da2a0cfaf6a6f879020e66e90bb9 (patch) | |
tree | a65634fa6b0ba219654532c76c890d35755bb49e | |
parent | a8f55d11d33c6cd17d798d511767a4f1b26f30f3 (diff) | |
parent | 0bc7eb1d91212e5fcc799d1b790430a4c2468751 (diff) |
Merge pull request #1460 from MarianoGnu/master
Create Checkbox class with support for Radio Buttons
-rw-r--r-- | scene/gui/base_button.cpp | 5 | ||||
-rw-r--r-- | scene/gui/check_box.cpp | 79 | ||||
-rw-r--r-- | scene/gui/check_box.h | 55 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 2 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 38 | ||||
-rw-r--r-- | scene/resources/default_theme/radio_checked.png | bin | 0 -> 569 bytes | |||
-rw-r--r-- | scene/resources/default_theme/radio_unchecked.png | bin | 0 -> 421 bytes | |||
-rw-r--r-- | scene/resources/default_theme/theme_data.h | 10 | ||||
-rw-r--r-- | tools/editor/icons/icon_check_box.png | bin | 0 -> 344 bytes | |||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.cpp | 20 | ||||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.h | 2 |
11 files changed, 207 insertions, 4 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 0167687621..bbe15da1cc 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/gui/check_box.cpp b/scene/gui/check_box.cpp new file mode 100644 index 0000000000..309152ba8f --- /dev/null +++ b/scene/gui/check_box.cpp @@ -0,0 +1,79 @@ +/*************************************************************************/ +/* check_button.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "check_box.h" + +#include "servers/visual_server.h" +#include "button_group.h" + + +void CheckBox::_notification(int p_what) { + + if (p_what==NOTIFICATION_DRAW) { + + RID ci = get_canvas_item(); + + Ref<Texture> on=Control::get_icon(is_radio() ? "radio_checked" : "checked"); + Ref<Texture> off=Control::get_icon(is_radio() ? "radio_unchecked" : "unchecked"); + + Vector2 ofs; + ofs.x = 0; + ofs.y = int((get_size().height - on->get_height())/2); + + if (is_pressed()) + on->draw(ci,ofs); + else + off->draw(ci,ofs); + + + } +} + +bool CheckBox::is_radio() +{ + Node* parent = this; + do { + parent = parent->get_parent(); + if (dynamic_cast< ButtonGroup* >(parent)) + break; + } while (parent); + + return (parent != 0); +} + +CheckBox::CheckBox(const String &p_text): + Button(p_text) +{ + set_toggle_mode(true); + set_text_align(ALIGN_LEFT); + +} + +CheckBox::~CheckBox() +{ +} diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h new file mode 100644 index 0000000000..171fd55351 --- /dev/null +++ b/scene/gui/check_box.h @@ -0,0 +1,55 @@ +/*************************************************************************/ +/* check_box.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef CHECK_BOX_H +#define CHECK_BOX_H + + +#include "scene/gui/button.h" +/** +@author Mariano Suligoy <marianognu.esyrpg@gmail.com> +*/ +class CheckBox : public Button { + + OBJ_TYPE( CheckBox, Button ); + + +protected: + void _notification(int p_what); + + bool is_radio(); + + +public: + + CheckBox(const String& p_text=String()); + ~CheckBox(); + +}; + +#endif diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 5d5e7595d7..ac911ce63e 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" @@ -289,6 +290,7 @@ void register_scene_types() { ObjectTypeDB::register_type<Popup>(); ObjectTypeDB::register_type<PopupPanel>(); ObjectTypeDB::register_type<MenuButton>(); + ObjectTypeDB::register_type<CheckBox>(); ObjectTypeDB::register_type<CheckButton>(); ObjectTypeDB::register_type<Panel>(); ObjectTypeDB::register_type<Range>(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 4d1e9896db..7d5981522e 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -300,6 +300,40 @@ void make_default_theme() { t->set_constant("hseparation","MenuButton", 0 ); + // CheckBox + + Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty ); + cbx_empty->set_default_margin(MARGIN_LEFT,22); + cbx_empty->set_default_margin(MARGIN_RIGHT,4); + cbx_empty->set_default_margin(MARGIN_TOP,4); + cbx_empty->set_default_margin(MARGIN_BOTTOM,5); + Ref<StyleBox> cbx_focus = focus; + cbx_focus->set_default_margin(MARGIN_LEFT,4); + cbx_focus->set_default_margin(MARGIN_RIGHT,22); + cbx_focus->set_default_margin(MARGIN_TOP,4); + cbx_focus->set_default_margin(MARGIN_BOTTOM,5); + + t->set_stylebox("normal","CheckBox", cbx_empty ); + t->set_stylebox("pressed","CheckBox", cbx_empty ); + t->set_stylebox("disabled","CheckBox", cbx_empty ); + t->set_stylebox("hover","CheckBox", cbx_empty ); + t->set_stylebox("focus","CheckBox", cbx_focus ); + + t->set_icon("checked", "CheckBox", make_icon(checked_png)); + t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png)); + t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png)); + t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png)); + + t->set_font("font","CheckBox", default_font ); + + t->set_color("font_color","CheckBox", control_font_color ); + t->set_color("font_color_pressed","CheckBox", control_font_color_pressed ); + t->set_color("font_color_hover","CheckBox", control_font_color_hover ); + t->set_color("font_color_disabled","CheckBox", control_font_color_disabled ); + + t->set_constant("hseparation","CheckBox",4); + t->set_constant("check_vadjust","CheckBox",0); + // CheckButton @@ -308,7 +342,7 @@ void make_default_theme() { cb_empty->set_default_margin(MARGIN_LEFT,6); cb_empty->set_default_margin(MARGIN_RIGHT,70); cb_empty->set_default_margin(MARGIN_TOP,4); - cb_empty->set_default_margin(MARGIN_BOTTOM,4); + cb_empty->set_default_margin(MARGIN_BOTTOM,4); t->set_stylebox("normal","CheckButton", cb_empty ); t->set_stylebox("pressed","CheckButton", cb_empty ); @@ -540,7 +574,7 @@ void make_default_theme() { // Tree Ref<StyleBoxTexture> tree_selected = make_stylebox( selection_png,4,4,4,4,8,0,8,0); - Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0); + Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0); t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5) ); t->set_stylebox("bg_focus","Tree", focus ); diff --git a/scene/resources/default_theme/radio_checked.png b/scene/resources/default_theme/radio_checked.png Binary files differnew file mode 100644 index 0000000000..ada8dde3c1 --- /dev/null +++ b/scene/resources/default_theme/radio_checked.png diff --git a/scene/resources/default_theme/radio_unchecked.png b/scene/resources/default_theme/radio_unchecked.png Binary files differnew file mode 100644 index 0000000000..018af99afd --- /dev/null +++ b/scene/resources/default_theme/radio_unchecked.png diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index e9a6d3dad6..78e210239d 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -264,6 +264,16 @@ static const unsigned char progress_fill_png[]={ }; +static const unsigned char radio_checked_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdf,0x3,0x1,0x4,0x19,0x36,0x83,0x13,0x8d,0xb2,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47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,0x13,0xa0,0x52,0xa9,0x7c,0x6c,0x36,0x8f,0x9e,0x1f,0x1c,0xd4,0xc8,0xb2,0x8c,0x4e,0xa7,0x43,0xab,0xd5,0x62,0x30,0x18,0x30,0x1c,0xe,0x19,0x8d,0x46,0xac,0x56,0x2b,0xea,0xf5,0x3a,0x96,0x65,0x21,0x52,0xda,0xb9,0xba,0xba,0x5c,0xce,0x66,0xb3,0x6f,0xeb,0xf1,0x2f,0xe2,0x38,0x16,0xad,0xb5,0x4,0x41,0x20,0x4a,0x29,0x1,0xee,0x1c,0xa5,0x94,0x4,0x41,0x20,0x5a,0x6b,0x89,0xe3,0x58,0x1c,0xc7,0xb9,0x0,0x28,0xe5,0xf6,0xaa,0x6b,0xdf,0x51,0x14,0x91,0x24,0xc9,0x86,0xff,0x24,0x49,0xa,0x4b,0x39,0xb7,0xfa,0xb7,0xc0,0x7f,0x63,0x2d,0x70,0x2d,0x22,0xc5,0x83,0xd9,0xb6,0xbd,0x41,0xb4,0x6d,0x1b,0xd7,0x75,0x8b,0x6d,0xe4,0xd9,0x28,0x4,0xfa,0xdd,0xee,0x39,0x0,0x9e,0xe7,0xe1,0xfb,0x3e,0x4a,0x29,0x4c,0xd3,0xc4,0x34,0x4d,0x94,0x52,0xf8,0xbe,0x8f,0xe7,0x79,0x0,0xe4,0xdc,0xfe,0x83,0xac,0x71,0xeb,0x20,0x99,0xeb,0xe6,0x62,0xb1,0xf8,0x6e,0x18,0x4c,0xc3,0x30,0x7c,0x21,0x52,0xda,0xa9,0xd5,0x9e,0x6d,0x44,0xf9,0xf4,0xf4,0x43,0x3a,0x9f,0xcf,0xdf,0xdc,0xde,0xfe,0x6a,0x2f,0x97,0xcb,0x87,0xf9,0x4c,0x5b,0xe3,0x37,0x57,0xdf,0xd7,0x8,0xe6,0x62,0x7d,0xab,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + +static const unsigned char radio_unchecked_png[]={ +0x89,0x50,0x4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,0x3c,0x1e,0x1d,0x81,0xe3,0x78,0x89,0xc5,0xe2,0x5d,0x1,0x90,0x79,0x9e,0x47,0x4a,0xa9,0x63,0x80,0x10,0x62,0xda,0xeb,0xf5,0xdf,0x82,0xe0,0xf5,0x6c,0xc9,0x52,0xce,0xb0,0xdd,0x7e,0x3c,0x11,0x51,0x74,0x0,0x70,0xd9,0x9b,0x34,0x4d,0xad,0x36,0x7d,0xbb,0xae,0xab,0x0,0xdc,0x13,0x51,0x61,0x72,0xcc,0xf7,0xbc,0x89,0xd5,0x76,0x70,0xec,0xf5,0x1,0xa0,0x1,0x38,0xa7,0x3d,0x9f,0x13,0x7b,0x1d,0x1d,0x60,0x5f,0xb0,0x41,0x5b,0x7,0x5c,0x2c,0x53,0xdb,0xf3,0x5f,0xb5,0xd6,0x1,0x59,0x1c,0x2f,0x5b,0x67,0xb2,0x37,0xd3,0x1,0x21,0x1f,0x49,0x2b,0xb1,0x37,0x3c,0x0,0xf8,0x3c,0xa5,0x94,0xb3,0x5f,0x93,0xd9,0x23,0x9b,0x93,0xee,0x34,0xf,0x55,0x55,0xad,0xc,0x3,0x45,0x92,0x24,0x8f,0xfb,0xbd,0x79,0x33,0x1c,0x3e,0x7c,0x2b,0x7b,0x3e,0x7f,0x51,0x65,0x59,0x3e,0xef,0x76,0x9f,0x51,0x5d,0xd7,0xff,0xf3,0x99,0xae,0xd6,0x17,0xf,0x97,0x66,0x8b,0x3d,0xf1,0x64,0x47,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + static const unsigned char reference_border_png[]={ 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdb,0x7,0x9,0x11,0x2b,0x1a,0xed,0xf3,0x18,0x82,0x0,0x0,0x0,0x5b,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0xfc,0xbf,0x7d,0xfb,0x7f,0x6,0x6,0x6,0x6,0x86,0xae,0x2e,0x6,0x92,0x40,0x59,0x19,0x84,0x86,0x1b,0x40,0x6,0xf8,0xbf,0x7d,0xfb,0x7f,0xc6,0xff,0x8e,0x8e,0xff,0x19,0xf7,0xef,0x67,0xfc,0x7f,0xf1,0x22,0x49,0x9a,0x19,0xf5,0xf5,0x19,0xfe,0x3b,0x3a,0xfe,0x67,0x41,0x17,0x24,0xca,0x66,0x24,0xcb,0x98,0x18,0x28,0x4,0xa3,0x6,0x8c,0x1a,0xc0,0xc0,0xc0,0xc0,0xc0,0x82,0x2b,0x85,0x91,0x94,0x21,0x28,0xcb,0x4c,0x14,0x66,0x67,0x0,0x0,0x2b,0x27,0xc7,0x5e,0xa8,0x15,0xe4,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 }; diff --git a/tools/editor/icons/icon_check_box.png b/tools/editor/icons/icon_check_box.png Binary files differnew file mode 100644 index 0000000000..8a2b56cc3e --- /dev/null +++ b/tools/editor/icons/icon_check_box.png diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index ccbd923118..bd6fb37b29 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 98156422ee..83432b9232 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" |