From 351cc2a737fe0df1a9a7b5146d20c68b03e3f3f1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Apr 2000 18:53:26 +0000 Subject: [PATCH] wxSpinCtrl::GetSize() should work now (thanks to Kristjan Jonsson) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/spinctrl.h | 1 + src/msw/spinctrl.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) 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