/**************************************************************************/ /* 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. */ /**************************************************************************/ #pragma once #include "scene/gui/dialogs.h" #include "scene/property_list_helper.h" class DirAccess; class GridContainer; class HBoxContainer; class LineEdit; class OptionButton; class PopupMenu; class VBoxContainer; class Tree; class FileDialog : public ConfirmationDialog { GDCLASS(FileDialog, ConfirmationDialog); struct Option { String name; Vector values; int default_idx = 0; }; 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, }; enum ItemMenu { ITEM_MENU_COPY_PATH, ITEM_MENU_SHOW_IN_EXPLORER, ITEM_MENU_SHOW_BUNDLE_CONTENT, }; typedef Ref (*GetIconFunc)(const String &); typedef void (*RegisterFunc)(FileDialog *); inline static GetIconFunc get_icon_func = nullptr; inline static RegisterFunc register_func = nullptr; inline static RegisterFunc unregister_func = nullptr; private: static inline PropertyListHelper base_property_helper; PropertyListHelper property_helper; inline static bool default_show_hidden_files = false; bool show_hidden_files = false; bool use_native_dialog = false; Access access = ACCESS_RESOURCES; FileMode mode = FILE_MODE_SAVE_FILE; Ref dir_access; Vector filters; Vector processed_filters; Vector