From cb8cc2506b73a5ea51b515a41eb6ea7a5f5ad60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 4 Nov 2005 11:11:22 +0000 Subject: [PATCH] Get/SetTitle only for wxTopLevelWindow (wxGTK part). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/mdi.h | 16 +++++++--------- include/wx/gtk/toplevel.h | 9 +++++---- include/wx/gtk1/mdi.h | 16 +++++++--------- include/wx/gtk1/toplevel.h | 9 +++++---- include/wx/toplevel.h | 3 ++- include/wx/window.h | 3 ++- src/gtk/toplevel.cpp | 10 +++++++--- src/gtk1/toplevel.cpp | 10 +++++++--- 8 files changed, 42 insertions(+), 34 deletions(-) diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index 19a09ac5aa..cbfb62263f 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gtk/mdi.h +// Name: wx/gtk/mdi.h // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -140,11 +140,11 @@ public: // no size hints virtual void DoSetSizeHints( int WXUNUSED(minW), - int WXUNUSED(minH), - int WXUNUSED(maxW) = -1, - int WXUNUSED(maxH) = -1, - int WXUNUSED(incW) = -1, - int WXUNUSED(incH) = -1) {} + int WXUNUSED(minH), + int WXUNUSED(maxW) = wxDefaultCoord, + int WXUNUSED(maxH) = wxDefaultCoord, + int WXUNUSED(incW) = wxDefaultCoord, + int WXUNUSED(incH) = wxDefaultCoord) {} #if wxUSE_TOOLBAR // no toolbar @@ -162,8 +162,7 @@ public: { wxTopLevelWindowBase::SetIcons(icons); } // no title - void SetTitle( const wxString &title ); - wxString GetTitle() const { return m_title; } + virtual void SetTitle( const wxString &title ); // no maximize etc virtual void Maximize( bool WXUNUSED(maximize) = true ) { } @@ -213,4 +212,3 @@ private: }; #endif // __MDIH__ - diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index ef3d2f8ef2..3858f08271 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -43,9 +43,9 @@ public: virtual ~wxTopLevelWindowGTK(); // implement base class pure virtuals - virtual void Maximize(bool maximize = TRUE); + virtual void Maximize(bool maximize = true); virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = TRUE); + virtual void Iconize(bool iconize = true); virtual bool IsIconized() const; virtual void SetIcon(const wxIcon& icon); virtual void SetIcons(const wxIconBundle& icons); @@ -58,7 +58,7 @@ public: virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - virtual bool Show(bool show = TRUE); + virtual bool Show(bool show = true); virtual void Raise(); @@ -87,7 +87,6 @@ public: // do *not* call this to iconize the frame, this is a private function! void SetIconizeState(bool iconic); - wxString m_title; int m_miniEdge, m_miniTitle; GtkWidget *m_mainWidget; @@ -118,6 +117,8 @@ protected: virtual void DoSetClientSize(int width, int height); virtual void DoGetClientSize( int *width, int *height ) const; + wxString m_title; + // is the frame currently iconized? bool m_isIconized; // is the frame currently grabbed explicitly diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index 19a09ac5aa..cbfb62263f 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gtk/mdi.h +// Name: wx/gtk/mdi.h // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -140,11 +140,11 @@ public: // no size hints virtual void DoSetSizeHints( int WXUNUSED(minW), - int WXUNUSED(minH), - int WXUNUSED(maxW) = -1, - int WXUNUSED(maxH) = -1, - int WXUNUSED(incW) = -1, - int WXUNUSED(incH) = -1) {} + int WXUNUSED(minH), + int WXUNUSED(maxW) = wxDefaultCoord, + int WXUNUSED(maxH) = wxDefaultCoord, + int WXUNUSED(incW) = wxDefaultCoord, + int WXUNUSED(incH) = wxDefaultCoord) {} #if wxUSE_TOOLBAR // no toolbar @@ -162,8 +162,7 @@ public: { wxTopLevelWindowBase::SetIcons(icons); } // no title - void SetTitle( const wxString &title ); - wxString GetTitle() const { return m_title; } + virtual void SetTitle( const wxString &title ); // no maximize etc virtual void Maximize( bool WXUNUSED(maximize) = true ) { } @@ -213,4 +212,3 @@ private: }; #endif // __MDIH__ - diff --git a/include/wx/gtk1/toplevel.h b/include/wx/gtk1/toplevel.h index ef3d2f8ef2..3858f08271 100644 --- a/include/wx/gtk1/toplevel.h +++ b/include/wx/gtk1/toplevel.h @@ -43,9 +43,9 @@ public: virtual ~wxTopLevelWindowGTK(); // implement base class pure virtuals - virtual void Maximize(bool maximize = TRUE); + virtual void Maximize(bool maximize = true); virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = TRUE); + virtual void Iconize(bool iconize = true); virtual bool IsIconized() const; virtual void SetIcon(const wxIcon& icon); virtual void SetIcons(const wxIconBundle& icons); @@ -58,7 +58,7 @@ public: virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - virtual bool Show(bool show = TRUE); + virtual bool Show(bool show = true); virtual void Raise(); @@ -87,7 +87,6 @@ public: // do *not* call this to iconize the frame, this is a private function! void SetIconizeState(bool iconic); - wxString m_title; int m_miniEdge, m_miniTitle; GtkWidget *m_mainWidget; @@ -118,6 +117,8 @@ protected: virtual void DoSetClientSize(int width, int height); virtual void DoGetClientSize( int *width, int *height ) const; + wxString m_title; + // is the frame currently iconized? bool m_isIconized; // is the frame currently grabbed explicitly diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 0a2392e446..3007e976e0 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -155,7 +155,8 @@ public: virtual bool IsFullScreen() const = 0; #if defined(__WXMSW__) || \ - defined(__WXMOTIF__) + defined(__WXMOTIF__) || \ + defined(__WXGTK__) // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow // to wxTopLevelWindow so initially enabled in wxMSW only to observe results diff --git a/include/wx/window.h b/include/wx/window.h index 53af43bf04..3583520685 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -169,7 +169,8 @@ public: // ----------------- #if !defined(__WXMSW__) && \ - !defined(__WXMOTIF__) + !defined(__WXMOTIF__) && \ + !defined(__WXGTK__) // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow // to wxTopLevelWindow so initially enabled in wxMSW only to observe results diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index d50dd65fcf..f8bcd99d54 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: toplevel.cpp +// Name: src/gtk/toplevel.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -371,7 +371,7 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), wxTopLevelWindow *win ) { - win->SetIconizeState(TRUE); + win->SetIconizeState(true); } } @@ -704,7 +704,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() { if (m_grabbed) { - wxASSERT_MSG( FALSE, _T("Window still grabbed")); + wxASSERT_MSG( false, _T("Window still grabbed")); RemoveGrab(); } @@ -1130,7 +1130,11 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + if ( title == m_title ) + return; + m_title = title; + gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); } diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index d50dd65fcf..f8bcd99d54 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: toplevel.cpp +// Name: src/gtk/toplevel.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -371,7 +371,7 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), wxTopLevelWindow *win ) { - win->SetIconizeState(TRUE); + win->SetIconizeState(true); } } @@ -704,7 +704,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() { if (m_grabbed) { - wxASSERT_MSG( FALSE, _T("Window still grabbed")); + wxASSERT_MSG( false, _T("Window still grabbed")); RemoveGrab(); } @@ -1130,7 +1130,11 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + if ( title == m_title ) + return; + m_title = title; + gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) ); }