/**************************************************************************/ /* editor_file_dialog.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #ifndef EDITOR_FILE_DIALOG_H #define EDITOR_FILE_DIALOG_H #include "core/io/dir_access.h" #include "editor/file_info.h" #include "scene/gui/dialogs.h" #include "scene/property_list_helper.h" class DependencyRemoveDialog; class GridContainer; class HSplitContainer; class ItemList; class MenuButton; class OptionButton; class PopupMenu; class TextureRect; class EditorFileDialog : public ConfirmationDialog { GDCLASS(EditorFileDialog, ConfirmationDialog); public: enum DisplayMode { DISPLAY_THUMBNAILS, DISPLAY_LIST }; enum Access { ACCESS_RESOURCES, ACCESS_USERDATA, ACCESS_FILESYSTEM }; enum FileMode { FILE_MODE_OPEN_FILE, FILE_MODE_OPEN_FILES, FILE_MODE_OPEN_DIR, FILE_MODE_OPEN_ANY, FILE_MODE_SAVE_FILE }; typedef Ref (*GetIconFunc)(const String &); typedef void (*RegisterFunc)(EditorFileDialog *); static GetIconFunc get_icon_func; static GetIconFunc get_thumbnail_func; static RegisterFunc register_func; static RegisterFunc unregister_func; private: enum ItemMenu { ITEM_MENU_COPY_PATH, ITEM_MENU_DELETE, ITEM_MENU_REFRESH, ITEM_MENU_NEW_FOLDER, ITEM_MENU_SHOW_IN_EXPLORER }; ConfirmationDialog *makedialog = nullptr; LineEdit *makedirname = nullptr; 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; LineEdit *dir = nullptr; Button *dir_prev = nullptr; Button *dir_next = nullptr; Button *dir_up = nullptr; HBoxContainer *drives_container = nullptr; HBoxContainer *shortcuts_container = nullptr; OptionButton *drives = nullptr; ItemList *item_list = nullptr; PopupMenu *item_menu = nullptr; TextureRect *preview = nullptr; VBoxContainer *preview_vb = nullptr; HSplitContainer *body_hsplit = nullptr; HSplitContainer *list_hb = nullptr; HBoxContainer *file_box = nullptr; LineEdit *file = nullptr; OptionButton *filter = nullptr; AcceptDialog *error_dialog = nullptr; Ref dir_access; 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; Button *refresh = nullptr; Button *favorite = nullptr; Button *show_hidden = nullptr; String search_string; LineEdit *filter_box = nullptr; FileSortOption file_sort = FileSortOption::FILE_SORT_NAME; MenuButton *file_sort_button = nullptr; Button *fav_up = nullptr; Button *fav_down = nullptr; ItemList *favorites = nullptr; ItemList *recent = nullptr; Vector local_history; int local_history_pos = 0; void _push_history(); Vector filters; bool previews_enabled = true; bool preview_waiting = false; int preview_wheel_index = 0; float preview_wheel_timeout = 0.0f; static bool default_show_hidden_files; static DisplayMode default_display_mode; bool show_hidden_files; DisplayMode display_mode; bool disable_overwrite_warning = false; bool is_invalidating = false; struct ThemeCache { Ref parent_folder; Ref forward_folder; Ref back_folder; Ref reload; Ref toggle_hidden; Ref favorite; Ref mode_thumbnails; Ref mode_list; Ref create_folder; Ref favorites_up; Ref favorites_down; Ref filter_box; Ref file_sort_button; Ref folder; Color folder_icon_color; Ref action_copy; Ref action_delete; Ref filesystem; Ref folder_medium_thumbnail; Ref file_medium_thumbnail; Ref folder_big_thumbnail; Ref file_big_thumbnail; Ref progress[8]{}; } theme_cache; struct Option { String name; Vector values; int default_idx = 0; }; static inline PropertyListHelper base_property_helper; PropertyListHelper property_helper; Vector