Respect style boxes for Button states other than "normal"
(cherry picked from commit 2baeb531e6
)
This commit is contained in:
parent
e5f0183b0a
commit
98f01f9143
|
@ -67,17 +67,21 @@ void Button::_notification(int p_what) {
|
||||||
|
|
||||||
//print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode()));
|
//print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode()));
|
||||||
|
|
||||||
|
Ref<StyleBox> style = get_stylebox("normal");
|
||||||
|
|
||||||
switch( get_draw_mode() ) {
|
switch( get_draw_mode() ) {
|
||||||
|
|
||||||
case DRAW_NORMAL: {
|
case DRAW_NORMAL: {
|
||||||
|
|
||||||
|
style = get_stylebox("normal");
|
||||||
if (!flat)
|
if (!flat)
|
||||||
get_stylebox("normal" )->draw( ci, Rect2(Point2(0,0), size) );
|
style->draw( ci, Rect2(Point2(0,0), size) );
|
||||||
color=get_color("font_color");
|
color=get_color("font_color");
|
||||||
} break;
|
} break;
|
||||||
case DRAW_PRESSED: {
|
case DRAW_PRESSED: {
|
||||||
|
|
||||||
get_stylebox("pressed" )->draw( ci, Rect2(Point2(0,0), size) );
|
style = get_stylebox("pressed");
|
||||||
|
style->draw( ci, Rect2(Point2(0,0), size) );
|
||||||
if (has_color("font_color_pressed"))
|
if (has_color("font_color_pressed"))
|
||||||
color=get_color("font_color_pressed");
|
color=get_color("font_color_pressed");
|
||||||
else
|
else
|
||||||
|
@ -86,13 +90,15 @@ void Button::_notification(int p_what) {
|
||||||
} break;
|
} break;
|
||||||
case DRAW_HOVER: {
|
case DRAW_HOVER: {
|
||||||
|
|
||||||
get_stylebox("hover" )->draw( ci, Rect2(Point2(0,0), size) );
|
style = get_stylebox("hover");
|
||||||
|
style->draw( ci, Rect2(Point2(0,0), size) );
|
||||||
color=get_color("font_color_hover");
|
color=get_color("font_color_hover");
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case DRAW_DISABLED: {
|
case DRAW_DISABLED: {
|
||||||
|
|
||||||
get_stylebox("disabled" )->draw( ci, Rect2(Point2(0,0), size) );
|
style = get_stylebox("disabled");
|
||||||
|
style->draw( ci, Rect2(Point2(0,0), size) );
|
||||||
color=get_color("font_color_disabled");
|
color=get_color("font_color_disabled");
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -104,7 +110,6 @@ void Button::_notification(int p_what) {
|
||||||
style->draw(ci,Rect2(Point2(),size));
|
style->draw(ci,Rect2(Point2(),size));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<StyleBox> style = get_stylebox("normal" );
|
|
||||||
Ref<Font> font=get_font("font");
|
Ref<Font> font=get_font("font");
|
||||||
Ref<Texture> _icon;
|
Ref<Texture> _icon;
|
||||||
if (icon.is_null() && has_icon("icon"))
|
if (icon.is_null() && has_icon("icon"))
|
||||||
|
|
Loading…
Reference in New Issue