added Close All command support to wxDocView (patch 496068)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13248 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,6 +114,12 @@ Adds a file to the file history list, if we have a pointer to an appropriate fil
|
|||||||
|
|
||||||
Adds the template to the document manager's template list.
|
Adds the template to the document manager's template list.
|
||||||
|
|
||||||
|
\membersection{wxDocManager::CloseDocuments}
|
||||||
|
|
||||||
|
\func{bool}{CloseDocuments}{\param{bool }{force = TRUE}}
|
||||||
|
|
||||||
|
Closes all currentled opened documents.
|
||||||
|
|
||||||
\membersection{wxDocManager::CreateDocument}
|
\membersection{wxDocManager::CreateDocument}
|
||||||
|
|
||||||
\func{wxDocument*}{CreateDocument}{\param{const wxString\& }{path}, \param{long}{ flags}}
|
\func{wxDocument*}{CreateDocument}{\param{const wxString\& }{path}, \param{long}{ flags}}
|
||||||
@@ -284,6 +290,12 @@ from \helpref{Initialize}{wxdocmanagerinitialize}.
|
|||||||
|
|
||||||
Closes and deletes the currently active document.
|
Closes and deletes the currently active document.
|
||||||
|
|
||||||
|
\membersection{wxDocManager::OnFileCloseAll}
|
||||||
|
|
||||||
|
\func{void}{OnFileCloseAll}{\void}
|
||||||
|
|
||||||
|
Closes and deletes all the currently opened documents.
|
||||||
|
|
||||||
\membersection{wxDocManager::OnFileNew}
|
\membersection{wxDocManager::OnFileNew}
|
||||||
|
|
||||||
\func{void}{OnFileNew}{\void}
|
\func{void}{OnFileNew}{\void}
|
||||||
@@ -318,6 +330,7 @@ with the following predefined menu item identifiers:
|
|||||||
\begin{itemize}\itemsep=0pt
|
\begin{itemize}\itemsep=0pt
|
||||||
\item wxID\_OPEN Creates a new document and opens a file into it.
|
\item wxID\_OPEN Creates a new document and opens a file into it.
|
||||||
\item wxID\_CLOSE Closes the current document.
|
\item wxID\_CLOSE Closes the current document.
|
||||||
|
\item wxID\_CLOSE\_ALL Closes all documents.
|
||||||
\item wxID\_NEW Creates a new document.
|
\item wxID\_NEW Creates a new document.
|
||||||
\item wxID\_SAVE Saves the document.
|
\item wxID\_SAVE Saves the document.
|
||||||
\item wxID\_SAVE\_AS Saves the document into a specified filename.
|
\item wxID\_SAVE\_AS Saves the document into a specified filename.
|
||||||
|
@@ -1186,6 +1186,7 @@ enum wxBorder
|
|||||||
#define wxID_HELP_COMMANDS 5015
|
#define wxID_HELP_COMMANDS 5015
|
||||||
#define wxID_HELP_PROCEDURES 5016
|
#define wxID_HELP_PROCEDURES 5016
|
||||||
#define wxID_HELP_CONTEXT 5017
|
#define wxID_HELP_CONTEXT 5017
|
||||||
|
#define wxID_CLOSE_ALL 5018
|
||||||
|
|
||||||
#define wxID_CUT 5030
|
#define wxID_CUT 5030
|
||||||
#define wxID_COPY 5031
|
#define wxID_COPY 5031
|
||||||
|
@@ -300,6 +300,7 @@ public:
|
|||||||
|
|
||||||
// Handlers for common user commands
|
// Handlers for common user commands
|
||||||
void OnFileClose(wxCommandEvent& event);
|
void OnFileClose(wxCommandEvent& event);
|
||||||
|
void OnFileCloseAll(wxCommandEvent& event);
|
||||||
void OnFileNew(wxCommandEvent& event);
|
void OnFileNew(wxCommandEvent& event);
|
||||||
void OnFileOpen(wxCommandEvent& event);
|
void OnFileOpen(wxCommandEvent& event);
|
||||||
void OnFileRevert(wxCommandEvent& event);
|
void OnFileRevert(wxCommandEvent& event);
|
||||||
@@ -360,6 +361,9 @@ public:
|
|||||||
void AddDocument(wxDocument *doc);
|
void AddDocument(wxDocument *doc);
|
||||||
void RemoveDocument(wxDocument *doc);
|
void RemoveDocument(wxDocument *doc);
|
||||||
|
|
||||||
|
// closes all currently open documents
|
||||||
|
bool CloseDocuments(bool force = TRUE);
|
||||||
|
|
||||||
// Clear remaining documents and templates
|
// Clear remaining documents and templates
|
||||||
bool Clear(bool force = TRUE);
|
bool Clear(bool force = TRUE);
|
||||||
|
|
||||||
|
@@ -698,6 +698,7 @@ bool wxDocTemplate::FileMatchesTemplate(const wxString& path)
|
|||||||
BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler)
|
BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler)
|
||||||
EVT_MENU(wxID_OPEN, wxDocManager::OnFileOpen)
|
EVT_MENU(wxID_OPEN, wxDocManager::OnFileOpen)
|
||||||
EVT_MENU(wxID_CLOSE, wxDocManager::OnFileClose)
|
EVT_MENU(wxID_CLOSE, wxDocManager::OnFileClose)
|
||||||
|
EVT_MENU(wxID_CLOSE_ALL, wxDocManager::OnFileCloseAll)
|
||||||
EVT_MENU(wxID_REVERT, wxDocManager::OnFileRevert)
|
EVT_MENU(wxID_REVERT, wxDocManager::OnFileRevert)
|
||||||
EVT_MENU(wxID_NEW, wxDocManager::OnFileNew)
|
EVT_MENU(wxID_NEW, wxDocManager::OnFileNew)
|
||||||
EVT_MENU(wxID_SAVE, wxDocManager::OnFileSave)
|
EVT_MENU(wxID_SAVE, wxDocManager::OnFileSave)
|
||||||
@@ -707,6 +708,7 @@ BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler)
|
|||||||
|
|
||||||
EVT_UPDATE_UI(wxID_OPEN, wxDocManager::OnUpdateFileOpen)
|
EVT_UPDATE_UI(wxID_OPEN, wxDocManager::OnUpdateFileOpen)
|
||||||
EVT_UPDATE_UI(wxID_CLOSE, wxDocManager::OnUpdateFileClose)
|
EVT_UPDATE_UI(wxID_CLOSE, wxDocManager::OnUpdateFileClose)
|
||||||
|
EVT_UPDATE_UI(wxID_CLOSE_ALL, wxDocManager::OnUpdateFileClose)
|
||||||
EVT_UPDATE_UI(wxID_REVERT, wxDocManager::OnUpdateFileRevert)
|
EVT_UPDATE_UI(wxID_REVERT, wxDocManager::OnUpdateFileRevert)
|
||||||
EVT_UPDATE_UI(wxID_NEW, wxDocManager::OnUpdateFileNew)
|
EVT_UPDATE_UI(wxID_NEW, wxDocManager::OnUpdateFileNew)
|
||||||
EVT_UPDATE_UI(wxID_SAVE, wxDocManager::OnUpdateFileSave)
|
EVT_UPDATE_UI(wxID_SAVE, wxDocManager::OnUpdateFileSave)
|
||||||
@@ -747,7 +749,7 @@ wxDocManager::~wxDocManager()
|
|||||||
sm_docManager = (wxDocManager*) NULL;
|
sm_docManager = (wxDocManager*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDocManager::Clear(bool force)
|
bool wxDocManager::CloseDocuments(bool force)
|
||||||
{
|
{
|
||||||
wxNode *node = m_docs.First();
|
wxNode *node = m_docs.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -771,7 +773,15 @@ bool wxDocManager::Clear(bool force)
|
|||||||
// delete another.
|
// delete another.
|
||||||
node = next;
|
node = next;
|
||||||
}
|
}
|
||||||
node = m_templates.First();
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDocManager::Clear(bool force)
|
||||||
|
{
|
||||||
|
if (!CloseDocuments(force))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
wxNode *node = m_templates.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxDocTemplate *templ = (wxDocTemplate*) node->Data();
|
wxDocTemplate *templ = (wxDocTemplate*) node->Data();
|
||||||
@@ -806,6 +816,11 @@ void wxDocManager::OnFileClose(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDocManager::OnFileCloseAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
CloseDocuments(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
void wxDocManager::OnFileNew(wxCommandEvent& WXUNUSED(event))
|
void wxDocManager::OnFileNew(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
CreateDocument(wxString(""), wxDOC_NEW);
|
CreateDocument(wxString(""), wxDOC_NEW);
|
||||||
|
Reference in New Issue
Block a user