-bool wxSpinCtrl::Create(wxWindow *parent,
- wxWindowID id,
- const wxString& value,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- int min, int max, int initial,
- const wxString& name)
-{
- // 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)
- SetWindowStyle(style | wxSP_VERTICAL);
-
- // 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;
- sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
- if ( sizeText.x <= 0 )
+bool wxSpinCtrl::Create(
+ wxWindow* pParent
+, wxWindowID vId
+, const wxString& rsValue
+, const wxPoint& rPos
+, const wxSize& rSize
+, long lStyle
+, int nMin
+, int nMax
+, int nInitial
+, const wxString& rsName
+)
+{
+ SWP vSwp;
+
+ if (vId == wxID_ANY)
+ 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;
+
+ 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)