diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 47eabec0c9..f43103affe 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -75,6 +75,7 @@ public: protected: virtual void DoMoveWindow(int x, int y, int width, int height); virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const; // the handler for wxSpinButton events void OnSpinChange(wxSpinEvent& event); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index eba7517d89..9ab077ddee 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -336,6 +336,20 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) } } +// get total size of the control +void wxSpinCtrl::DoGetSize(int *x, int *y) const +{ + RECT spinrect, textrect, ctrlrect; + GetWindowRect(GetHwnd(), &spinrect); + GetWindowRect((HWND)m_hwndBuddy, &textrect); + UnionRect(&ctrlrect,&textrect, &spinrect); + + if ( x ) + *x = ctrlrect.right - ctrlrect.left; + if ( y ) + *y = ctrlrect.bottom - ctrlrect.top; +} + #endif // __WIN95__ #endif