clarifications about MRU menu workings (patch 1221797)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-07-28 23:09:26 +00:00
parent 73bb565476
commit 86110e1a19
2 changed files with 31 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ as well as the MDI parent frame.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxFileHistory::m\_fileHistory}\label{wxfilehistorymfilehistory}
\member{char**}{m\_fileHistory}
@@ -28,24 +29,28 @@ as well as the MDI parent frame.
A character array of strings corresponding to the most recently opened
files.
\membersection{wxFileHistory::m\_fileHistoryN}\label{wxfilehistorymfilehistoryn}
\member{size\_t}{m\_fileHistoryN}
The number of files stored in the history array.
\membersection{wxFileHistory::m\_fileMaxFiles}\label{wxfilehistorymfilemaxfiles}
\member{size\_t}{m\_fileMaxFiles}
The maximum number of files to be stored and displayed on the menu.
\membersection{wxFileHistory::m\_fileMenu}\label{wxfilehistorymfilemenu}
\member{wxMenu*}{m\_fileMenu}
The file menu used to display the file history list (if enabled).
\membersection{wxFileHistory::wxFileHistory}\label{wxfilehistoryctor}
\func{}{wxFileHistory}{\param{size\_t}{ maxFiles = 9}, \param{wxWindowID}{ idBase = wxID\_FILE1}}
@@ -58,21 +63,24 @@ history menu item. Since menu items can't share the same ID you should change
idBase (To one of your own defined IDs) when using more than one wxFileHistory
in your application.
\membersection{wxFileHistory::\destruct{wxFileHistory}}\label{wxfilehistorydtor}
\func{}{\destruct{wxFileHistory}}{\void}
Destructor.
\membersection{wxFileHistory::AddFileToHistory}\label{wxfilehistoryaddfiletohistory}
\func{void}{AddFileToHistory}{\param{const wxString\& }{filename}}
Adds a file to the file history list, if the object has a pointer to an appropriate file menu.
\membersection{wxFileHistory::AddFilesToMenu}\label{wxfilehistoryaddfilestomenu}
\func{void}{AddFilesToMenu}{\void}
\func{void}{AddFilesToMenu}{\void}\label{wxfilehistoryaddfilestomenu}
Appends the files in the history list, to all menus managed by the file history object.
@@ -80,24 +88,28 @@ Appends the files in the history list, to all menus managed by the file history
Appends the files in the history list, to the given menu only.
\membersection{wxFileHistory::GetHistoryFile}\label{wxfilehistorygethistoryfile}
\constfunc{wxString}{GetHistoryFile}{\param{size\_t}{ index}}
Returns the file at this index (zero-based).
\membersection{wxFileHistory::GetMaxFiles}\label{wxfilehistorygetmaxfiles}
\constfunc{size\_t}{GetMaxFiles}{\void}
Returns the maximum number of files that can be stored.
\membersection{wxFileHistory::GetCount}\label{wxfilehistorygetcount}
\constfunc{size\_t}{GetCount}{\void}
Returns the number of files currently stored in the file history.
\membersection{wxFileHistory::Load}\label{wxfilehistoryload}
\func{void}{Load}{\param{wxConfigBase\& }{config}}
@@ -108,12 +120,14 @@ Loads the file history from the given config object. This function should be cal
\helpref{wxConfig}{wxconfigbase}
\membersection{wxFileHistory::RemoveMenu}\label{wxfilehistoryremovemenu}
\func{void}{RemoveMenu}{\param{wxMenu* }{menu}}
Removes this menu from the list of those managed by this object.
\membersection{wxFileHistory::Save}\label{wxfilehistorysave}
\func{void}{Save}{\param{wxConfigBase\& }{config}}
@@ -125,10 +139,13 @@ explicitly by the application.
\helpref{wxConfig}{wxconfigbase}
\membersection{wxFileHistory::UseMenu}\label{wxfilehistoryusemenu}
\func{void}{UseMenu}{\param{wxMenu* }{menu}}
Adds this menu to the list of those managed by this object.
Adds this menu to the list of those menus that are managed by this file history object.
Also see \helpref{AddFilesToMenu()}{wxfilehistoryaddfilestomenu} for
initializing the menu with filenames that are already in the history when this
function is called, as this is not done automatically.

View File

@@ -255,9 +255,17 @@ Although wxFileHistory is used by wxDocManager, it can be used independently. Yo
to derive from it to allow different behaviour, such as popping up a scrolling
list of files.
By calling wxFileHistory::FileHistoryUseMenu you can associate a file menu with
the file history, that will be used for appending the filenames. They are
appended using menu identifiers in the range wxID\_FILE1 to wxID\_FILE9.
By calling \helpref{wxFileHistory::UseMenu()}{wxfilehistoryusemenu} you can
associate a file menu with the file history. The menu will then be used for
appending filenames that are added to the history. Please notice that currently
if the history already contained filenames when UseMenu() is called (e.g. when
initializing a second MDI child frame), the menu is not automatically
initialized with the existing filenames in the history and so you need to call
\helpref{AddFilesToMenu()}{wxfilehistoryaddfilestomenu} after UseMenu()
explicitly in order to initialize the menu with the existing list of MRU files.
(otherwise an assertion failure is raised in debug builds).
The filenames are appended using menu identifiers in the range
\texttt{wxID\_FILE1} to \texttt{wxID\_FILE9}.
In order to respond to a file load command from one of these identifiers,
you need to handle them using an event handler, for example: