You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Allow modification of the color for the checkbox's checked and unchecked icons
Occasionally, the default white color for the icon does not meet our needs, and we would like to change it. However, the CheckBox does not currently have a mechanism to modify this color.
This commit is contained in:
@@ -134,9 +134,9 @@ void CheckButton::_notification(int p_what) {
|
||||
ofs.y = (get_size().height - tex_size.height) / 2 + theme_cache.check_v_offset;
|
||||
|
||||
if (is_pressed()) {
|
||||
on_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(on_tex->get_size())));
|
||||
on_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(on_tex->get_size())), false, theme_cache.button_checked_color);
|
||||
} else {
|
||||
off_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(off_tex->get_size())));
|
||||
off_tex->draw_rect(ci, Rect2(ofs, _fit_icon_size(off_tex->get_size())), false, theme_cache.button_unchecked_color);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
@@ -155,6 +155,9 @@ void CheckButton::_bind_methods() {
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckButton, unchecked_mirrored);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckButton, checked_disabled_mirrored);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckButton, unchecked_disabled_mirrored);
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, CheckButton, button_checked_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, CheckButton, button_unchecked_color);
|
||||
}
|
||||
|
||||
CheckButton::CheckButton(const String &p_text) :
|
||||
|
||||
Reference in New Issue
Block a user