]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
GetLabelTop should return the stripped label, for compatibility.
[wxWidgets.git] / src / gtk / window.cpp
index 9dcf7a83d85837d2a35fe484a1d15a85d2450662..a113e7105fddd884147f1c9246714768fafe6572 100644 (file)
@@ -424,6 +424,8 @@ void wxgtk_window_size_request_callback(GtkWidget *widget,
 }
 }
 
 }
 }
 
+#if wxUSE_COMBOBOX
+
 extern "C" {
 static
 void wxgtk_combo_size_request_callback(GtkWidget *widget,
 extern "C" {
 static
 void wxgtk_combo_size_request_callback(GtkWidget *widget,
@@ -459,6 +461,8 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget,
 }
 }
 
 }
 }
 
+#endif // wxUSE_COMBOBOX
+
 //-----------------------------------------------------------------------------
 // "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
@@ -1233,13 +1237,15 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
                                          T *gdk_event)
 {
     event.SetTimestamp( gdk_event->time );
                                          T *gdk_event)
 {
     event.SetTimestamp( gdk_event->time );
-    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
-    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
-    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
-    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
-    event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
-    event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
-    event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
+    event.m_shiftDown = gdk_event->state & GDK_SHIFT_MASK;
+    event.m_controlDown = gdk_event->state & GDK_CONTROL_MASK;
+    event.m_altDown = gdk_event->state & GDK_MOD1_MASK;
+    event.m_metaDown = gdk_event->state & GDK_MOD2_MASK;
+    event.m_leftDown = gdk_event->state & GDK_BUTTON1_MASK;
+    event.m_middleDown = gdk_event->state & GDK_BUTTON2_MASK;
+    event.m_rightDown = gdk_event->state & GDK_BUTTON3_MASK;
+    event.m_aux1Down = gdk_event->state & GDK_BUTTON4_MASK;
+    event.m_aux2Down = gdk_event->state & GDK_BUTTON5_MASK;
 
     wxPoint pt = win->GetClientAreaOrigin();
     event.m_x = (wxCoord)gdk_event->x - pt.x;
 
     wxPoint pt = win->GetClientAreaOrigin();
     event.m_x = (wxCoord)gdk_event->x - pt.x;
@@ -1434,7 +1440,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
 
     g_lastButtonNumber = gdk_event->button;
 
 
     g_lastButtonNumber = gdk_event->button;
 
-    if (win->m_wxwindow && (g_focusWindow != win) && win->CanAcceptFocus())
+    if (win->m_wxwindow && (g_focusWindow != win) && win->IsFocusable())
     {
         gtk_widget_grab_focus( win->m_wxwindow );
     }
     {
         gtk_widget_grab_focus( win->m_wxwindow );
     }
@@ -1570,7 +1576,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
         return TRUE;
 
     if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() && 
         return TRUE;
 
     if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() && 
-        (g_focusWindow != win) && win->CanAcceptFocus())
+        (g_focusWindow != win) && win->IsFocusable())
     {
         gtk_widget_grab_focus( win->m_wxwindow );
     }
     {
         gtk_widget_grab_focus( win->m_wxwindow );
     }
@@ -1741,15 +1747,7 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
     }
 
     wxMouseEvent event(wxEVT_MOUSEWHEEL);
     }
 
     wxMouseEvent event(wxEVT_MOUSEWHEEL);
-    // Can't use InitMouse macro because scroll events don't have button
-    event.SetTimestamp( gdk_event->time );
-    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
-    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
-    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
-    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
-    event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
-    event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
-    event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
+    InitMouseEvent(win, event, gdk_event);
     event.m_linesPerAction = 3;
     event.m_wheelDelta = 120;
     if (gdk_event->direction == GDK_SCROLL_UP)
     event.m_linesPerAction = 3;
     event.m_wheelDelta = 120;
     if (gdk_event->direction == GDK_SCROLL_UP)
@@ -1757,14 +1755,6 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
     else
         event.m_wheelRotation = -120;
 
     else
         event.m_wheelRotation = -120;
 
-    wxPoint pt = win->GetClientAreaOrigin();
-    event.m_x = (wxCoord)gdk_event->x - pt.x;
-    event.m_y = (wxCoord)gdk_event->y - pt.y;
-
-    event.SetEventObject( win );
-    event.SetId( win->GetId() );
-    event.SetTimestamp( gdk_event->time );
-
     return win->GTKProcessEvent(event);
 }
 
     return win->GTKProcessEvent(event);
 }
 
@@ -1959,8 +1949,6 @@ gtk_window_leave_callback( GtkWidget *widget,
     if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
 
     wxMouseEvent event( wxEVT_LEAVE_WINDOW );
     if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
 
     wxMouseEvent event( wxEVT_LEAVE_WINDOW );
-    event.SetTimestamp( gdk_event->time );
-    event.SetEventObject( win );
 
     int x = 0;
     int y = 0;
 
     int x = 0;
     int y = 0;
@@ -1968,17 +1956,7 @@ gtk_window_leave_callback( GtkWidget *widget,
 
     gdk_window_get_pointer( widget->window, &x, &y, &state );
 
 
     gdk_window_get_pointer( widget->window, &x, &y, &state );
 
-    event.m_shiftDown = (state & GDK_SHIFT_MASK) != 0;
-    event.m_controlDown = (state & GDK_CONTROL_MASK) != 0;
-    event.m_altDown = (state & GDK_MOD1_MASK) != 0;
-    event.m_metaDown = (state & GDK_MOD2_MASK) != 0;
-    event.m_leftDown = (state & GDK_BUTTON1_MASK) != 0;
-    event.m_middleDown = (state & GDK_BUTTON2_MASK) != 0;
-    event.m_rightDown = (state & GDK_BUTTON3_MASK) != 0;
-
-    wxPoint pt = win->GetClientAreaOrigin();
-    event.m_x = x + pt.x;
-    event.m_y = y + pt.y;
+    InitMouseEvent(win, event, gdk_event);
 
     return win->GTKProcessEvent(event);
 }
 
     return win->GTKProcessEvent(event);
 }
