]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/spinctrl.cpp
Strip menu codes from page label for consistency with other platforms
[wxWidgets.git] / src / msw / spinctrl.cpp
index 39e32fbf709d6890613b7c4c3a28796cad72edf1..2a1826c45a88e543aa01c0912f4baeab5824d827 100644 (file)
@@ -207,7 +207,7 @@ bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id))
         wxString val = wxGetWindowText(m_hwndBuddy);
         event.SetString(val);
         event.SetInt(GetValue());
-        return GetEventHandler()->ProcessEvent(event);
+        return HandleWindowEvent(event);
     }
 
     // not processed
@@ -225,7 +225,7 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
                 wxString val = wxGetWindowText(m_hwndBuddy);
                 event.SetString(val);
                 event.SetInt(GetValue());
-                if ( GetEventHandler()->ProcessEvent(event) )
+                if ( HandleWindowEvent(event) )
                     return;
                 break;
             }
@@ -241,7 +241,7 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
                 eventNav.SetWindowChange(event.ControlDown());
                 eventNav.SetEventObject(this);
 
-                if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
+                if ( GetParent()->HandleWindowEvent(eventNav) )
                     return;
             }
             break;
@@ -318,7 +318,12 @@ bool wxSpinCtrl::Create(wxWindow *parent,
     WXDWORD exStyle = 0;
     WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
 
-    // calculate the sizes: the size given is the toal size for both controls
+    // this control is used for numeric entry so normally using these flags by
+    // default shouldn't be a problem, if it is we can always add a style such
+    // as wxSP_NON_NUMERIC later
+    msStyle |= ES_RIGHT | ES_NUMBER;
+
+    // calculate the sizes: the size given is the total size for both controls
     // and we need to fit them both in the given width (height is the same)
     wxSize sizeText(size), sizeBtn(size);
     sizeBtn.x = wxSpinButton::DoGetBestSize().x;
@@ -566,7 +571,7 @@ void wxSpinCtrl::SendSpinUpdate(int value)
     event.SetEventObject(this);
     event.SetInt(value);
 
-    (void)GetEventHandler()->ProcessEvent(event);
+    (void)HandleWindowEvent(event);
 
     m_oldValue = value;
 }
@@ -638,6 +643,19 @@ void wxSpinCtrl::DoGetSize(int *x, int *y) const
         *y = ctrlrect.bottom - ctrlrect.top;
 }
 
+void wxSpinCtrl::DoGetClientSize(int *x, int *y) const
+{
+    RECT spinrect = wxGetClientRect(GetHwnd());
+    RECT textrect = wxGetClientRect(GetBuddyHwnd());
+    RECT ctrlrect;
+    UnionRect(&ctrlrect,&textrect, &spinrect);
+
+    if ( x )
+        *x = ctrlrect.right - ctrlrect.left;
+    if ( y )
+        *y = ctrlrect.bottom - ctrlrect.top;
+}
+
 void wxSpinCtrl::DoGetPosition(int *x, int *y) const
 {
     // hack: pretend that our HWND is the text control just for a moment