]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/spinbutt.cpp
generate EVT_CONTEXT_MENU when right mouse button is pressed, not released
[wxWidgets.git] / src / gtk1 / spinbutt.cpp
index 38f4d4c28ac164147563fe59d3211615bbd9fce8..4ac29c9c25293162939e072286cef309c8dc3e65 100644 (file)
@@ -8,21 +8,23 @@
 // 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"
 
-#ifdef wxUSE_SPINBTN
+#if wxUSE_SPINBTN
 
 #include "wx/utils.h"
 
 #include <math.h>
 
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+#include "wx/gtk/private.h"
 
 //-----------------------------------------------------------------------------
 // idle system
@@ -104,7 +106,7 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
 
 BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
     EVT_SIZE(wxSpinButton::OnSize)
@@ -148,11 +150,7 @@ bool wxSpinButton::Create(wxWindow *parent,
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
-    Show( TRUE );
+    PostCreation(new_size);
 
     return TRUE;
 }
@@ -227,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