Add different menu label styles to wxFileHistory menus

These styles allow the program to choose to display file paths
in the menu or not
This commit is contained in:
Ian McInerney
2021-03-18 02:11:33 +00:00
parent 05685b5faa
commit 71c26ec4da
4 changed files with 131 additions and 10 deletions

View File

@@ -5,6 +5,23 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
Styles for the labels on menu items for wxFileHistory menus
@since 3.1.5
*/
enum wxFileHistoryMenuLabelStyle
{
/** Hide the file path if it matches the path of the first item */
wxFH_HIDE_CURRENT_PATH,
/** Hide all paths and show only filenames */
wxFH_HIDE_ALL_PATHS,
/** Show the full path for all files */
wxFH_SHOW_FULL_PATH
};
/**
@class wxFileHistory
@@ -15,6 +32,8 @@
required in an MDI application, where the file history should appear on
each MDI child menu as well as the MDI parent frame.
By default, the menu item label style will be @c wxFH_HIDE_CURRENT_PATH.
@library{wxcore}
@category{docview}
@@ -90,6 +109,14 @@ public:
*/
virtual void Load(const wxConfigBase& config);
/**
Refresh the labels on all the menu items in the menus used by this
file history.
@since 3.1.5
*/
void RefreshLabels();
/**
Removes the specified file from the history.
*/
@@ -120,4 +147,20 @@ public:
called, as this is not done automatically.
*/
virtual void UseMenu(wxMenu* menu);
/**
Set the style of the menu item labels.
@remarks Use RefreshLabels() to update any existing menu items to the new style.
@since 3.1.5
*/
void SetMenuLabelStyle(wxFileHistoryMenuLabelStyle style);
/**
Get the current style of the menu item labels.
@since 3.1.5
*/
wxFileHistoryMenuLabelStyle GetMenuLabelStyle() const;
};