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