]> git.saurik.com Git - wxWidgets.git/blob - src/os2/cursor.cpp
wxT() for a Spanish(?) debug message
[wxWidgets.git] / src / os2 / cursor.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cursor.cpp
3 // Purpose: wxCursor class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/13/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 #ifndef WX_PRECOMP
16 #include <stdio.h>
17 #include "wx/setup.h"
18 #include "wx/list.h"
19 #include "wx/utils.h"
20 #include "wx/app.h"
21 #include "wx/cursor.h"
22 #include "wx/icon.h"
23 #endif
24
25 #include "wx/os2/private.h"
26
27 #include "assert.h"
28
29 #if !USE_SHARED_LIBRARIES
30 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
31 #endif
32
33 wxCursorRefData::wxCursorRefData(void)
34 {
35 m_width = 32; m_height = 32;
36 m_hCursor = 0 ;
37 m_destroyCursor = FALSE;
38 }
39
40 wxCursorRefData::~wxCursorRefData(void)
41 {
42 // if ( m_hCursor && m_destroyCursor)
43 // ::DestroyCursor((HICON) m_hCursor);
44 }
45
46 // Cursors
47 wxCursor::wxCursor(void)
48 {
49 }
50
51 wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
52 int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
53 {
54 }
55
56 wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
57 {
58 m_refData = new wxCursorRefData;
59
60 M_CURSORDATA->m_destroyCursor = FALSE;
61 M_CURSORDATA->m_hCursor = 0;
62 M_CURSORDATA->m_ok = FALSE;
63 // TODO:
64 /*
65 if (flags & wxBITMAP_TYPE_CUR_RESOURCE)
66 {
67 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadImage(wxGetInstance(), cursor_file, IMAGE_CURSOR, 0, 0, 0);
68 if (M_CURSORDATA->m_hCursor)
69 M_CURSORDATA->m_ok = TRUE;
70 else
71 M_CURSORDATA->m_ok = FALSE;
72 }
73 else if (flags & wxBITMAP_TYPE_CUR)
74 {
75 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadImage(wxGetInstance(), cursor_file, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE);
76 }
77 else if (flags & wxBITMAP_TYPE_ICO)
78 {
79 }
80 else if (flags & wxBITMAP_TYPE_BMP)
81 {
82 }
83 */
84 }
85
86 // Cursors by stock number
87 wxCursor::wxCursor(int cursor_type)
88 {
89 m_refData = new wxCursorRefData;
90 // TODO:
91 /*
92 switch (cursor_type)
93 {
94 case wxCURSOR_WAIT:
95 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_WAIT);
96 break;
97 case wxCURSOR_IBEAM:
98 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_IBEAM);
99 break;
100 case wxCURSOR_CROSS:
101 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_CROSS);
102 break;
103 case wxCURSOR_SIZENWSE:
104 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENWSE);
105 break;
106 case wxCURSOR_SIZENESW:
107 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENESW);
108 break;
109 case wxCURSOR_SIZEWE:
110 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZEWE);
111 break;
112 case wxCURSOR_SIZENS:
113 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENS);
114 break;
115 case wxCURSOR_CHAR:
116 {
117 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW);
118 break;
119 }
120 case wxCURSOR_HAND:
121 {
122 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_HAND"));
123 break;
124 }
125 case wxCURSOR_BULLSEYE:
126 {
127 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_BULLSEYE"));
128 break;
129 }
130 case wxCURSOR_PENCIL:
131 {
132 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_PENCIL"));
133 break;
134 }
135 case wxCURSOR_MAGNIFIER:
136 {
137 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_MAGNIFIER"));
138 break;
139 }
140 case wxCURSOR_NO_ENTRY:
141 {
142 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_NO_ENTRY"));
143 break;
144 }
145 case wxCURSOR_LEFT_BUTTON:
146 {
147 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW);
148 break;
149 }
150 case wxCURSOR_RIGHT_BUTTON:
151 {
152 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW);
153 break;
154 }
155 case wxCURSOR_MIDDLE_BUTTON:
156 {
157 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW);
158 break;
159 }
160 case wxCURSOR_SIZING:
161 {
162 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_SIZING"));
163 break;
164 }
165 case wxCURSOR_WATCH:
166 {
167 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_WATCH"));
168 break;
169 }
170 case wxCURSOR_SPRAYCAN:
171 {
172 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_ROLLER"));
173 break;
174 }
175 case wxCURSOR_PAINT_BRUSH:
176 {
177 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_PBRUSH"));
178 break;
179 }
180 case wxCURSOR_POINT_LEFT:
181 {
182 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_PLEFT"));
183 break;
184 }
185 case wxCURSOR_POINT_RIGHT:
186 {
187 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_PRIGHT"));
188 break;
189 }
190 case wxCURSOR_QUESTION_ARROW:
191 {
192 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_QARROW"));
193 break;
194 }
195 case wxCURSOR_BLANK:
196 {
197 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_BLANK"));
198 break;
199 }
200 default:
201 case wxCURSOR_ARROW:
202 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW);
203 break;
204 }
205 */
206 }
207
208 wxCursor::~wxCursor(void)
209 {
210 // FreeResource(TRUE);
211 }
212
213 bool wxCursor::FreeResource(bool WXUNUSED(force))
214 {
215 // if (M_CURSORDATA && M_CURSORDATA->m_hCursor && M_CURSORDATA->m_destroyCursor)
216 // {
217 // DestroyCursor((HCURSOR) M_CURSORDATA->m_hCursor);
218 // M_CURSORDATA->m_hCursor = 0;
219 // }
220 return TRUE;
221 }
222
223 void wxCursor::SetHCURSOR(WXHCURSOR cursor)
224 {
225 if ( !M_CURSORDATA )
226 m_refData = new wxCursorRefData;
227
228 M_CURSORDATA->m_hCursor = cursor;
229 }
230
231 // Global cursor setting
232 void wxSetCursor(const wxCursor& cursor)
233 {
234 extern wxCursor *g_globalCursor;
235
236 if ( cursor.Ok() && cursor.GetHCURSOR() )
237 {
238 // ::SetCursor((HCURSOR) cursor.GetHCURSOR());
239
240 if ( g_globalCursor )
241 (*g_globalCursor) = cursor;
242 }
243 }
244