Register theme properties with ThemeDB
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "scene/theme/theme_db.h"
|
||||
|
||||
static const int NONE_SELECTED = -1;
|
||||
|
||||
@ -72,25 +73,6 @@ Size2 OptionButton::get_minimum_size() const {
|
||||
return minsize;
|
||||
}
|
||||
|
||||
void OptionButton::_update_theme_item_cache() {
|
||||
Button::_update_theme_item_cache();
|
||||
|
||||
theme_cache.normal = get_theme_stylebox(SNAME("normal"));
|
||||
|
||||
theme_cache.font_color = get_theme_color(SNAME("font_color"));
|
||||
theme_cache.font_focus_color = get_theme_color(SNAME("font_focus_color"));
|
||||
theme_cache.font_pressed_color = get_theme_color(SNAME("font_pressed_color"));
|
||||
theme_cache.font_hover_color = get_theme_color(SNAME("font_hover_color"));
|
||||
theme_cache.font_hover_pressed_color = get_theme_color(SNAME("font_hover_pressed_color"));
|
||||
theme_cache.font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
|
||||
|
||||
theme_cache.h_separation = get_theme_constant(SNAME("h_separation"));
|
||||
|
||||
theme_cache.arrow_icon = get_theme_icon(SNAME("arrow"));
|
||||
theme_cache.arrow_margin = get_theme_constant(SNAME("arrow_margin"));
|
||||
theme_cache.modulate_arrow = get_theme_constant(SNAME("modulate_arrow"));
|
||||
}
|
||||
|
||||
void OptionButton::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_POSTINITIALIZE: {
|
||||
@ -597,8 +579,24 @@ void OptionButton::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_to_longest_item"), "set_fit_to_longest_item", "is_fit_to_longest_item");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
|
||||
ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "index")));
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, OptionButton, normal);
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_focus_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_pressed_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_hover_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_hover_pressed_color);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, OptionButton, font_disabled_color);
|
||||
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, OptionButton, h_separation);
|
||||
|
||||
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, OptionButton, arrow_icon, "arrow");
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, OptionButton, arrow_margin);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, OptionButton, modulate_arrow);
|
||||
}
|
||||
|
||||
void OptionButton::set_disable_shortcuts(bool p_disabled) {
|
||||
|
||||
Reference in New Issue
Block a user