]> git.saurik.com Git - wxWidgets.git/blob - src/os2/spinbutt.cpp
Changed order of #ifdefs to get native version on OS/2, even if
[wxWidgets.git] / src / os2 / spinbutt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinbutt.cpp
3 // Purpose: wxSpinButton
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/15/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15
16 #ifndef WX_PRECOMP
17 #include "wx/wx.h"
18 #endif
19
20 // Can't resolve reference to CreateUpDownControl in
21 // TWIN32, but could probably use normal CreateWindow instead.
22
23
24 #include "wx/spinbutt.h"
25 #include "wx/os2/private.h"
26
27 // ============================================================================
28 // implementation
29 // ============================================================================
30
31 // ----------------------------------------------------------------------------
32 // wxWin macros
33 // ----------------------------------------------------------------------------
34
35 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
36
37 bool wxSpinButton::Create(
38 wxWindow* parent
39 , wxWindowID id
40 , const wxPoint& pos
41 , const wxSize& size
42 , long style
43 , const wxString& name
44 )
45 {
46 SetName(name);
47
48 m_windowStyle = style;
49
50 SetParent(parent);
51
52 m_windowId = (id == -1) ? NewControlId() : id;
53
54 // TODO create spin button
55 return FALSE;
56 }
57
58 wxSpinButton::~wxSpinButton()
59 {
60 }
61
62 // ----------------------------------------------------------------------------
63 // size calculation
64 // ----------------------------------------------------------------------------
65
66 wxSize wxSpinButton::DoGetBestSize() const
67 {
68 // TODO:
69 /*
70 if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
71 {
72 // vertical control
73 return wxSize(GetSystemMetrics(SM_CXVSCROLL),
74 2*GetSystemMetrics(SM_CYVSCROLL));
75 }
76 else
77 {
78 // horizontal control
79 return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
80 GetSystemMetrics(SM_CYHSCROLL));
81 }
82 */
83 return wxSize(0, 0);
84 }
85
86 // ----------------------------------------------------------------------------
87 // Attributes
88 // ----------------------------------------------------------------------------
89
90 int wxSpinButton::GetValue() const
91 {
92 // TODO
93 return 0;
94 }
95
96 void wxSpinButton::SetValue(int val)
97 {
98 // TODO
99 }
100
101 void wxSpinButton::SetRange(int minVal, int maxVal)
102 {
103 // TODO
104 }
105
106 bool wxSpinButton::OS2OnScroll(int orientation, WXWORD wParam,
107 WXWORD pos, WXHWND control)
108 {
109 wxCHECK_MSG( control, FALSE, wxT("scrolling what?") )
110 // TODO:
111 /*
112 if ( wParam != SB_THUMBPOSITION )
113 {
114 // probable SB_ENDSCROLL - we don't react to it
115 return FALSE;
116 }
117
118 wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
119 event.SetPosition((short)pos); // cast is important for negative values!
120 event.SetEventObject(this);
121
122 return GetEventHandler()->ProcessEvent(event);
123 */
124 return FALSE;
125 }
126
127 bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
128 {
129 // TODO:
130 /*
131 LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
132
133 wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
134 : wxEVT_SCROLL_LINEDOWN,
135 m_windowId);
136 event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
137 event.SetEventObject(this);
138
139 bool processed = GetEventHandler()->ProcessEvent(event);
140
141 *result = event.IsAllowed() ? 0 : 1;
142
143 return processed;
144 */
145 return FALSE;
146 }
147
148 bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id)
149 {
150 // No command messages
151 return FALSE;
152 }
153