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