]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/spinbutt.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButton
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
20 // Can't resolve reference to CreateUpDownControl in
21 // TWIN32, but could probably use normal CreateWindow instead.
24 #include "wx/spinbutt.h"
25 #include "wx/os2/private.h"
27 // ============================================================================
29 // ============================================================================
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
37 bool wxSpinButton::Create(
43 , const wxString
& name
48 m_windowStyle
= style
;
52 m_windowId
= (id
== -1) ? NewControlId() : id
;
54 // TODO create spin button
58 wxSpinButton::~wxSpinButton()
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
66 wxSize
wxSpinButton::DoGetBestSize() const
70 if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
73 return wxSize(GetSystemMetrics(SM_CXVSCROLL),
74 2*GetSystemMetrics(SM_CYVSCROLL));
79 return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
80 GetSystemMetrics(SM_CYHSCROLL));
86 // ----------------------------------------------------------------------------
88 // ----------------------------------------------------------------------------
90 int wxSpinButton::GetValue() const
96 void wxSpinButton::SetValue(int val
)
101 void wxSpinButton::SetRange(int minVal
, int maxVal
)
106 bool wxSpinButton::OS2OnScroll(int orientation
, WXWORD wParam
,
107 WXWORD pos
, WXHWND control
)
109 wxCHECK_MSG( control
, FALSE
, wxT("scrolling what?") )
112 if ( wParam != SB_THUMBPOSITION )
114 // probable SB_ENDSCROLL - we don't react to it
118 wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
119 event.SetPosition((short)pos); // cast is important for negative values!
120 event.SetEventObject(this);
122 return GetEventHandler()->ProcessEvent(event);
127 bool wxSpinButton::OS2OnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
131 LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
133 wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
134 : wxEVT_SCROLL_LINEDOWN,
136 event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
137 event.SetEventObject(this);
139 bool processed = GetEventHandler()->ProcessEvent(event);
141 *result = event.IsAllowed() ? 0 : 1;
148 bool wxSpinButton::OS2Command(WXUINT cmd
, WXWORD id
)
150 // No command messages