]> git.saurik.com Git - wxWidgets.git/commitdiff
Get/SetTitle only for wxTopLevelWindow (wxMSW part).
authorWłodzimierz Skiba <abx@abx.art.pl>
Thu, 3 Nov 2005 16:47:29 +0000 (16:47 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Thu, 3 Nov 2005 16:47:29 +0000 (16:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/bmpbuttn.h
include/wx/msw/toplevel.h
include/wx/msw/window.h
include/wx/toplevel.h
include/wx/window.h
src/common/docview.cpp
src/msw/radiobox.cpp
src/msw/toplevel.cpp
src/msw/window.cpp

index 6f912b376b29c0dab067739dd3464045061adb90..775d90bb5d4383c097c05aa1e0c557e9ccc3493d 100644 (file)
@@ -70,7 +70,7 @@ public:
 
     // prevent virtual function hiding
     virtual void SetLabel(const wxString& label)
-        { wxWindowBase::SetLabel(label); }
+        { wxWindow::SetLabel(label); }
 #endif // WXWIN_COMPATIBILITY_2_6
 
 protected:
index c0abd56498780d47bc3c56500e5ff2cc640699cf..8e28a4bbabb2f0c933ae1846a8031c309b0dfe56 100644 (file)
@@ -46,6 +46,8 @@ public:
     virtual ~wxTopLevelWindowMSW();
 
     // implement base class pure virtuals
+    virtual void SetTitle( const wxString& title);
+    virtual wxString GetTitle() const;
     virtual void Maximize(bool maximize = true);
     virtual bool IsMaximized() const;
     virtual void Iconize(bool iconize = true);
@@ -166,4 +168,3 @@ protected:
 };
 
 #endif // _WX_MSW_TOPLEVEL_H_
-
index 2a91ebb3c0dcbdd656bdd81ffd3a7554903fb1f0..01fed31008329b97f845b4539b6ea1051ca836a4 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        wx/msw/window.h
-// Purpose:     wxWindow class
+// Purpose:     wxWindowMSW class
 // Author:      Julian Smart
 // Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling,
 //              elimination of Default(), ...
@@ -62,8 +62,8 @@ public:
                 const wxString& name = wxPanelNameStr);
 
     // implement base class pure virtuals
-    virtual void SetTitle( const wxString& title);
-    virtual wxString GetTitle() const;
+    virtual void SetLabel(const wxString& label);
+    virtual wxString GetLabel() const;
 
     virtual void Raise();
     virtual void Lower();
@@ -557,5 +557,4 @@ WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable);
 
 extern wxWinHashTable *wxWinHandleHash;
 
-#endif
-    // _WX_WINDOW_H_
+#endif // _WX_WINDOW_H_
index 86805fe5ed5ccf4c7bdf1d1640843a0935769815..140f8e7018ce41d1a7f81c685af670beb738ae98 100644 (file)
@@ -154,13 +154,16 @@ public:
     // return true if the frame is in fullscreen mode
     virtual bool IsFullScreen() const = 0;
 
-    /*
-       for now we already have them in wxWindow, but this is wrong: these
-       methods really only make sense for wxTopLevelWindow!
+#ifdef __WXMSW__
+    // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow
+    // to wxTopLevelWindow so initially enabled in wxMSW only to observe results
+    // and continue on other platforms
 
+    // the title (or label, see below) of the window: the text which the
+    // window shows
     virtual void SetTitle(const wxString& title) = 0;
     virtual wxString GetTitle() const = 0;
-     */
+#endif
 
     // Set the shape of the window to the given region.
     // Returns true if the platform supports this feature (and the
index 7f516e51e4c34efa52c69936ff2caaf920d0bd2d..29a3b50a86a586aaaee47c4cbf840218a16f90c8 100644 (file)
@@ -168,19 +168,24 @@ public:
     // window attributes
     // -----------------
 
-        // NB: in future versions of wxWidgets Set/GetTitle() will only work
-        //     with the top level windows (such as dialogs and frames) and
-        //     Set/GetLabel() only with the other ones (i.e. all controls).
+#ifndef __WXMSW__
+    // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow
+    // to wxTopLevelWindow so initially enabled in wxMSW only to observe results
+    // and continue on other platforms
 
-        // the title (or label, see below) of the window: the text which the
-        // window shows
     virtual void SetTitle( const wxString& WXUNUSED(title) ) {}
     virtual wxString GetTitle() const { return wxEmptyString; }
 
-        // label is just the same as the title (but for, e.g., buttons it
-        // makes more sense to speak about labels)
+    // label is just the same as the title (but for, e.g., buttons it
+    // makes more sense to speak about labels)
     virtual void SetLabel(const wxString& label) { SetTitle(label); }
     virtual wxString GetLabel() const { return GetTitle(); }
