diff options
Diffstat (limited to 'scene/main/window.cpp')
-rw-r--r-- | scene/main/window.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index cffbb794c5..ba53a5e3c3 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1269,7 +1269,9 @@ void Window::_notification(int p_what) { notification(NOTIFICATION_TRANSLATION_CHANGED); } #endif - notification(NOTIFICATION_THEME_CHANGED); + + // Emits NOTIFICATION_THEME_CHANGED internally. + set_theme_context(ThemeDB::get_singleton()->get_nearest_theme_context(this)); } break; case NOTIFICATION_READY: { @@ -1313,6 +1315,8 @@ void Window::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { + set_theme_context(nullptr, false); + if (transient) { _clear_transient(); } @@ -1889,6 +1893,11 @@ bool Window::has_theme_owner_node() const { return theme_owner->has_owner_node(); } +void Window::set_theme_context(ThemeContext *p_context, bool p_propagate) { + ERR_MAIN_THREAD_GUARD; + theme_owner->set_owner_context(p_context, p_propagate); +} + void Window::set_theme(const Ref<Theme> &p_theme) { ERR_MAIN_THREAD_GUARD; if (theme == p_theme) { @@ -2129,6 +2138,12 @@ int Window::get_theme_constant(const StringName &p_name, const StringName &p_the return constant; } +#ifdef TOOLS_ENABLED +Ref<Texture2D> Window::get_editor_theme_icon(const StringName &p_name) const { + return get_theme_icon(p_name, SNAME("EditorIcons")); +} +#endif + bool Window::has_theme_icon(const StringName &p_name, const StringName &p_theme_type) const { ERR_READ_THREAD_GUARD_V(false); if (!initialized) { @@ -2881,7 +2896,7 @@ Window::Window() { max_size_used = max_size; // Update max_size_used. } - theme_owner = memnew(ThemeOwner); + theme_owner = memnew(ThemeOwner(this)); RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); } |