X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e44f3caabe53f60a2335a14cf9b57187fe39b1e..3c203a185145a1aa720faf53e7f6fbebb35bce7a:/src/msw/spinctrl.cpp?ds=sidebyside diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 907fb9f882..39960aed32 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -46,6 +46,7 @@ #include // for INT_MIN #define USE_DEFERRED_SIZING 1 +#define USE_DEFER_BUG_WORKAROUND 0 // ---------------------------------------------------------------------------- // macros @@ -393,7 +394,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, // associate the text window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0); - if ( !value.IsEmpty() ) + if ( !value.empty() ) { SetValue(value); } @@ -437,7 +438,7 @@ int wxSpinCtrl::GetValue() const long n; if ( (wxSscanf(val, wxT("%lu"), &n) != 1) ) n = INT_MIN; - + if (n < m_min) n = m_min; if (n > m_max) n = m_max; @@ -572,13 +573,12 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) // if our parent had prepared a defer window handle for us, use it (unless // we are a top level window) wxWindowMSW *parent = GetParent(); - int originalX = x; #if USE_DEFERRED_SIZING HDWP hdwp = parent && !IsTopLevel() ? (HDWP)parent->m_hDWP : NULL; #else HDWP hdwp = 0; -#endif +#endif // 1) The buddy window wxMoveWindowDeferred(hdwp, this, GetBuddyHwnd(), @@ -589,35 +589,18 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) wxMoveWindowDeferred(hdwp, this, GetHwnd(), x, y, widthBtn, height); - if (hdwp) +#if USE_DEFERRED_SIZING + if (parent) { - // Store the size so we can report it accurately - wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved; - if (!extraData) - { - extraData = new wxExtraWindowData; - m_windowReserved = (void*) extraData; - } - extraData->m_pos = wxPoint(originalX, y); - extraData->m_size = wxSize(width, height); - extraData->m_deferring = true; - // hdwp must be updated as it may have been changed parent->m_hDWP = (WXHANDLE)hdwp; } +#endif } // get total size of the control void wxSpinCtrl::DoGetSize(int *x, int *y) const { - wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved; - if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP) - { - *x = extraData->m_size.x; - *y = extraData->m_size.y; - return; - } - RECT spinrect, textrect, ctrlrect; GetWindowRect(GetHwnd(), &spinrect); GetWindowRect(GetBuddyHwnd(), &textrect); @@ -631,14 +614,6 @@ void wxSpinCtrl::DoGetSize(int *x, int *y) const void wxSpinCtrl::DoGetPosition(int *x, int *y) const { - wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved; - if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP) - { - *x = extraData->m_pos.x; - *y = extraData->m_pos.y; - return; - } - // hack: pretend that our HWND is the text control just for a moment WXHWND hWnd = GetHWND(); wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;