mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Introduce the concept of global theme contexts
This commit adds the default theme context, which replaces the need to manually check the project and the default theme all the time; simplifies related code. It also adds framework for custom theme contexts, to be used by the editor. Custom contexts can be attached to any node, and not necessarily a GUI/Window node. Contexts do no break theme inheritance and only define which global themes a node uses as a fallback. Contexts propagate NOTIFICATION_THEME_CHANGED when one of their global themes changes. This ensures that global themes act just like themes assigned to individual nodes and can be previewed live in the editor.
This commit is contained in:
parent
8449592d92
commit
58126e479c
13 changed files with 487 additions and 246 deletions
|
|
@ -42,6 +42,7 @@ class Viewport;
|
|||
class Label;
|
||||
class Panel;
|
||||
class ThemeOwner;
|
||||
class ThemeContext;
|
||||
|
||||
class Control : public CanvasItem {
|
||||
GDCLASS(Control, CanvasItem);
|
||||
|
|
@ -553,6 +554,8 @@ public:
|
|||
Node *get_theme_owner_node() const;
|
||||
bool has_theme_owner_node() const;
|
||||
|
||||
void set_theme_context(ThemeContext *p_context, bool p_propagate = true);
|
||||
|
||||
void set_theme(const Ref<Theme> &p_theme);
|
||||
Ref<Theme> get_theme() const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue