Applied: wxDocument: Adding an asterix to the title
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e558f9533e
commit
250ab35a3b
@ -133,7 +133,7 @@ public:
|
||||
|
||||
virtual bool Draw(wxDC&);
|
||||
virtual bool IsModified() const { return m_documentModified; }
|
||||
virtual void Modify(bool mod) { m_documentModified = mod; }
|
||||
virtual void Modify(bool mod);
|
||||
|
||||
virtual bool AddView(wxView *view);
|
||||
virtual bool RemoveView(wxView *view);
|
||||
|
@ -233,6 +233,18 @@ wxView *wxDocument::GetFirstView() const
|
||||
return static_cast<wxView *>(m_documentViews.GetFirst()->GetData());
|
||||
}
|
||||
|
||||
void wxDocument::Modify(bool mod)
|
||||
{
|
||||
if (mod != m_documentModified)
|
||||
{
|
||||
m_documentModified = mod;
|
||||
|
||||
// Allow views to append asterix to the title
|
||||
wxView* view = GetFirstView();
|
||||
if (view) view->OnChangeFilename();
|
||||
}
|
||||
}
|
||||
|
||||
wxDocManager *wxDocument::GetDocumentManager() const
|
||||
{
|
||||
return m_documentTemplate ? m_documentTemplate->GetDocumentManager() : NULL;
|
||||
@ -713,7 +725,12 @@ void wxView::OnChangeFilename()
|
||||
wxDocument *doc = GetDocument();
|
||||
if (!doc) return;
|
||||
|
||||
win->SetLabel(doc->GetUserReadableName());
|
||||
wxString label = doc->GetUserReadableName();
|
||||
if (doc->IsModified())
|
||||
{
|
||||
label += "*";
|
||||
}
|
||||
win->SetLabel(label);
|
||||
}
|
||||
|
||||
void wxView::SetDocument(wxDocument *doc)
|
||||
|
Loading…
Reference in New Issue
Block a user