]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/spinbutt.cpp
Add some missing runtime gtk+ version checks. There is more to spot.
[wxWidgets.git] / src / gtk1 / spinbutt.cpp
index 26886024737c550f31b9876122c2318ddab6f1a1..77416c0a63accfdbcb4d041b7a9166b030693a30 100644 (file)
@@ -8,19 +8,20 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "spinbutt.h"
     #pragma implementation "spinbutbase.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/spinbutt.h"
 
 #if wxUSE_SPINBTN
 
 #include "wx/utils.h"
-
-#include <math.h>
-
+#include "wx/math.h"
 #include "wx/gtk/private.h"
 
 //-----------------------------------------------------------------------------
@@ -42,6 +43,7 @@ static const float sensitivity = 0.02;
 // "value_changed"
 //-----------------------------------------------------------------------------
 
+extern "C" {
 static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win )
 {
     if (g_isIdle) wxapp_install_idle_handler();
@@ -97,6 +99,7 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
         win->GetEventHandler()->ProcessEvent( event2 );
     }
 }
+}
 
 //-----------------------------------------------------------------------------
 // wxSpinButton
@@ -147,11 +150,7 @@ bool wxSpinButton::Create(wxWindow *parent,
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
-    Show( TRUE );
+    PostCreation(new_size);
 
     return TRUE;
 }
@@ -226,15 +225,20 @@ bool wxSpinButton::IsOwnGtkWindow( GdkWindow *window )
     return GTK_SPIN_BUTTON(m_widget)->panel == window;
 }
 
-void wxSpinButton::ApplyWidgetStyle()
+wxSize wxSpinButton::DoGetBestSize() const
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    wxSize best(15, 26); // FIXME
+    CacheBestSize(best);
+    return best;
 }
 
-wxSize wxSpinButton::DoGetBestSize() const
+// static
+wxVisualAttributes
+wxSpinButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    return wxSize(15, 26);
+    // TODO: overload to accept functions like gtk_spin_button_new?
+    // Until then use a similar type
+    return GetDefaultAttributesFromGTKWidget(gtk_button_new);
 }
 
 #endif