]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/toplevel.cpp
Typos
[wxWidgets.git] / src / gtk1 / toplevel.cpp
index a761214759beafb642a4b54c58de2018c6799a8c..21f458ae6474eab2675fdae0a3d785bdda03c969 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        toplevel.cpp
+// Name:        src/gtk/toplevel.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "toplevel.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -105,17 +101,16 @@ static void wxgtk_window_set_urgency_hint (GtkWindow *win,
     XFree(wm_hints);
 }
 
-static gint gtk_frame_urgency_timer_callback( GtkWidget *win )
+static gint gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win )
 {
 #if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
     if(!gtk_check_version(2,7,0))
-        gtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
+        gtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
     else
 #endif
-        wxgtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
+        wxgtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
 
-    //BCI: argument from GtkWidget* to wxTopLevelWindowGTK* && win->m_urgency_hint = -2;
-    gtk_object_set_data(GTK_OBJECT(win), "m_urgency_hint", GINT_TO_POINTER(-2));
+    win->m_urgency_hint = -2;
     return FALSE;
 }
 }
@@ -152,12 +147,10 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
     // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
 
     // MR: wxRequestUserAttention related block
-    //BCI: switch(win->m_urgency_hint)
-    switch( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) )
+    switch( win->m_urgency_hint )
     {
         default:
-            //BCI:
-            gtk_timeout_remove( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) );
+            gtk_timeout_remove( win->m_urgency_hint );
             // no break, fallthrough to remove hint too
         case -1:
 #if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
@@ -169,8 +162,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
                 wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE);
             }
 
-            //BCI: win->m_urgency_hint = -2;
-            gtk_object_set_data( GTK_OBJECT(widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
+            win->m_urgency_hint = -2;
             break;
 
         case -2: break;
@@ -379,7 +371,7 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget),
                           GdkEvent * WXUNUSED(event),
                           wxTopLevelWindow *win )
 {
-    win->SetIconizeState(TRUE);
+    win->SetIconizeState(true);
 }
 }
 
@@ -487,12 +479,7 @@ void wxTopLevelWindowGTK::Init()
     m_gdkDecor = m_gdkFunc = 0;
     m_grabbed = false;
 
-    //BCI: header wx/gtk/toplevel.h:
-    // private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
-    // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
-    // int m_urgency_hint;
-
-    //BCI: m_urgency_hint = -2;
+    m_urgency_hint = -2;
 }
 
 bool wxTopLevelWindowGTK::Create( wxWindow *parent,
@@ -566,9 +553,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
         }
     }
 
-    // BCI:
-    gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
-
     wxWindow *topParent = wxGetTopLevelParent(m_parent);
     if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
                        (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
@@ -588,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)
@@ -720,7 +704,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
 {
     if (m_grabbed)
     {
-        wxASSERT_MSG( FALSE, _T("Window still grabbed"));
+        wxASSERT_MSG( false, _T("Window still grabbed"));
         RemoveGrab();
     }
 
@@ -1146,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 ) );
 }
 
@@ -1349,17 +1337,10 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
     // wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
     ::wxYieldIfNeeded();
 
-    /*BCI:
     if(m_urgency_hint >= 0)
         gtk_timeout_remove(m_urgency_hint);
-    */
-    int urgency_hint = GPOINTER_TO_INT( gtk_object_get_data( GTK_OBJECT(m_widget), "m_urgency_hint") );
-    if(urgency_hint >= 0)
-        gtk_timeout_remove(urgency_hint);
-    //BCI: END
 
-    //BCI: m_urgency_hint = -2;
-    gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2));
+    m_urgency_hint = -2;
 
     if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() )
     {
@@ -1367,14 +1348,9 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
 
         if (flags & wxUSER_ATTENTION_INFO)
         {
-            //BCI: m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
-            gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint",
-                                 GINT_TO_POINTER( gtk_timeout_add(5000,
-                                         (GtkFunction)gtk_frame_urgency_timer_callback,
-                                         m_widget) ) );
+            m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
         } else {
-            //BCI: m_urgency_hint = -1;
-            gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-1) );
+            m_urgency_hint = -1;
         }
     }
 
@@ -1385,3 +1361,32 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
 #endif
         wxgtk_window_set_urgency_hint(GTK_WINDOW( m_widget ), new_hint_value);
 }
+
+void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
+{
+#ifdef __WXGTK20__
+    // Store which styles were changed
+    long styleChanges = style ^ m_windowStyle;
+#endif
+
+    // Process wxWindow styles. This also updates the internal variable
+    // Therefore m_windowStyle bits carry now the _new_ style values
+    wxWindow::SetWindowStyleFlag(style);
+
+#ifdef __WXGTK20__
+    // 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 // GTK+ 2.4
+#if GTK_CHECK_VERSION(2,2,0)
+    if ( (styleChanges & wxFRAME_NO_TASKBAR) && !gtk_check_version(2,2,0) )
+    {
+        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR);
+    }
+#endif // GTK+ 2.2
+#endif // GTK+ 2.0
+}