]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/spinctrl.cpp
1. wxCalendarCtrl
[wxWidgets.git] / src / msw / spinctrl.cpp
index 27b0b26c2d4c64864b768e42823d405d6dbd69a6..1724bf68d837687a197a2d3d9c5c704c8303f5b6 100644 (file)
 // macros
 // ----------------------------------------------------------------------------
 
-    IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+
+BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
+    EVT_SPIN(-1, wxSpinCtrl::OnSpinChange)
+END_EVENT_TABLE()
 
 // ----------------------------------------------------------------------------
 // constants
@@ -201,6 +205,24 @@ bool wxSpinCtrl::SetFont(const wxFont& font)
     return TRUE;
 }
 
+// ----------------------------------------------------------------------------
+// event processing
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
+{
+    wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
+    event.SetEventObject(this);
+    event.SetInt(eventSpin.GetPosition());
+
+    (void)GetEventHandler()->ProcessEvent(event);
+
+    if ( eventSpin.GetSkipped() )
+    {
+        event.Skip();
+    }
+}
+
 // ----------------------------------------------------------------------------
 // size calculations
 // ----------------------------------------------------------------------------