📄 docmanag.tex
字号:
\membersection{wxDocManager::FindTemplateForPath}\label{wxdocmanagerfindtemplateforpath}\func{wxDocTemplate *}{FindTemplateForPath}{\param{const wxString\& }{path}}Given a path, try to find template that matches the extension. This is onlyan approximate method of finding a template for creating a document.\membersection{wxDocManager::GetCurrentDocument}\label{wxdocmanagergetcurrentdocument}\func{wxDocument *}{GetCurrentDocument}{\void}Returns the document associated with the currently active view (if any).\membersection{wxDocManager::GetCurrentView}\label{wxdocmanagergetcurrentview}\func{wxView *}{GetCurrentView}{\void}Returns the currently active view \membersection{wxDocManager::GetDocuments}\label{wxdocmanagergetdocuments}\func{wxList\&}{GetDocuments}{\void}Returns a reference to the list of documents.\membersection{wxDocManager::GetFileHistory}\label{wxdocmanagergetfilehistory}\func{wxFileHistory *}{GetFileHistory}{\void}Returns a pointer to file history.\membersection{wxDocManager::GetLastDirectory}\label{wxdocmanagergetlastdirectory}\constfunc{wxString}{GetLastDirectory}{\void}Returns the directory last selected by the user when opening a file. Initially empty.\membersection{wxDocManager::GetMaxDocsOpen}\label{wxdocmanagergetmaxdocsopen}\func{int}{GetMaxDocsOpen}{\void}Returns the number of documents that can be open simultaneously.\membersection{wxDocManager::GetHistoryFilesCount}\label{wxdocmanagergethistoryfilescount}\func{size\_t}{GetHistoryFilesCount}{\void}Returns the number of files currently stored in the file history.\membersection{wxDocManager::GetTemplates}\label{wxdocmanagergettemplates}\func{wxList\&}{GetTemplates}{\void}Returns a reference to the list of associated templates.\membersection{wxDocManager::Initialize}\label{wxdocmanagerinitialize}\func{bool}{Initialize}{\void}Initializes data; currently just calls OnCreateFileHistory. Some data cannotalways be initialized in the constructor because the programmer must be giventhe opportunity to override functionality. If OnCreateFileHistory was calledfrom the constructor, an overridden virtual OnCreateFileHistory would not becalled due to C++'s `interesting' constructor semantics. In fact Initialize\rtfsp{\it is} called from the wxDocManager constructor, but this can bevetoed by passing false to the second argument, allowing the derived class'sconstructor to call Initialize, possibly calling a different OnCreateFileHistoryfrom the default.The bottom line: if you're not deriving from Initialize, forget it andconstruct wxDocManager with no arguments.\membersection{wxDocManager::MakeDefaultName}\label{wxdocmanagermakedefaultname}\func{bool}{MakeDefaultName}{\param{const wxString\& }{buf}}Copies a suitable default name into {\it buf}. This is implemented byappending an integer counter to the string {\bf unnamed} and incrementingthe counter.\perlnote{In wxPerl this function must return the modified name ratherthan just modifying the argument.}\membersection{wxDocManager::OnCreateFileHistory}\label{wxdocmanageroncreatefilehistory}\func{wxFileHistory *}{OnCreateFileHistory}{\void}A hook to allow a derived class to create a different type of file history. Calledfrom \helpref{Initialize}{wxdocmanagerinitialize}.\membersection{wxDocManager::OnFileClose}\label{wxdocmanageronfileclose}\func{void}{OnFileClose}{\param{wxCommandEvent\& }{event}}Closes and deletes the currently active document.\membersection{wxDocManager::OnFileCloseAll}\label{wxdocmanageronfilecloseall}\func{void}{OnFileCloseAll}{\param{wxCommandEvent\& }{event}}Closes and deletes all the currently opened documents.\membersection{wxDocManager::OnFileNew}\label{wxdocmanageronfilenew}\func{void}{OnFileNew}{\param{wxCommandEvent\& }{event}}Creates a document from a list of templates (if more than one template).\membersection{wxDocManager::OnFileOpen}\label{wxdocmanageronfileopen}\func{void}{OnFileOpen}{\param{wxCommandEvent\& }{event}}Creates a new document and reads in the selected file.\membersection{wxDocManager::OnFileRevert}\label{wxdocmanageronfilerevert}\func{void}{OnFileRevert}{\param{wxCommandEvent\& }{event}}Reverts the current document by calling wxDocument::Revert for the current document.\membersection{wxDocManager::OnFileSave}\label{wxdocmanageronfilesave}\func{void}{OnFileSave}{\param{wxCommandEvent\& }{event}}Saves the current document by calling wxDocument::Save for the current document.\membersection{wxDocManager::OnFileSaveAs}\label{wxdocmanageronfilesaveas}\func{void}{OnFileSaveAs}{\param{wxCommandEvent\& }{event}}Calls wxDocument::SaveAs for the current document.\membersection{wxDocManager::RemoveDocument}\label{wxdocmanagerremovedocument}\func{void}{RemoveDocument}{\param{wxDocument *}{doc}}Removes the document from the list of documents.\membersection{wxDocManager::SelectDocumentPath}\label{wxdocmanagerselectdocumentpath}\func{wxDocTemplate *}{SelectDocumentPath}{\param{wxDocTemplate **}{templates}, \param{int}{ noTemplates}, \param{wxString\& }{path}, \param{long}{ flags}, \param{bool}{ save}}Under Windows, pops up a file selector with a list of filters corresponding to document templates.The wxDocTemplate corresponding to the selected file's extension is returned.On other platforms, if there is more than one document template a choice list is popped up,followed by a file selector.This function is used in wxDocManager::CreateDocument.\perlnote{In wxPerl {\tt templates} is a reference to a list of templates.If you override this method in your document manager it must returntwo values, eg:\par (doctemplate, path) = My::DocManager->SelectDocumentPath( ... );}\membersection{wxDocManager::SelectDocumentType}\label{wxdocmanagerselectdocumenttype}\func{wxDocTemplate *}{SelectDocumentType}{\param{wxDocTemplate **}{templates}, \param{int}{ noTemplates}, \param{bool}{ sort=false}}Returns a document template by asking the user (if there is more than one template).This function is used in wxDocManager::CreateDocument.\wxheading{Parameters}\docparam{templates}{Pointer to an array of templates from which to choose a desired template.}\docparam{noTemplates}{Number of templates being pointed to by the {\it templates} pointer.}\docparam{sort}{If more than one template is passed in in {\it templates}, then this parameter indicates whether the list of templates that the user will have to choose from is sorted or not when shown the choice box dialog. Default is false.}\perlnote{In wxPerl {\tt templates} is a reference to a list of templates.}\membersection{wxDocManager::SelectViewType}\label{wxdocmanagerselectviewtype}\func{wxDocTemplate *}{SelectViewType}{\param{wxDocTemplate **}{templates}, \param{int}{ noTemplates}, \param{bool}{ sort=false}}Returns a document template by asking the user (if there is more than one template),displaying a list of valid views. This function is used in wxDocManager::CreateView.The dialog normally will not appear because the array of templates only containsthose relevant to the document in question, and often there will only be one such.\wxheading{Parameters}\docparam{templates}{Pointer to an array of templates from which to choose a desired template.}\docparam{noTemplates}{Number of templates being pointed to by the {\it templates} pointer.}\docparam{sort}{If more than one template is passed in in {\it templates}, then this parameter indicates whether the list of templates that the user will have to choose from is sorted or not when shown the choice box dialog. Default is false.}\perlnote{In wxPerl {\tt templates} is a reference to a list of templates.}\membersection{wxDocManager::SetLastDirectory}\label{wxdocmanagersetlastdirectory}\func{void}{SetLastDirectory}{\param{const wxString\&}{ dir}}Sets the directory to be displayed to the user when opening a file. Initially this is empty.\membersection{wxDocManager::SetMaxDocsOpen}\label{wxdocmanagersetmaxdocsopen}\func{void}{SetMaxDocsOpen}{\param{int}{ n}}Sets the maximum number of documents that can be open at a time. By default, thisis 10,000. If you set it to 1, existing documents will be saved and deletedwhen the user tries to open or create a new one (similar to the behaviourof Windows Write, for example). Allowing multiple documents gives behaviourmore akin to MS Word and other Multiple Document Interface applications.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -