]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/spinbutt.cpp
If the threads module hasn't been initialized yet then we can assume
[wxWidgets.git] / src / univ / spinbutt.cpp
index e93d9b68c0ef29d1579cab333e4c115de5f7edc6..a9428daa3072ccbe9d93754dea6bfadb77cbca4c 100644 (file)
@@ -17,9 +17,9 @@
 // headers
 // ----------------------------------------------------------------------------
 
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
-//    #pragma implementation "butbase.h"
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "spinbutt.h"
     #pragma implementation "spinbutt.h"
+    #pragma implementation "univspinbutt.h"
 #endif
 
 #include "wx/wxprec.h"
 #endif
 
 #include "wx/wxprec.h"
@@ -144,14 +144,14 @@ int wxSpinButton::NormalizeValue(int value) const
     if ( value > m_max )
     {
         if ( GetWindowStyleFlag() & wxSP_WRAP )
     if ( value > m_max )
     {
         if ( GetWindowStyleFlag() & wxSP_WRAP )
-            value = m_min + (value - m_max) % (m_max - m_min);
+            value = m_min + (value - m_max - 1) % (m_max - m_min + 1);
         else
             value = m_max;
     }
     else if ( value < m_min )
     {
         if ( GetWindowStyleFlag() & wxSP_WRAP )
         else
             value = m_max;
     }
     else if ( value < m_min )
     {
         if ( GetWindowStyleFlag() & wxSP_WRAP )
-            value = m_max - (m_min - value) % (m_max - m_min);
+            value = m_max - (m_min - value - 1) % (m_max - m_min + 1);
         else
             value = m_min;
     }
         else
             value = m_min;
     }
@@ -370,7 +370,7 @@ wxStdSpinButtonInputHandler(wxInputHandler *inphand)
 {
 }
 
 {
 }
 
-bool wxStdSpinButtonInputHandler::HandleKey(wxControl *control,
+bool wxStdSpinButtonInputHandler::HandleKey(wxInputConsumer *consumer,
                                             const wxKeyEvent& event,
                                             bool pressed)
 {
                                             const wxKeyEvent& event,
                                             bool pressed)
 {
@@ -392,19 +392,19 @@ bool wxStdSpinButtonInputHandler::HandleKey(wxControl *control,
 
         if ( !!action )
         {
 
         if ( !!action )
         {
-            control->PerformAction(action);
+            consumer->PerformAction(action);
 
             return TRUE;
         }
     }
 
 
             return TRUE;
         }
     }
 
-    return wxStdInputHandler::HandleKey(control, event, pressed);
+    return wxStdInputHandler::HandleKey(consumer, event, pressed);
 }
 
 }
 
-bool wxStdSpinButtonInputHandler::HandleMouse(wxControl *control,
+bool wxStdSpinButtonInputHandler::HandleMouse(wxInputConsumer *consumer,
                                               const wxMouseEvent& event)
 {
                                               const wxMouseEvent& event)
 {
-    wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
+    wxSpinButton *spinbtn = wxStaticCast(consumer->GetInputWindow(), wxSpinButton);
 
     if ( spinbtn->GetArrows().HandleMouse(event) )
     {
 
     if ( spinbtn->GetArrows().HandleMouse(event) )
     {
@@ -412,13 +412,13 @@ bool wxStdSpinButtonInputHandler::HandleMouse(wxControl *control,
         return FALSE;
     }
 
         return FALSE;
     }
 
-    return wxStdInputHandler::HandleMouse(control, event);
+    return wxStdInputHandler::HandleMouse(consumer, event);
 }
 
 }
 
-bool wxStdSpinButtonInputHandler::HandleMouseMove(wxControl *control,
+bool wxStdSpinButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer,
                                                   const wxMouseEvent& event)
 {
                                                   const wxMouseEvent& event)
 {
-    wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
+    wxSpinButton *spinbtn = wxStaticCast(consumer->GetInputWindow(), wxSpinButton);
 
     if ( spinbtn->GetArrows().HandleMouseMove(event) )
     {
 
     if ( spinbtn->GetArrows().HandleMouseMove(event) )
     {
@@ -426,7 +426,7 @@ bool wxStdSpinButtonInputHandler::HandleMouseMove(wxControl *control,
         return FALSE;
     }
 
         return FALSE;
     }
 
-    return wxStdInputHandler::HandleMouseMove(control, event);
+    return wxStdInputHandler::HandleMouseMove(consumer, event);
 }
 
 
 }