diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
commit | ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch) | |
tree | 5f9c387037d0142d40f7275575436483dc0a7237 /scene/gui/button_array.cpp | |
parent | ab4126f51061277e87b41c48b40e7b54942d4eca (diff) | |
parent | 45c5c89de961357a7042d9e1f063e288d7a510cf (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'scene/gui/button_array.cpp')
-rw-r--r-- | scene/gui/button_array.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp index df1872380d..1c8e216c39 100644 --- a/scene/gui/button_array.cpp +++ b/scene/gui/button_array.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 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 */ @@ -267,9 +267,9 @@ void ButtonArray::_notification(int p_what) { } else { if (hover==i) draw_style_box(style_hover,r); - else + else if (!flat) draw_style_box(style_normal,r); - sbsize=style_selected->get_minimum_size(); + sbsize=style_normal->get_minimum_size(); sbofs=style_normal->get_offset(); f=font_normal; c=color_normal; @@ -388,6 +388,17 @@ ButtonArray::Align ButtonArray::get_align() const { return align; } +void ButtonArray::set_flat(bool p_flat) { + + flat=p_flat; + update(); +} + +bool ButtonArray::is_flat() const { + + return flat; +} + void ButtonArray::add_button(const String& p_text,const String& p_tooltip) { @@ -525,6 +536,8 @@ void ButtonArray::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_button_tooltip","button_idx"),&ButtonArray::get_button_tooltip); ObjectTypeDB::bind_method(_MD("get_button_icon:Texture","button_idx"),&ButtonArray::get_button_icon); ObjectTypeDB::bind_method(_MD("get_button_count"),&ButtonArray::get_button_count); + ObjectTypeDB::bind_method(_MD("set_flat","enabled"),&ButtonArray::set_flat); + ObjectTypeDB::bind_method(_MD("is_flat"),&ButtonArray::is_flat); ObjectTypeDB::bind_method(_MD("get_selected"),&ButtonArray::get_selected); ObjectTypeDB::bind_method(_MD("get_hovered"),&ButtonArray::get_hovered); ObjectTypeDB::bind_method(_MD("set_selected","button_idx"),&ButtonArray::set_selected); @@ -539,6 +552,8 @@ void ButtonArray::_bind_methods() { BIND_CONSTANT( ALIGN_FILL ); BIND_CONSTANT( ALIGN_EXPAND_FILL ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flat" ), _SCS("set_flat"),_SCS("is_flat") ); + ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::INT,"button_idx"))); } @@ -549,5 +564,6 @@ ButtonArray::ButtonArray(Orientation p_orientation) { selected=-1; set_focus_mode(FOCUS_ALL); hover=-1; + flat=false; min_button_size = -1; } |