diff options
Diffstat (limited to 'scene/gui/file_dialog.h')
-rw-r--r-- | scene/gui/file_dialog.h | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index d9ab00e0f2..8003650668 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -36,11 +36,9 @@ #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" -#include "scene/gui/tool_button.h" #include "scene/gui/tree.h" class FileDialog : public ConfirmationDialog { - GDCLASS(FileDialog, ConfirmationDialog); public: @@ -50,15 +48,15 @@ public: ACCESS_FILESYSTEM }; - enum Mode { - MODE_OPEN_FILE, - MODE_OPEN_FILES, - MODE_OPEN_DIR, - MODE_OPEN_ANY, - MODE_SAVE_FILE + enum FileMode { + FILE_MODE_OPEN_FILE, + FILE_MODE_OPEN_FILES, + FILE_MODE_OPEN_DIR, + FILE_MODE_OPEN_ANY, + FILE_MODE_SAVE_FILE }; - typedef Ref<Texture> (*GetIconFunc)(const String &); + typedef Ref<Texture2D> (*GetIconFunc)(const String &); typedef void (*RegisterFunc)(FileDialog *); static GetIconFunc get_icon_func; @@ -74,8 +72,10 @@ private: Access access; //Button *action; VBoxContainer *vbox; - Mode mode; + FileMode mode; LineEdit *dir; + HBoxContainer *drives_container; + HBoxContainer *shortcuts_container; OptionButton *drives; Tree *tree; HBoxContainer *file_box; @@ -86,10 +86,10 @@ private: DirAccess *dir_access; ConfirmationDialog *confirm_save; - ToolButton *dir_up; + Button *dir_up; - ToolButton *refresh; - ToolButton *show_hidden; + Button *refresh; + Button *show_hidden; Vector<String> filters; @@ -126,13 +126,16 @@ private: bool _is_open_should_be_disabled(); - virtual void _post_popup(); + virtual void _post_popup() override; protected: + void _theme_changed(); + void _notification(int p_what); static void _bind_methods(); //bind helpers public: + void popup_file_dialog(); void clear_filters(); void add_filter(const String &p_filter); void set_filters(const Vector<String> &p_filters); @@ -151,8 +154,8 @@ public: void set_mode_overrides_title(bool p_override); bool is_mode_overriding_title() const; - void set_mode(Mode p_mode); - Mode get_mode() const; + void set_file_mode(FileMode p_mode); + FileMode get_file_mode() const; VBoxContainer *get_vbox(); LineEdit *get_line_edit() { return file; } @@ -173,28 +176,7 @@ public: ~FileDialog(); }; -class LineEditFileChooser : public HBoxContainer { - - GDCLASS(LineEditFileChooser, HBoxContainer); - Button *button; - LineEdit *line_edit; - FileDialog *dialog; - - void _chosen(const String &p_text); - void _browse(); - -protected: - static void _bind_methods(); - -public: - Button *get_button() { return button; } - LineEdit *get_line_edit() { return line_edit; } - FileDialog *get_file_dialog() { return dialog; } - - LineEditFileChooser(); -}; - -VARIANT_ENUM_CAST(FileDialog::Mode); +VARIANT_ENUM_CAST(FileDialog::FileMode); VARIANT_ENUM_CAST(FileDialog::Access); #endif |