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