+#else
+    // label is just the same as the title (but for, e.g., buttons it
+    // makes more sense to speak about labels)
+    virtual void SetLabel(const wxString& label) = 0;
+    virtual wxString GetLabel() const = 0;
+#endif
 
         // the window name is used for ressource setting in X, it is not the
         // same as the window title/label
@@ -1536,6 +1541,4 @@ public:
 #endif // wxUSE_ACCESSIBILITY
 
 
-#endif
-    // _WX_WINDOW_H_BASE_
-
+#endif // _WX_WINDOW_H_BASE_
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
-
index 35860e231391aa6c7f7b03bf5cc584b88e57d512..baeb42a491ef70caf8e032e2064e97e53b917f9e 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msw/radiobox.cpp
+// Name:        src/msw/radiobox.cpp
 // Purpose:     wxRadioBox implementation
 // Author:      Julian Smart
 // Modified by:
@@ -484,7 +484,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const
 
     // and also wide enough for its label
     int widthLabel;
-    GetTextExtent(GetTitle(), &widthLabel, NULL);
+    GetTextExtent(GetLabel(), &widthLabel, NULL);
     widthLabel += RADIO_SIZE; // FIXME this is bogus too
     if ( widthLabel > width )
         width = widthLabel;
@@ -862,4 +862,3 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
 }
 
 #endif // wxUSE_RADIOBOX
-
index 82f995b9f47abd1c7419e89c1ffde20b54a418a1..2a76e65ebb1fd5a4c275ed39abfa5b35f7b97911 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        msw/toplevel.cpp
+// Name:        src/msw/toplevel.cpp
 // Purpose:     implements wxTopLevelWindow for MSW
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -205,7 +205,7 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
     if ( style & wxMAXIMIZE_BOX )
         msflags |= WS_MAXIMIZEBOX;
 
-#ifndef __WXWINCE__    
+#ifndef __WXWINCE__
     if ( style & wxSYSTEM_MENU )
         msflags |= WS_SYSMENU;
 #endif
@@ -414,11 +414,11 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
     }
 
     SubclassWin(m_hWnd);
-    
+
 #ifdef __SMARTPHONE__
     // Work around title non-display glitch
     Show(false);
-#endif    
+#endif
 
     return true;
 #endif // __WXMICROWIN__/!__WXMICROWIN__
@@ -813,6 +813,16 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
 // wxTopLevelWindowMSW misc
 // ----------------------------------------------------------------------------
 
+void wxTopLevelWindowMSW::SetTitle( const wxString& title)
+{
+    SetLabel(title);
+}
+
+wxString wxTopLevelWindowMSW::GetTitle() const
+{
+    return GetLabel();
+}
+
 void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
 {
     SetIcons( wxIconBundle( icon ) );
@@ -1140,5 +1150,3 @@ HWND wxTLWHiddenParentModule::GetHWND()
 
     return ms_hwnd;
 }
-
-
index bc738d50580bc672a92331e15fec4e48bc95685e..b45efc0be98b9bf7d683a1135360327b275dbc32 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/msw/windows.cpp
-// Purpose:     wxWindow
+// Name:        src/msw/window.cpp
+// Purpose:     wxWindowMSW
 // Author:      Julian Smart
 // Modified by: VZ on 13.05.99: no more Default(), MSWOnXXX() reorganisation
 // Created:     04/01/98
@@ -739,16 +739,6 @@ void wxWindowMSW::Lower()
                    SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
 }
 
-void wxWindowMSW::SetTitle( const wxString& title)
-{
-    SetWindowText(GetHwnd(), title.c_str());
-}
-
-wxString wxWindowMSW::GetTitle() const
-{
-    return wxGetWindowText(GetHWND());
-}
-
 void wxWindowMSW::DoCaptureMouse()
 {
     HWND hWnd = GetHwnd();
@@ -3552,6 +3542,20 @@ bool wxWindowMSW::HandleKillFocus(WXHWND hwnd)
     return GetEventHandler()->ProcessEvent(event);
 }
 
+// ---------------------------------------------------------------------------
+// labels
+// ---------------------------------------------------------------------------
+
+void wxWindowMSW::SetLabel( const wxString& label)
+{
+    SetWindowText(GetHwnd(), label.c_str());
+}
+
+wxString wxWindowMSW::GetLabel() const
+{
+    return wxGetWindowText(GetHWND());
+}
+
 // ---------------------------------------------------------------------------
 // miscellaneous
 // ---------------------------------------------------------------------------