]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/spinctrl.cpp
Remove wxT from prototype
[wxWidgets.git] / src / gtk / spinctrl.cpp
index d84c02d39d8332aa960a4a0db4ee8881c18d0631..e2c07c0b74f737ffc71b0d4134cc5e92cfa63602 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/gtk/spinbutt.cpp
+// Name:        src/gtk/spinctrl.cpp
 // Purpose:     wxSpinCtrl
 // Author:      Robert
 // Modified by:
@@ -21,7 +21,9 @@
     #include "wx/wxcrtvararg.h"
 #endif
 
+#include <gtk/gtk.h>
 #include "wx/gtk/private.h"
+#include "wx/gtk/private/gtk2-compat.h"
 
 //-----------------------------------------------------------------------------
 // data
@@ -152,12 +154,14 @@ double wxSpinCtrlGTKBase::DoGetValue() const
     g_signal_emit(m_widget, sig_id, 0, &value, &handled);
     if (!handled)
         value = g_strtod(gtk_entry_get_text(GTK_ENTRY(m_widget)), NULL);
-    const GtkAdjustment* adj =
+    GtkAdjustment* adj =
         gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(m_widget));
-    if (value < adj->lower)
-        value = adj->lower;
-    else if (value > adj->upper)
-        value = adj->upper;
+    const double lower = gtk_adjustment_get_lower(adj);
+    const double upper = gtk_adjustment_get_upper(adj);
+    if (value < lower)
+        value = lower;
+    else if (value > upper)
+        value = upper;
 
     return value;
 }
@@ -193,7 +197,7 @@ bool wxSpinCtrlGTKBase::GetSnapToTicks() const
 {
     wxCHECK_MSG(m_widget, false, "invalid spin button");
 
-    return gtk_spin_button_get_snap_to_ticks( GTK_SPIN_BUTTON(m_widget) );
+    return gtk_spin_button_get_snap_to_ticks( GTK_SPIN_BUTTON(m_widget) ) != 0;
 }
 
 void wxSpinCtrlGTKBase::SetValue( const wxString& value )
@@ -297,7 +301,7 @@ void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event )
             GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
             if ( window )
             {
-                GtkWidget *widgetDef = window->default_widget;
+                GtkWidget* widgetDef = gtk_window_get_default_widget(window);
 
                 if ( widgetDef )
                 {
@@ -323,10 +327,15 @@ void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event )
 
 GdkWindow *wxSpinCtrlGTKBase::GTKGetWindow(wxArrayGdkWindows& windows) const
 {
+#ifdef __WXGTK3__
+    // no access to internal GdkWindows
+    wxUnusedVar(windows);
+#else
     GtkSpinButton* spinbutton = GTK_SPIN_BUTTON(m_widget);
 
     windows.push_back(spinbutton->entry.text_area);
     windows.push_back(spinbutton->panel);
+#endif
 
     return NULL;
 }
@@ -352,8 +361,6 @@ wxSpinCtrlGTKBase::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 // wxSpinCtrl
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxSpinCtrlGTKBase)
-
 //-----------------------------------------------------------------------------
 // wxSpinCtrlDouble
 //-----------------------------------------------------------------------------