]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
Don't force the child's m_isShown state to match that of the parent in CocoaAddChild.
[wxWidgets.git] / src / gtk / window.cpp
index 363f13d445e6cfa71c6084845854102bd4e8b520..eb36d67c61930c4f0919275393d07a9d185ef585 100644 (file)
@@ -25,7 +25,6 @@
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
-    #include "wx/radiobut.h"
     #include "wx/toolbar.h"
     #include "wx/combobox.h"
     #include "wx/layout.h"
@@ -1564,7 +1563,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
     if ( ret )
         return TRUE;
 
-    if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() && 
+    if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() &&
         (g_focusWindow != win) /* && win->IsFocusable() */)
     {
         win->SetFocus();
@@ -1859,9 +1858,7 @@ gtk_window_focus_out_callback( GtkWidget *widget,
         // Disable default focus handling for custom windows
         // since the default GTK+ handler issues a repaint
         if ( has_wxwindow )
-       {
             return TRUE;
-       }
     }
 
     // continue with normal processing
@@ -2005,9 +2002,10 @@ gtk_scrollbar_event_after(GtkRange* range, GdkEvent* event, wxWindow* win)
 
         const int orient = wxWindow::OrientFromScrollDir(
                                         win->ScrollDirFromRange(range));
-        wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBRELEASE, win->GetScrollPos(orient), orient);
-        event.SetEventObject(win);
-        win->GTKProcessEvent(event);
+        wxScrollWinEvent evt(wxEVT_SCROLLWIN_THUMBRELEASE,
+                                win->GetScrollPos(orient), orient);
+        evt.SetEventObject(win);
+        win->GTKProcessEvent(evt);
     }
 }
 
@@ -2099,26 +2097,26 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
 }
 
 //-----------------------------------------------------------------------------
-// "grab_broken" 
+// "grab_broken"
 //-----------------------------------------------------------------------------
 
-#ifdef __WXGTK210__
-static void
-gtk_window_grab_broken( GtkWidget *m_widget,
+#if GTK_CHECK_VERSION(2, 8, 0)
+static gboolean
+gtk_window_grab_broken( GtkWidget*,
                         GdkEventGrabBroken *event,
                         wxWindow *win )
 {
     // Mouse capture has been lost involuntarily, notify the application
-    if( !event->keyboard && win && wxWindow::GetCapture() == win )
+    if(!event->keyboard && wxWindow::GetCapture() == win)
     {
         wxMouseCaptureLostEvent evt( win->GetId() );
         evt.SetEventObject( win );
         win->GetEventHandler()->ProcessEvent( evt );
     }
+    return false;
 }
 #endif
 
-
 } // extern "C"
 
 // ----------------------------------------------------------------------------
@@ -2532,7 +2530,7 @@ void wxWindowGTK::PostCreation()
         // Catch native resize events
         g_signal_connect (m_wxwindow, "size_allocate",
                           G_CALLBACK (gtk_window_size_callback), this);
-#ifdef __WXGTK210__
+#if GTK_CHECK_VERSION(2, 8, 0)
         if (!gtk_check_version(2,8,0))
         {
             // Make sure we can notify the app when mouse capture is lost
@@ -2544,7 +2542,7 @@ void wxWindowGTK::PostCreation()
 
     if ( connect_widget != m_wxwindow )
     {
-#ifdef __WXGTK210__
+#if GTK_CHECK_VERSION(2, 8, 0)
         if (!gtk_check_version(2,8,0))
         {
             // Make sure we can notify app code when mouse capture is lost
@@ -2842,7 +2840,7 @@ void wxWindowGTK::OnInternalIdle()
         }
     }
 
-    if (wxUpdateUIEvent::CanUpdate(this))
+    if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
@@ -2900,7 +2898,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const
 
     int dx = 0;
     int dy = 0;
-    if (m_parent && m_parent->m_wxwindow)
+    if (!IsTopLevel() && m_parent && m_parent->m_wxwindow)
     {
         GtkPizza *pizza = GTK_PIZZA(m_parent->m_wxwindow);
         dx = gtk_pizza_get_xoffset( pizza );
@@ -3052,9 +3050,7 @@ int wxWindowGTK::GetCharHeight() const
     wxFont font = GetFont();
     wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") );
 
-    PangoContext *context = NULL;
-    if (m_widget)
-        context = gtk_widget_get_pango_context( m_widget );
+    PangoContext* context = gtk_widget_get_pango_context(m_widget);
 
     if (!context)
         return 0;
@@ -3080,9 +3076,7 @@ int wxWindowGTK::GetCharWidth() const
     wxFont font = GetFont();
     wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") );
 
-    PangoContext *context = NULL;
-    if (m_widget)
-        context = gtk_widget_get_pango_context( m_widget );
+    PangoContext* context = gtk_widget_get_pango_context(m_widget);
 
     if (!context)
         return 0;
@@ -3183,22 +3177,30 @@ void wxWindowGTK::SetFocus()
 
     if (m_wxwindow)
     {
+        // wxWindow::SetFocus() should really set the focus to
+        // this control, whatever the flags are
+        if (!GTK_WIDGET_CAN_FOCUS(m_wxwindow))
+            GTK_WIDGET_SET_FLAGS(m_wxwindow, GTK_CAN_FOCUS);
+
         if (!GTK_WIDGET_HAS_FOCUS (m_wxwindow))
         {
             gtk_widget_grab_focus (m_wxwindow);
         }
     }
-    else if (m_widget)
+    else
     {
+        // wxWindow::SetFocus() should really set the focus to
+        // this control, whatever the flags are
+        if (!GTK_WIDGET_CAN_FOCUS(m_widget))
+            GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
+
         if (GTK_IS_CONTAINER(m_widget))
         {
-#if wxUSE_RADIOBTN
-            if (IsKindOf(CLASSINFO(wxRadioButton)))
+            if (GTK_IS_RADIO_BUTTON(m_widget))
             {
                 gtk_widget_grab_focus (m_widget);
                 return;
             }
-#endif // wxUSE_RADIOBTN
 
             gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD );
         }
@@ -3771,7 +3773,6 @@ void wxWindowGTK::GtkSendPaintEvents()
     nc_paint_event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( nc_paint_event );
 
-    
     wxPaintEvent paint_event( GetId() );
     paint_event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( paint_event );
@@ -4310,8 +4311,11 @@ void wxWindowGTK::GtkScrolledWindowSetBorder(GtkWidget* w, int wxstyle)
             gtkstyle = GTK_SHADOW_OUT;
         else if (wxstyle & wxBORDER_SUNKEN)
             gtkstyle = GTK_SHADOW_IN;
+#if 0
+        // Now obsolete
         else if (wxstyle & wxBORDER_DOUBLE)
             gtkstyle = GTK_SHADOW_ETCHED_IN;
+#endif
         else //default
             gtkstyle = GTK_SHADOW_IN;