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