diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index 20cc433c52..d37ff25186 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -423,6 +423,24 @@ Icon for the button that enables list mode. + + Icon for the "Copy Path" context menu option. + + + Icon for the "Delete" context menu option. + + + Icon for the "New Folder..." context menu option. Usually it should be the same as [theme_item create_folder]; leave it empty if you want the context menu to show no icons. + + + Icon for the "Show Package Contents" context menu option. The option only appears for macOS bundles. + + + Icon for the "Refresh" context menu option. Usually it should be the same as [theme_item reload]; leave it empty if you want the context menu to show no icons. + + + Icon for the "Show in File Manager" context menu option. + Custom icon for the parent folder arrow. diff --git a/editor/themes/theme_classic.cpp b/editor/themes/theme_classic.cpp index 5d70852f9a..c0682931a7 100644 --- a/editor/themes/theme_classic.cpp +++ b/editor/themes/theme_classic.cpp @@ -1058,6 +1058,13 @@ void ThemeClassic::populate_standard_styles(const Ref &p_theme, Edi p_theme->set_icon("favorite_up", "FileDialog", p_theme->get_icon("MoveUp", EditorStringName(EditorIcons))); p_theme->set_icon("favorite_down", "FileDialog", p_theme->get_icon("MoveDown", EditorStringName(EditorIcons))); p_theme->set_icon("create_folder", "FileDialog", p_theme->get_icon("FolderCreate", EditorStringName(EditorIcons))); + + p_theme->set_icon("menu_copy_path", "FileDialog", p_theme->get_icon("ActionCopy", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_delete", "FileDialog", p_theme->get_icon("Remove", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_refresh", "FileDialog", p_theme->get_icon("Reload", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_new_folder", "FileDialog", p_theme->get_icon("Folder", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_show_in_file_manager", "FileDialog", p_theme->get_icon("Filesystem", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_open_bundle", "FileDialog", p_theme->get_icon("FolderBrowse", EditorStringName(EditorIcons))); // Use a different color for folder icons to make them easier to distinguish from files. // On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color. p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7)); diff --git a/editor/themes/theme_modern.cpp b/editor/themes/theme_modern.cpp index e3496c28bb..e774672e9b 100644 --- a/editor/themes/theme_modern.cpp +++ b/editor/themes/theme_modern.cpp @@ -1044,6 +1044,13 @@ void ThemeModern::populate_standard_styles(const Ref &p_theme, Edit p_theme->set_icon("favorite_up", "FileDialog", p_theme->get_icon("MoveUp", EditorStringName(EditorIcons))); p_theme->set_icon("favorite_down", "FileDialog", p_theme->get_icon("MoveDown", EditorStringName(EditorIcons))); p_theme->set_icon("create_folder", "FileDialog", p_theme->get_icon("FolderCreate", EditorStringName(EditorIcons))); + + p_theme->set_icon("menu_copy_path", "FileDialog", p_theme->get_icon("ActionCopy", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_delete", "FileDialog", p_theme->get_icon("Remove", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_refresh", "FileDialog", p_theme->get_icon("Reload", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_new_folder", "FileDialog", p_theme->get_icon("Folder", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_show_in_file_manager", "FileDialog", p_theme->get_icon("Filesystem", EditorStringName(EditorIcons))); + p_theme->set_icon("menu_open_bundle", "FileDialog", p_theme->get_icon("FolderBrowse", EditorStringName(EditorIcons))); // Use a different color for folder icons to make them easier to distinguish from files. // On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color. p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7)); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index e168eee00c..2c42e05e64 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -774,15 +774,19 @@ void FileDialog::_popup_menu(const Vector2 &p_pos, int p_for_item) { if (p_for_item > -1) { item_menu->add_item(ETR("Copy Path"), ITEM_MENU_COPY_PATH); + item_menu->set_item_icon(-1, theme_cache.menu_copy_path); if (customization_flags[CUSTOMIZATION_DELETE]) { item_menu->add_item(ETR("Delete"), ITEM_MENU_DELETE); + item_menu->set_item_icon(-1, theme_cache.menu_delete); item_menu->set_item_shortcut(-1, action_shortcuts[ITEM_MENU_DELETE]); } } else { if (can_create_folders) { item_menu->add_item(ETR("New Folder..."), ITEM_MENU_NEW_FOLDER); + item_menu->set_item_icon(-1, theme_cache.menu_new_folder); } item_menu->add_item(ETR("Refresh"), ITEM_MENU_REFRESH); + item_menu->set_item_icon(-1, theme_cache.menu_refresh); item_menu->set_item_shortcut(-1, action_shortcuts[ITEM_MENU_REFRESH]); } @@ -796,8 +800,10 @@ void FileDialog::_popup_menu(const Vector2 &p_pos, int p_for_item) { } item_menu->add_item((p_for_item == -1 || meta["dir"]) ? ETR("Open in File Manager") : ETR("Show in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); + item_menu->set_item_icon(-1, theme_cache.menu_show_in_file_manager); if (meta["bundle"]) { item_menu->add_item(ETR("Show Package Contents"), ITEM_MENU_SHOW_BUNDLE_CONTENT); + item_menu->set_item_icon(-1, theme_cache.menu_open_bundle); } #endif @@ -2184,6 +2190,13 @@ void FileDialog::_bind_methods() { BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, file_thumbnail); BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, folder_thumbnail); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_copy_path); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_delete); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_refresh); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_new_folder); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_show_in_file_manager); + BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_open_bundle); + BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, folder_icon_color); BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, file_icon_color); BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, file_disabled_color); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 1d37fb411a..9df59a6f94 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -280,6 +280,13 @@ private: Ref file_thumbnail; Ref folder_thumbnail; + Ref menu_copy_path; + Ref menu_delete; + Ref menu_refresh; + Ref menu_new_folder; + Ref menu_show_in_file_manager; + Ref menu_open_bundle; + Color folder_icon_color; Color file_icon_color; Color file_disabled_color;