]>
Commit | Line | Data |
---|---|---|
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 | #if !USE_SHARED_LIBRARY | |
36 | IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) | |
37 | #endif | |
38 | ||
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 | ) | |
47 | { | |
48 | SetName(name); | |
49 | ||
50 | m_windowStyle = style; | |
51 | ||
52 | SetParent(parent); | |
53 | ||
54 | m_windowId = (id == -1) ? NewControlId() : id; | |
55 | ||
56 | // TODO create spin button | |
57 | return FALSE; | |
58 | } | |
59 | ||
60 | wxSpinButton::~wxSpinButton() | |
61 | { | |
62 | } | |
63 | ||
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 | // ---------------------------------------------------------------------------- | |
89 | // Attributes | |
90 | // ---------------------------------------------------------------------------- | |
91 | ||
92 | int wxSpinButton::GetValue() const | |
93 | { | |
94 | // TODO | |
95 | return 0; | |
96 | } | |
97 | ||
98 | void wxSpinButton::SetValue(int val) | |
99 | { | |
100 | // TODO | |
101 | } | |
102 | ||
103 | void wxSpinButton::SetRange(int minVal, int maxVal) | |
104 | { | |
105 | // TODO | |
106 | } | |
107 | ||
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); | |
140 | ||
141 | bool processed = GetEventHandler()->ProcessEvent(event); | |
142 | ||
143 | *result = event.IsAllowed() ? 0 : 1; | |
144 | ||
145 | return processed; | |
146 | */ | |
147 | return FALSE; | |
148 | } | |
149 | ||
150 | bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id) | |
151 | { | |
152 | // No command messages | |
153 | return FALSE; | |
154 | } | |
155 |