summaryrefslogtreecommitdiff
path: root/editor/plugins/theme_editor_plugin.h
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2021-07-04 23:42:23 +0300
committerYuri Sizov <yuris@humnom.net>2021-07-13 02:26:28 +0300
commit4ee0e6ddf552fd82fffb5f2895a6f05c978144ad (patch)
tree81265256ab5690da126b475ad202e95b313db862 /editor/plugins/theme_editor_plugin.h
parent30d4732623df8a9c286eb1e0b5d3321b31bcfa86 (diff)
Add type variations to Theme
Diffstat (limited to 'editor/plugins/theme_editor_plugin.h')
-rw-r--r--editor/plugins/theme_editor_plugin.h55
1 files changed, 46 insertions, 9 deletions
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index cdedbbec8d..3c114a375a 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -263,6 +263,36 @@ public:
ThemeItemEditorDialog();
};
+class ThemeTypeDialog : public ConfirmationDialog {
+ GDCLASS(ThemeTypeDialog, ConfirmationDialog);
+
+ Ref<Theme> edited_theme;
+ bool include_own_types = false;
+
+ LineEdit *add_type_filter;
+ ItemList *add_type_options;
+
+ void _dialog_about_to_show();
+ void ok_pressed() override;
+
+ void _update_add_type_options(const String &p_filter = "");
+
+ void _add_type_filter_cbk(const String &p_value);
+ void _add_type_options_cbk(int p_index);
+ void _add_type_dialog_entered(const String &p_value);
+ void _add_type_dialog_activated(int p_index);
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void set_edited_theme(const Ref<Theme> &p_theme);
+ void set_include_own_types(bool p_enable);
+
+ ThemeTypeDialog();
+};
+
class ThemeTypeEditor : public MarginContainer {
GDCLASS(ThemeTypeEditor, MarginContainer);
@@ -281,9 +311,6 @@ class ThemeTypeEditor : public MarginContainer {
OptionButton *theme_type_list;
Button *add_type_button;
- ConfirmationDialog *add_type_dialog;
- LineEdit *add_type_filter;
- ItemList *add_type_options;
CheckButton *show_default_items_button;
@@ -295,13 +322,23 @@ class ThemeTypeEditor : public MarginContainer {
VBoxContainer *icon_items_list;
VBoxContainer *stylebox_items_list;
+ LineEdit *type_variation_edit;
+ Button *type_variation_button;
+
+ enum TypeDialogMode {
+ ADD_THEME_TYPE,
+ ADD_VARIATION_BASE,
+ };
+
+ TypeDialogMode add_type_mode = ADD_THEME_TYPE;
+ ThemeTypeDialog *add_type_dialog;
+
Vector<Control *> focusables;
Timer *update_debounce_timer;
VBoxContainer *_create_item_list(Theme::DataType p_data_type);
void _update_type_list();
void _update_type_list_debounced();
- void _update_add_type_options(const String &p_filter = "");
OrderedHashMap<StringName, bool> _get_type_items(String p_type_name, void (Theme::*get_list_func)(StringName, List<StringName> *) const, bool include_default);
HBoxContainer *_create_property_control(Theme::DataType p_data_type, String p_item_name, bool p_editable);
void _add_focusable(Control *p_control);
@@ -310,11 +347,6 @@ class ThemeTypeEditor : public MarginContainer {
void _list_type_selected(int p_index);
void _select_type(String p_type_name);
void _add_type_button_cbk();
- void _add_type_filter_cbk(const String &p_value);
- void _add_type_options_cbk(int p_index);
- void _add_type_dialog_confirmed();
- void _add_type_dialog_entered(const String &p_value);
- void _add_type_dialog_activated(int p_index);
void _add_default_type_items();
void _item_add_cbk(int p_data_type, Control *p_control);
@@ -337,6 +369,11 @@ class ThemeTypeEditor : public MarginContainer {
void _unpin_leading_stylebox();
void _update_stylebox_from_leading();
+ void _type_variation_changed(const String p_value);
+ void _add_type_variation_cbk();
+
+ void _add_type_dialog_selected(const String p_type_name);
+
protected:
void _notification(int p_what);