1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Bind remaining theme properties to their respective classes

This adds binds for GraphEdit/GraphElement/GraphNode, which were
skipped before due to a rework. This also adds binds for Window,
which was skipped before due to a complicated code organization.

Also adds theme cache entries/direct cache access to a few places
that previously missed it. Some theme properties are now exposed
to other classes via friendships or public getters for convenience.

This removes all string-based theme access from scene/ classes.
This commit is contained in:
Yuri Sizov
2023-09-12 15:01:42 +02:00
parent 98b50eb308
commit fe000277ea
26 changed files with 356 additions and 189 deletions

View File

@@ -1804,7 +1804,7 @@ Rect2i Window::fit_rect_in_parent(Rect2i p_rect, const Rect2i &p_parent_rect) co
p_rect.position.x = 0;
}
int title_height = get_flag(Window::FLAG_BORDERLESS) ? 0 : get_theme_constant(SNAME("title_height"));
int title_height = get_flag(Window::FLAG_BORDERLESS) ? 0 : theme_cache.title_height;
if (p_rect.position.y < title_height) {
p_rect.position.y = title_height;
@@ -2910,6 +2910,23 @@ void Window::_bind_methods() {
BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_KEYBOARD_FOCUS);
GDVIRTUAL_BIND(_get_contents_minimum_size);
BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, Window, embedded_border);
BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, Window, embedded_unfocused_border);
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT, Window, title_font);
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT_SIZE, Window, title_font_size);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, Window, title_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Window, title_height);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, Window, title_outline_modulate);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Window, title_outline_size);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, Window, close);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, Window, close_pressed);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Window, close_h_offset);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Window, close_v_offset);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Window, resize_margin);
}
Window::Window() {