]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/cursor.mm
made wxFFile a bit more safe: don't crash when Tell() and Length() are called on...
[wxWidgets.git] / src / cocoa / cursor.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cursor.cpp
3 // Purpose: wxCursor class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "cursor.h"
14 #endif
15
16 #include "wx/wxprec.h"
17 #ifndef WX_PRECOMP
18 #include "wx/icon.h"
19 #include "wx/cursor.h"
20 #endif //WX_PRECOMP
21
22 #if !USE_SHARED_LIBRARIES
23 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
24 #endif
25
26 wxCursorRefData::wxCursorRefData()
27 {
28 m_width = 32; m_height = 32;
29
30 /* TODO
31 m_hCursor = 0 ;
32 */
33 }
34
35 wxCursorRefData::~wxCursorRefData()
36 {
37 // TODO: destroy cursor
38 }
39
40 // Cursors
41 wxCursor::wxCursor()
42 {
43 }
44
45 wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
46 int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
47 {
48 }
49
50 wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
51 {
52 m_refData = new wxCursorRefData;
53
54 // TODO: create cursor from a file
55 }
56
57 // Cursors by stock number
58 wxCursor::wxCursor(int cursor_type)
59 {
60 m_refData = new wxCursorRefData;
61
62 /* TODO
63 switch (cursor_type)
64 {
65 case wxCURSOR_WAIT:
66 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_WAIT);
67 break;
68 case wxCURSOR_IBEAM:
69 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_IBEAM);
70 break;
71 case wxCURSOR_CROSS:
72 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_CROSS);
73 break;
74 case wxCURSOR_SIZENWSE:
75 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENWSE);
76 break;
77 case wxCURSOR_SIZENESW:
78 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENESW);
79 break;
80 case wxCURSOR_SIZEWE:
81 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZEWE);
82 break;
83 case wxCURSOR_SIZENS:
84 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENS);
85 break;
86 case wxCURSOR_CHAR:
87 {
88 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
89 break;
90 }
91 case wxCURSOR_HAND:
92 {
93 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND");
94 break;
95 }
96 case wxCURSOR_BULLSEYE:
97 {
98 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE");
99 break;
100 }
101 case wxCURSOR_PENCIL:
102 {
103 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL");
104 break;
105 }
106 case wxCURSOR_MAGNIFIER:
107 {
108 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER");
109 break;
110 }
111 case wxCURSOR_NO_ENTRY:
112 {
113 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY");
114 break;
115 }
116 case wxCURSOR_LEFT_BUTTON:
117 {
118 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
119 break;
120 }
121 case wxCURSOR_RIGHT_BUTTON:
122 {
123 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
124 break;
125 }
126 case wxCURSOR_MIDDLE_BUTTON:
127 {
128 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
129 break;
130 }
131 case wxCURSOR_SIZING:
132 {
133 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING");
134 break;
135 }
136 case wxCURSOR_WATCH:
137 {
138 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH");
139 break;
140 }
141 case wxCURSOR_SPRAYCAN:
142 {
143 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER");
144 break;
145 }
146 case wxCURSOR_PAINT_BRUSH:
147 {
148 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH");
149 break;
150 }
151 case wxCURSOR_POINT_LEFT:
152 {
153 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT");
154 break;
155 }
156 case wxCURSOR_POINT_RIGHT:
157 {
158 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT");
159 break;
160 }
161 case wxCURSOR_QUESTION_ARROW:
162 {
163 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW");
164 break;
165 }
166 case wxCURSOR_BLANK:
167 {
168 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK");
169 break;
170 }
171 default:
172 case wxCURSOR_ARROW:
173 M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
174 break;
175 }
176 */
177
178 }
179
180 wxCursor::~wxCursor()
181 {
182 }
183
184 // Global cursor setting
185 void wxSetCursor(const wxCursor& cursor)
186 {
187 // TODO (optional on platforms with no global cursor)
188 }
189
190 static int wxBusyCursorCount = 0;
191
192 // Set the cursor to the busy cursor for all windows
193 void wxBeginBusyCursor(wxCursor *cursor)
194 {
195 wxBusyCursorCount ++;
196 if (wxBusyCursorCount == 1)
197 {
198 // TODO
199 }
200 else
201 {
202 // TODO
203 }
204 }
205
206 // Restore cursor to normal
207 void wxEndBusyCursor()
208 {
209 if (wxBusyCursorCount == 0)
210 return;
211
212 wxBusyCursorCount --;
213 if (wxBusyCursorCount == 0)
214 {
215 // TODO
216 }
217 }
218
219 // TRUE if we're between the above two calls
220 bool wxIsBusy()
221 {
222 return (wxBusyCursorCount > 0);
223 }
224