diff options
Diffstat (limited to 'editor/gui/editor_file_dialog.h')
-rw-r--r-- | editor/gui/editor_file_dialog.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/editor/gui/editor_file_dialog.h b/editor/gui/editor_file_dialog.h index 1e1c99bc76..7d6fa19a44 100644 --- a/editor/gui/editor_file_dialog.h +++ b/editor/gui/editor_file_dialog.h @@ -33,7 +33,9 @@ #include "core/io/dir_access.h" #include "scene/gui/dialogs.h" +#include "scene/property_list_helper.h" +class GridContainer; class DependencyRemoveDialog; class HSplitContainer; class ItemList; @@ -87,6 +89,7 @@ private: Button *makedir = nullptr; Access access = ACCESS_RESOURCES; + GridContainer *grid_options = nullptr; VBoxContainer *vbox = nullptr; FileMode mode = FILE_MODE_SAVE_FILE; bool can_create_dir = false; @@ -113,6 +116,9 @@ private: ConfirmationDialog *confirm_save = nullptr; DependencyRemoveDialog *dep_remove_dialog = nullptr; ConfirmationDialog *global_remove_dialog = nullptr; + VBoxContainer *side_vbox = nullptr; + VBoxContainer *vbc = nullptr; + HBoxContainer *pathhb = nullptr; Button *mode_thumbnails = nullptr; Button *mode_list = nullptr; @@ -174,6 +180,19 @@ private: Ref<Texture2D> progress[8]{}; } theme_cache; + struct Option { + String name; + Vector<String> values; + int default_idx = 0; + }; + + static inline PropertyListHelper base_property_helper; + PropertyListHelper property_helper; + + Vector<Option> options; + Dictionary selected_options; + bool options_dirty = false; + void update_dir(); void update_file_name(); void update_file_list(); @@ -233,15 +252,33 @@ private: bool _is_open_should_be_disabled(); + void _update_side_menu_visibility(bool p_native_dlg); + + void _native_popup(); + void _native_dialog_cb(bool p_ok, const Vector<String> &p_files, int p_filter, const Dictionary &p_selected_options); + + TypedArray<Dictionary> _get_options() const; + void _update_option_controls(); + void _option_changed_checkbox_toggled(bool p_pressed, const String &p_name); + void _option_changed_item_selected(int p_idx, const String &p_name); + protected: virtual void _update_theme_item_cache() override; void _notification(int p_what); + bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); } + bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); } + void _get_property_list(List<PropertyInfo> *p_list) const { property_helper.get_property_list(p_list, options.size()); } + bool _property_can_revert(const StringName &p_name) const { return property_helper.property_can_revert(p_name); } + bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return property_helper.property_get_revert(p_name, r_property); } static void _bind_methods(); public: Color get_dir_icon_color(const String &p_dir_path); + virtual void set_visible(bool p_visible) override; + virtual void popup(const Rect2i &p_rect = Rect2i()) override; + // Public for use with callable_mp. void _file_submitted(const String &p_file); @@ -261,6 +298,20 @@ public: void set_current_file(const String &p_file); void set_current_path(const String &p_path); + String get_option_name(int p_option) const; + Vector<String> get_option_values(int p_option) const; + int get_option_default(int p_option) const; + void set_option_name(int p_option, const String &p_name); + void set_option_values(int p_option, const Vector<String> &p_values); + void set_option_default(int p_option, int p_index); + + void add_option(const String &p_name, const Vector<String> &p_values, int p_index); + + void set_option_count(int p_count); + int get_option_count() const; + + Dictionary get_selected_options() const; + void set_display_mode(DisplayMode p_mode); DisplayMode get_display_mode() const; |