]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
gtk spinctrl code simplification
[wxWidgets.git] / src / gtk / frame.cpp
index 2e602ab9dc4d440f075b9a28864a2e657d274f82..696d588eef035abcc30e319811a5139ce34c429f 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        frame.cpp
+// Name:        src/gtk/frame.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -7,6 +7,9 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 // ============================================================================
 // declarations
 // ============================================================================
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "frame.h"
-#endif
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
+#include "wx/frame.h"
 
-#include "wx/defs.h"
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/dcclient.h"
+    #include "wx/menu.h"
+#endif // WX_PRECOMP
 
-#include "wx/frame.h"
 #include "wx/dialog.h"
 #include "wx/control.h"
-#include "wx/app.h"
-#include "wx/menu.h"
 #if wxUSE_TOOLBAR
     #include "wx/toolbar.h"
 #endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
-#include "wx/dcclient.h"
 
 #include <glib.h>
 #include "wx/gtk/private.h"
 const int wxSTATUS_HEIGHT  = 25;
 const int wxPLACE_HOLDER   = 0;
 
-// ----------------------------------------------------------------------------
-// idle system
-// ----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
 // ----------------------------------------------------------------------------
 // event tables
 // ----------------------------------------------------------------------------
@@ -184,11 +175,12 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
             wxToolBar *toolBar = (wxToolBar*) child;
             if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
             {
-                gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
-                    GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
-
-                gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
-                    GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
+                g_signal_connect (toolBar->m_widget, "child_attached",
+                                  G_CALLBACK (gtk_toolbar_attached_callback),
+                                  parent);
+                g_signal_connect (toolBar->m_widget, "child_detached",
+                                  G_CALLBACK (gtk_toolbar_detached_callback),
+                                  parent);
             }
         }
 #endif // wxUSE_TOOLBAR
@@ -493,7 +485,12 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
         gtk_pizza_set_size( GTK_PIZZA(m_wxwindow),
                             m_frameStatusBar->m_widget,
                             xx, yy, ww, hh );
-        gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
+        if (GTK_WIDGET_DRAWABLE (m_frameStatusBar->m_widget))
+        {
+            gtk_widget_queue_draw (m_frameStatusBar->m_widget);
+            // FIXME: Do we really want to force an immediate redraw?
+            gdk_window_process_updates (m_frameStatusBar->m_widget->window, TRUE);
+        }
     }
 #endif // wxUSE_STATUSBAR
 
@@ -562,11 +559,13 @@ void wxFrame::DetachMenuBar()
 
         if (m_frameMenuBar->GetWindowStyle() & wxMB_DOCKABLE)
         {
-            gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
-                GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
+            g_signal_handlers_disconnect_by_func (m_frameMenuBar->m_widget,
+                    (gpointer) gtk_menu_attached_callback,
+                    this);
 
-            gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
-                GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+            g_signal_handlers_disconnect_by_func (m_frameMenuBar->m_widget,
+                    (gpointer) gtk_menu_detached_callback,
+                    this);
         }
 
         gtk_widget_ref( m_frameMenuBar->m_widget );
@@ -595,11 +594,12 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
 
         if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
         {
-            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
-                GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
-
-            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
-                GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+            g_signal_connect (menuBar->m_widget, "child_attached",
+                              G_CALLBACK (gtk_menu_attached_callback),
+                              this);
+            g_signal_connect (menuBar->m_widget, "child_detached",
+                              G_CALLBACK (gtk_menu_detached_callback),
+                              this);
         }
 
         gtk_widget_show( m_frameMenuBar->m_widget );
@@ -622,12 +622,12 @@ void wxFrame::UpdateMenuBarSize()
 
     // this is called after Remove with a NULL m_frameMenuBar
     if ( m_frameMenuBar )
-    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
-        (m_frameMenuBar->m_widget, &req );
+        (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
+            (m_frameMenuBar->m_widget, &req );
 
     m_menuBarHeight = req.height;
 
-        // resize window in OnInternalIdle
+    // resize window in OnInternalIdle
 
     GtkUpdateSize();
 }
@@ -714,4 +714,3 @@ void wxFrame::PositionStatusBar()
     GtkUpdateSize();
 }
 #endif // wxUSE_STATUSBAR
-