You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +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:
@@ -127,9 +127,9 @@ void CheckBox::_notification(int p_what) {
|
||||
ofs.y = int((get_size().height - get_icon_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.checkbox_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.checkbox_unchecked_color);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
@@ -152,6 +152,9 @@ void CheckBox::_bind_methods() {
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckBox, unchecked_disabled);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckBox, radio_checked_disabled);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, CheckBox, radio_unchecked_disabled);
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, CheckBox, checkbox_checked_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, CheckBox, checkbox_unchecked_color);
|
||||
}
|
||||
|
||||
CheckBox::CheckBox(const String &p_text) :
|
||||
|
||||
Reference in New Issue
Block a user