]>
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 | 34 | |
0e320a79 | 35 | IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) |
0e320a79 | 36 | |
409c9842 DW |
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 | ) | |
0e320a79 DW |
45 | { |
46 | SetName(name); | |
47 | ||
48 | m_windowStyle = style; | |
49 | ||
50 | SetParent(parent); | |
51 | ||
0e320a79 DW |
52 | m_windowId = (id == -1) ? NewControlId() : id; |
53 | ||
54 | // TODO create spin button | |
55 | return FALSE; | |
56 | } | |
57 | ||
58 | wxSpinButton::~wxSpinButton() | |
59 | { | |
60 | } | |
61 | ||
409c9842 DW |
62 | // ---------------------------------------------------------------------------- |
63 | // size calculation | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
e78c4d50 | 66 | wxSize wxSpinButton::DoGetBestSize() const |
409c9842 DW |
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 | // ---------------------------------------------------------------------------- | |
0e320a79 | 87 | // Attributes |
409c9842 | 88 | // ---------------------------------------------------------------------------- |
0e320a79 DW |
89 | |
90 | int wxSpinButton::GetValue() const | |
91 | { | |
409c9842 | 92 | // TODO |
0e320a79 DW |
93 | return 0; |
94 | } | |
95 | ||
96 | void wxSpinButton::SetValue(int val) | |
97 | { | |
409c9842 | 98 | // TODO |
0e320a79 DW |
99 | } |
100 | ||
101 | void wxSpinButton::SetRange(int minVal, int maxVal) | |
102 | { | |
409c9842 | 103 | // TODO |
0e320a79 DW |
104 | } |
105 | ||
409c9842 DW |
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); | |
0e320a79 | 138 | |
409c9842 DW |
139 | bool processed = GetEventHandler()->ProcessEvent(event); |
140 | ||
141 | *result = event.IsAllowed() ? 0 : 1; | |
142 | ||
143 | return processed; | |
144 | */ | |
145 | return FALSE; | |
146 | } | |
147 | ||
04701dd9 | 148 | bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id) |
0e320a79 | 149 | { |
409c9842 DW |
150 | // No command messages |
151 | return FALSE; | |
0e320a79 DW |
152 | } |
153 |