@@ -2194,6 +2172,8 @@ wxMouseState wxGetMouseState()
     ms.SetLeftDown(mask & GDK_BUTTON1_MASK);
     ms.SetMiddleDown(mask & GDK_BUTTON2_MASK);
     ms.SetRightDown(mask & GDK_BUTTON3_MASK);
     ms.SetLeftDown(mask & GDK_BUTTON1_MASK);
     ms.SetMiddleDown(mask & GDK_BUTTON2_MASK);
     ms.SetRightDown(mask & GDK_BUTTON3_MASK);
+    ms.SetAux1Down(mask & GDK_BUTTON4_MASK);
+    ms.SetAux2Down(mask & GDK_BUTTON5_MASK);
 
     ms.SetControlDown(mask & GDK_CONTROL_MASK);
     ms.SetShiftDown(mask & GDK_SHIFT_MASK);
 
     ms.SetControlDown(mask & GDK_CONTROL_MASK);
     ms.SetShiftDown(mask & GDK_SHIFT_MASK);
@@ -2543,6 +2523,7 @@ void wxWindowGTK::PostCreation()
                           G_CALLBACK (gtk_window_size_callback), this);
     }
 
                           G_CALLBACK (gtk_window_size_callback), this);
     }
 
+#if wxUSE_COMBOBOX
     if (GTK_IS_COMBO(m_widget))
     {
         GtkCombo *gcombo = GTK_COMBO(m_widget);
     if (GTK_IS_COMBO(m_widget))
     {
         GtkCombo *gcombo = GTK_COMBO(m_widget);
@@ -2550,17 +2531,18 @@ void wxWindowGTK::PostCreation()
         g_signal_connect (gcombo->entry, "size_request",
                           G_CALLBACK (wxgtk_combo_size_request_callback),
                           this);
         g_signal_connect (gcombo->entry, "size_request",
                           G_CALLBACK (wxgtk_combo_size_request_callback),
                           this);
-    }
+    } else
+#endif // wxUSE_COMBOBOX
 #ifdef GTK_IS_FILE_CHOOSER_BUTTON
 #ifdef GTK_IS_FILE_CHOOSER_BUTTON
-    else if (!gtk_check_version(2,6,0) && GTK_IS_FILE_CHOOSER_BUTTON(m_widget))
+    if (!gtk_check_version(2,6,0) && GTK_IS_FILE_CHOOSER_BUTTON(m_widget))
     {
         // If we connect to the "size_request" signal of a GtkFileChooserButton
         // then that control won't be sized properly when placed inside sizers
         // (this can be tested removing this elseif and running XRC or WIDGETS samples)
         // FIXME: what should be done here ?
     {
         // If we connect to the "size_request" signal of a GtkFileChooserButton
         // then that control won't be sized properly when placed inside sizers
         // (this can be tested removing this elseif and running XRC or WIDGETS samples)
         // FIXME: what should be done here ?
-    }
+    } else
 #endif
 #endif
-    else if ( !IsTopLevel() ) // top level windows use their own callback
+    if ( !IsTopLevel() ) // top level windows use their own callback
     {
         // This is needed if we want to add our windows into native
         // GTK controls, such as the toolbar. With this callback, the
     {
         // This is needed if we want to add our windows into native
         // GTK controls, such as the toolbar. With this callback, the
@@ -3179,11 +3161,13 @@ void wxWindowGTK::SetFocus()
     {
         if (GTK_IS_CONTAINER(m_widget))
         {
     {
         if (GTK_IS_CONTAINER(m_widget))
         {
+#if wxUSE_RADIOBTN
             if (IsKindOf(CLASSINFO(wxRadioButton)))
             {
                 gtk_widget_grab_focus (m_widget);
                 return;
             }
             if (IsKindOf(CLASSINFO(wxRadioButton)))
             {
                 gtk_widget_grab_focus (m_widget);
                 return;
             }
+#endif // wxUSE_RADIOBTN
 
             gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD );
         }
 
             gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD );
         }
@@ -3380,7 +3364,7 @@ bool wxWindowGTK::DoNavigateIn(int flags)
     }
     else // navigate inside the container
     {
     }
     else // navigate inside the container
     {
-        wxWindow *parent = wxGetTopLevelParent(this);
+        wxWindow *parent = wxGetTopLevelParent((wxWindow *)this);
         wxCHECK_MSG( parent, false, _T("every window must have a TLW parent") );
 
         GtkDirectionType dir;
         wxCHECK_MSG( parent, false, _T("every window must have a TLW parent") );
 
         GtkDirectionType dir;