]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed wxSpinCtrl's client size computation in wxMSW to return something sensible
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 6 Dec 2007 19:52:57 +0000 (19:52 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 6 Dec 2007 19:52:57 +0000 (19:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/spinctrl.h
src/msw/spinctrl.cpp

index 2427369e45e0f50028b5515d96c60560873e0e66..cf94fe18a3edb9407310cc93d72aa65f9748c368 100644 (file)
@@ -92,6 +92,7 @@ protected:
     virtual void DoMoveWindow(int x, int y, int width, int height);
     virtual wxSize DoGetBestSize() const;
     virtual void DoGetSize(int *width, int *height) const;
     virtual void DoMoveWindow(int x, int y, int width, int height);
     virtual wxSize DoGetBestSize() const;
     virtual void DoGetSize(int *width, int *height) const;
+    virtual void DoGetClientSize(int *x, int *y) const;
 #if wxUSE_TOOLTIPS
     virtual void DoSetToolTip( wxToolTip *tip );
 #endif // wxUSE_TOOLTIPS
 #if wxUSE_TOOLTIPS
     virtual void DoSetToolTip( wxToolTip *tip );
 #endif // wxUSE_TOOLTIPS
index ff3afaf8c803dc368122ce81e79b633a77700cb1..2a1826c45a88e543aa01c0912f4baeab5824d827 100644 (file)
@@ -643,6 +643,19 @@ void wxSpinCtrl::DoGetSize(int *x, int *y) const
         *y = ctrlrect.bottom - ctrlrect.top;
 }
 
         *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
 void wxSpinCtrl::DoGetPosition(int *x, int *y) const
 {
     // hack: pretend that our HWND is the text control just for a moment