/**************************************************************************/ /* 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 FILE_DIALOG_H #define FILE_DIALOG_H #include "box_container.h" #include "core/io/dir_access.h" #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" #include "scene/gui/tree.h" class GridContainer; class FileDialog : public ConfirmationDialog { GDCLASS(FileDialog, ConfirmationDialog); public: 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)(FileDialog *); static GetIconFunc get_icon_func; static RegisterFunc register_func; static RegisterFunc unregister_func; private: ConfirmationDialog *makedialog = nullptr; LineEdit *makedirname = nullptr; Button *makedir = nullptr; Access access = ACCESS_RESOURCES; VBoxContainer *vbox = nullptr; GridContainer *grid_options = nullptr; FileMode mode; LineEdit *dir = nullptr; HBoxContainer *drives_container = nullptr; HBoxContainer *shortcuts_container = nullptr; OptionButton *drives = nullptr; Tree *tree = nullptr; HBoxContainer *file_box = nullptr; LineEdit *file = nullptr; OptionButton *filter = nullptr; AcceptDialog *mkdirerr = nullptr; AcceptDialog *exterr = nullptr; Ref dir_access; ConfirmationDialog *confirm_save = nullptr; Label *message = nullptr; Button *dir_prev = nullptr; Button *dir_next = nullptr; Button *dir_up = nullptr; Button *refresh = nullptr; Button *show_hidden = nullptr; Vector filters; Vector local_history; int local_history_pos = 0; void _push_history(); bool mode_overrides_title = true; String root_subfolder; String root_prefix; static bool default_show_hidden_files; bool show_hidden_files = false; bool use_native_dialog = false; bool is_invalidating = false; struct ThemeCache { Ref parent_folder; Ref forward_folder; Ref back_folder; Ref reload; Ref toggle_hidden; Ref folder; Ref file; Color folder_icon_color; Color file_icon_color; Color file_disabled_color; Color icon_normal_color; Color icon_hover_color; Color icon_focus_color; Color icon_pressed_color; } theme_cache; struct Option { String name; Vector values; int default_idx = 0; }; Vector