Register theme properties with ThemeDB

This commit is contained in:
Yuri Sizov
2023-09-08 21:00:10 +02:00
parent 8c1817f755
commit 2924bfd4d3
71 changed files with 837 additions and 802 deletions

View File

@@ -31,6 +31,7 @@
#include "progress_bar.h"
#include "scene/resources/text_line.h"
#include "scene/theme/theme_db.h"
Size2 ProgressBar::get_minimum_size() const {
Size2 minimum_size = theme_cache.background_style->get_minimum_size();
@@ -47,19 +48,6 @@ Size2 ProgressBar::get_minimum_size() const {
return minimum_size;
}
void ProgressBar::_update_theme_item_cache() {
Range::_update_theme_item_cache();
theme_cache.background_style = get_theme_stylebox(SNAME("background"));
theme_cache.fill_style = get_theme_stylebox(SNAME("fill"));
theme_cache.font = get_theme_font(SNAME("font"));
theme_cache.font_size = get_theme_font_size(SNAME("font_size"));
theme_cache.font_color = get_theme_color(SNAME("font_color"));
theme_cache.font_outline_size = get_theme_constant(SNAME("outline_size"));
theme_cache.font_outline_color = get_theme_color(SNAME("font_outline_color"));
}
void ProgressBar::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
@@ -158,6 +146,15 @@ void ProgressBar::_bind_methods() {
BIND_ENUM_CONSTANT(FILL_END_TO_BEGIN);
BIND_ENUM_CONSTANT(FILL_TOP_TO_BOTTOM);
BIND_ENUM_CONSTANT(FILL_BOTTOM_TO_TOP);
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ProgressBar, background_style, "background");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ProgressBar, fill_style, "fill");
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT, ProgressBar, font);
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT_SIZE, ProgressBar, font_size);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ProgressBar, font_color);
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_CONSTANT, ProgressBar, font_outline_size, "outline_size");
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ProgressBar, font_outline_color);
}
ProgressBar::ProgressBar() {