From 015dca24cabea5750e808e7c5f9505165b023c90 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Mon, 7 Nov 2005 20:00:50 +0000 Subject: [PATCH] [wxGTK] Support changing the wxSTAY_ON_TOP style value run-time through wxWindow::SetWindowStyleFlag, support for more styles to follow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/toplevel.h | 2 ++ include/wx/gtk/window.h | 2 ++ include/wx/gtk1/toplevel.h | 2 ++ include/wx/gtk1/window.h | 2 ++ src/gtk/toplevel.cpp | 21 ++++++++++++++++++++- src/gtk/window.cpp | 5 +++++ src/gtk1/toplevel.cpp | 21 ++++++++++++++++++++- src/gtk1/window.cpp | 5 +++++ 8 files changed, 58 insertions(+), 2 deletions(-) diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index 3858f08271..2729119b50 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -58,6 +58,8 @@ public: virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + virtual void SetWindowStyleFlag( long style ); + virtual bool Show(bool show = true); virtual void Raise(); diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index ba05d1b3f2..3ec4c2805f 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -59,6 +59,8 @@ public: virtual bool Show( bool show = true ); virtual bool Enable( bool enable = true ); + virtual void SetWindowStyleFlag( long style ); + virtual bool IsRetained() const; virtual void SetFocus(); diff --git a/include/wx/gtk1/toplevel.h b/include/wx/gtk1/toplevel.h index 3858f08271..2729119b50 100644 --- a/include/wx/gtk1/toplevel.h +++ b/include/wx/gtk1/toplevel.h @@ -58,6 +58,8 @@ public: virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + virtual void SetWindowStyleFlag( long style ); + virtual bool Show(bool show = true); virtual void Raise(); diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index ba05d1b3f2..3ec4c2805f 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -59,6 +59,8 @@ public: virtual bool Show( bool show = true ); virtual bool Enable( bool enable = true ); + virtual void SetWindowStyleFlag( long style ); + virtual bool IsRetained() const; virtual void SetFocus(); diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index f8bcd99d54..d8472ece1d 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -572,7 +572,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } #endif -#if GTK_CHECK_VERSION(2,4,0) +#ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { if (style & wxSTAY_ON_TOP) @@ -1361,3 +1361,22 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) #endif wxgtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value); } + +void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) +{ + // Store which styles were changed + long styleChanges = style ^ m_windowStyle; + + // Process wxWindow styles. This also updates the internal variable + // Therefore m_windowStyle bits carry now the _new_ style values + wxWindow::SetWindowStyleFlag(style); + + // just return for now if widget does not exist yet + if (!m_widget) + return; + +#ifdef __WXGTK24__ + if ( (styleChanges & wxSTAY_ON_TOP) && !gtk_check_version(2,4,0) ) + gtk_window_set_keep_above(GTK_WINDOW(m_widget), m_windowStyle & wxSTAY_ON_TOP); +#endif +} diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 826fdd3c31..871cd2fd63 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -4814,6 +4814,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = false; } +void wxWindowGTK::SetWindowStyleFlag( long style ) +{ + // Updates the internal variable. NB: Now m_windowStyle bits carry the _new_ style values already + wxWindowBase::SetWindowStyleFlag(style); +} // Find the wxWindow at the current mouse position, also returning the mouse // position. diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index f8bcd99d54..d8472ece1d 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -572,7 +572,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, } #endif -#if GTK_CHECK_VERSION(2,4,0) +#ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { if (style & wxSTAY_ON_TOP) @@ -1361,3 +1361,22 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) #endif wxgtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value); } + +void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) +{ + // Store which styles were changed + long styleChanges = style ^ m_windowStyle; + + // Process wxWindow styles. This also updates the internal variable + // Therefore m_windowStyle bits carry now the _new_ style values + wxWindow::SetWindowStyleFlag(style); + + // just return for now if widget does not exist yet + if (!m_widget) + return; + +#ifdef __WXGTK24__ + if ( (styleChanges & wxSTAY_ON_TOP) && !gtk_check_version(2,4,0) ) + gtk_window_set_keep_above(GTK_WINDOW(m_widget), m_windowStyle & wxSTAY_ON_TOP); +#endif +} diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 826fdd3c31..871cd2fd63 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -4814,6 +4814,11 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = false; } +void wxWindowGTK::SetWindowStyleFlag( long style ) +{ + // Updates the internal variable. NB: Now m_windowStyle bits carry the _new_ style values already + wxWindowBase::SetWindowStyleFlag(style); +} // Find the wxWindow at the current mouse position, also returning the mouse // position. -- 2.45.2