- // TODO:
-/*
- // before using DoGetBestSize(), have to set style to let the base class
- // know whether this is a horizontal or vertical control (we're always
- // vertical)
- style |= wxSP_VERTICAL;
- SetWindowStyle(style);
-
- // calculate the sizes: the size given is the toal size for both controls
- // and we need to fit them both in the given width (height is the same)
- wxSize sizeText(size), sizeBtn(size);
- sizeBtn.x = wxSpinButton::DoGetBestSize().x;
- if ( sizeText.x <= 0 )
+ SWP vSwp;
+
+ if (vId == -1)
+ m_windowId = NewControlId();
+ else
+ m_windowId = vId;
+ m_backgroundColour = pParent->GetBackgroundColour();
+ m_foregroundColour = pParent->GetForegroundColour();
+ SetName(rsName);
+ SetParent(pParent);
+ m_windowStyle = lStyle;
+
+ int lSstyle = 0L;
+
+ lSstyle = WS_VISIBLE |
+ WS_TABSTOP |
+ SPBS_MASTER | // We use only single field spin buttons
+ SPBS_NUMERICONLY; // We default to numeric data
+
+ if (m_windowStyle & wxCLIP_SIBLINGS )
+ lSstyle |= WS_CLIPSIBLINGS;
+
+ //
+ // If the parent is a scrolled window the controls must
+ // have this style or they will overlap the scrollbars
+ //
+ if (pParent)
+ if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
+ pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
+ lSstyle |= WS_CLIPSIBLINGS;
+
+ SPBCDATA vCtrlData;
+
+ vCtrlData.cbSize = sizeof(SPBCDATA);
+ vCtrlData.ulTextLimit = 10L;
+ vCtrlData.lLowerLimit = 0L;
+ vCtrlData.lUpperLimit = 100L;
+ vCtrlData.idMasterSpb = vId;
+ vCtrlData.pHWXCtlData = NULL;
+
+ m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent)
+ ,WC_SPINBUTTON
+ ,(PSZ)NULL
+ ,lSstyle
+ ,0L, 0L, 0L, 0L
+ ,GetWinHwnd(pParent)
+ ,HWND_TOP
+ ,(HMENU)vId
+ ,(PVOID)&vCtrlData
+ ,NULL
+ );
+ if (m_hWnd == 0)