diff --git a/include/wx/filehistory.h b/include/wx/filehistory.h index ce2a031f36..e5bf059ea7 100644 --- a/include/wx/filehistory.h +++ b/include/wx/filehistory.h @@ -26,9 +26,9 @@ class WXDLLIMPEXP_FWD_BASE wxFileName; enum wxFileHistoryMenuPathStyle { - wxFH_HIDE_CURRENT_PATH = 0, - wxFH_HIDE_ALL_PATHS = 1, - wxFH_SHOW_FULL_PATH = 2 + wxFH_PATH_SHOW_IF_DIFFERENT, + wxFH_PATH_SHOW_NEVER, + wxFH_PATH_SHOW_ALWAYS }; // ---------------------------------------------------------------------------- diff --git a/interface/wx/filehistory.h b/interface/wx/filehistory.h index 445dc16c35..7cc92718b8 100644 --- a/interface/wx/filehistory.h +++ b/interface/wx/filehistory.h @@ -8,21 +8,36 @@ /** Styles for the paths shown in wxFileHistory menus. - The default style is wxFH_HIDE_CURRENT_PATH, i.e. the path of the file is - only shown in the menu if it's different from the path of the first file. + The values of this enum determine whether the labels in the menu managed by + wxFileHistory show the full path for the corresponding file or just the + base name. + + The default style is wxFH_PATH_SHOW_IF_DIFFERENT, i.e. the full path of the + file is only shown in the menu if it's different from the path of the first + file. @since 3.1.5 */ enum wxFileHistoryMenuPathStyle { - /** Hide the file path if it matches the path of the first item */ - wxFH_HIDE_CURRENT_PATH, + /** + Show the full path if it's different from the path of the first file. - /** Hide all paths and show only filenames */ - wxFH_HIDE_ALL_PATHS, + Otherwise show just the file name. - /** Show the full path for all files */ - wxFH_SHOW_FULL_PATH + This value corresponds to the default behaviour. + */ + wxFH_PATH_SHOW_IF_DIFFERENT, + + /** + Never show full path, always show just the base file name. + */ + wxFH_PATH_SHOW_NEVER, + + /** + Always show the full path for all files. + */ + wxFH_PATH_SHOW_ALWAYS }; /** @@ -152,7 +167,7 @@ public: /** Set the style of the menu item labels. - By default, the menu item label style is ::wxFH_HIDE_CURRENT_PATH. + By default, the menu item label style is ::wxFH_PATH_SHOW_IF_DIFFERENT. @remarks Use RefreshLabels() to update any existing menu items to the new style. @since 3.1.5 @@ -162,7 +177,7 @@ public: /** Get the current style of the menu item labels. - Initially returns ::wxFH_HIDE_CURRENT_PATH. + Initially returns ::wxFH_PATH_SHOW_IF_DIFFERENT. @see SetMenuPathStyle() diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 271bba1e3f..6113f8de77 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -1394,13 +1394,13 @@ void MyFrame::OnFileHistoryStyleItem(wxCommandEvent& event) switch( event.GetId() ) { case Menu_Menu_FileHistory1: - m_fileHistory->SetMenuPathStyle(wxFH_HIDE_CURRENT_PATH); + m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_IF_DIFFERENT); break; case Menu_Menu_FileHistory2: - m_fileHistory->SetMenuPathStyle(wxFH_HIDE_ALL_PATHS); + m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_NEVER); break; case Menu_Menu_FileHistory3: - m_fileHistory->SetMenuPathStyle(wxFH_SHOW_FULL_PATH); + m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_ALWAYS); break; } diff --git a/src/common/filehistorycmn.cpp b/src/common/filehistorycmn.cpp index 0fa0c8d303..d49fb2b39b 100644 --- a/src/common/filehistorycmn.cpp +++ b/src/common/filehistorycmn.cpp @@ -70,7 +70,7 @@ wxFileHistoryBase::wxFileHistoryBase(size_t maxFiles, wxWindowID idBase) { m_fileMaxFiles = maxFiles; m_idBase = idBase; - m_menuPathStyle = wxFH_HIDE_CURRENT_PATH; + m_menuPathStyle = wxFH_PATH_SHOW_IF_DIFFERENT; } /* static */ @@ -158,12 +158,12 @@ void wxFileHistoryBase::RefreshLabels() wxString pathInMenu; - if ( m_menuPathStyle == wxFH_HIDE_ALL_PATHS ) + if ( m_menuPathStyle == wxFH_PATH_SHOW_NEVER ) { // Only show the filename + extension and not the path pathInMenu = currFn.GetFullName(); } - else if ( ( m_menuPathStyle == wxFH_HIDE_CURRENT_PATH ) && + else if ( ( m_menuPathStyle == wxFH_PATH_SHOW_IF_DIFFERENT ) && ( currFn.GetPath() == firstFn.GetPath() ) && currFn.HasName() ) { // Hide the path if it is in the same folder as the first file @@ -171,7 +171,7 @@ void wxFileHistoryBase::RefreshLabels() } else { - // Either has wxFH_SHOW_FULL_PATH menu style, or the file is in a different directory + // Either has wxFH_PATH_SHOW_ALWAYS menu style, or the file is in a different directory // from the first file pathInMenu = m_fileHistory[i]; }