// declarations
// ============================================================================
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "spinctrlbase.h"
- #pragma implementation "spinctrl.h"
-#endif
-
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include <limits.h> // for INT_MIN
-#define USE_DEFERRED_SIZING 1
-#define USE_DEFER_BUG_WORKAROUND 0
-
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// 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);
}
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;
from = 0;
}
- ::SendMessage((HWND)m_hwndBuddy, EM_SETSEL, (WPARAM)from, (LPARAM)to);
+ ::SendMessage(GetBuddyHwnd(), EM_SETSEL, (WPARAM)from, (LPARAM)to);
}
// ----------------------------------------------------------------------------
wxLogDebug(_T("not enough space for wxSpinCtrl!"));
}
- // 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
-
// 1) The buddy window
- wxMoveWindowDeferred(hdwp, this, GetBuddyHwnd(),
- x, y, widthText, height);
+ DoMoveSibling(m_hwndBuddy, x, y, widthText, height);
// 2) The button window
x += widthText + MARGIN_BETWEEN;
- wxMoveWindowDeferred(hdwp, this, GetHwnd(),
- x, y, widthBtn, height);
-
- if (hdwp)
- {
- // 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;
- }
+ wxSpinButton::DoMoveWindow(x, y, widthBtn, height);
}
// get total size of the control
void wxSpinCtrl::DoGetSize(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- 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;
- }
-#endif
-
RECT spinrect, textrect, ctrlrect;
GetWindowRect(GetHwnd(), &spinrect);
GetWindowRect(GetBuddyHwnd(), &textrect);
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- 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;
- }
-#endif
-
// hack: pretend that our HWND is the text control just for a moment
WXHWND hWnd = GetHWND();
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;