]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Silence warning about truncation since the comment says it ok
[wxWidgets.git] / src / common / docview.cpp
index 5e2cada2da4a347147263d88acd5000096e7bec5..86736878ffcae4135a10641d57ccc63c8149ae1c 100644 (file)
@@ -656,14 +656,18 @@ void wxView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
 
 void wxView::OnChangeFilename()
 {
-    if (GetFrame() && GetDocument())
-    {
-        wxString title;
+    // GetFrame can return wxWindow rather than wxTopLevelWindow due to
+    // generic MDI implementation so use SetLabel rather than SetTitle.
+    // It should cause SetTitle() for top level windows.
+    wxWindow *win = GetFrame();
+    if (!win) return;
 
-        GetDocument()->GetPrintableName(title);
+    wxDocument *doc = GetDocument();
+    if (!doc) return;
 
-        GetFrame()->SetTitle(title);
-    }
+    wxString name;
+    doc->GetPrintableName(name);
+    win->SetLabel(name);
 }
 
 void wxView::SetDocument(wxDocument *doc)
@@ -2441,4 +2445,3 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
 #endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM
 
 #endif // wxUSE_DOC_VIEW_ARCHITECTURE
-