]>
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 #if !USE_SHARED_LIBRARY
36 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton
, wxControl
)
39 bool wxSpinButton::Create(
45 , const wxString
& name
50 m_windowStyle
= style
;
54 m_windowId
= (id
== -1) ? NewControlId() : id
;
56 // TODO create spin button
60 wxSpinButton::~wxSpinButton()
64 // ----------------------------------------------------------------------------
66 // ----------------------------------------------------------------------------
68 wxSize
wxSpinButton::DoGetBestSize() const
72 if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
75 return wxSize(GetSystemMetrics(SM_CXVSCROLL),
76 2*GetSystemMetrics(SM_CYVSCROLL));
81 return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
82 GetSystemMetrics(SM_CYHSCROLL));
88 // ----------------------------------------------------------------------------
90 // ----------------------------------------------------------------------------
92 int wxSpinButton::GetValue() const
98 void wxSpinButton::SetValue(int val
)
103 void wxSpinButton::SetRange(int minVal
, int maxVal
)
108 bool wxSpinButton::OS2OnScroll(int orientation
, WXWORD wParam
,
109 WXWORD pos
, WXHWND control
)
111 wxCHECK_MSG( control
, FALSE
, wxT("scrolling what?") )
114 if ( wParam != SB_THUMBPOSITION )
116 // probable SB_ENDSCROLL - we don't react to it
120 wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
121 event.SetPosition((short)pos); // cast is important for negative values!
122 event.SetEventObject(this);
124 return GetEventHandler()->ProcessEvent(event);
129 bool wxSpinButton::OS2OnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
133 LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
135 wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
136 : wxEVT_SCROLL_LINEDOWN,
138 event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
139 event.SetEventObject(this);
141 bool processed = GetEventHandler()->ProcessEvent(event);
143 *result = event.IsAllowed() ? 0 : 1;
150 bool wxSpinButton::OS2Command(WXUINT cmd
, WXWORD id
)
152 // No command messages