]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_cursor.i
reSWIGged
[wxWidgets.git] / wxPython / src / _cursor.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _cursor.i
3 // Purpose: SWIG interface for wxCursor
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7-July-1997
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18
19 DocStr(wxCursor,
20 "A cursor is a small bitmap usually used for denoting where the mouse
21 pointer is, with a picture that might indicate the interpretation of a
22 mouse click.
23
24 A single cursor object may be used in many windows (any subwindow
25 type). The wxWindows convention is to set the cursor for a window, as
26 in X, rather than to set it globally as in MS Windows, although a
27 global `wx.SetCursor` function is also available for use on MS Windows.
28 ","
29
30 Stock Cursor IDs
31 -----------------
32 ======================== ======================================
33 wx.CURSOR_ARROW A standard arrow cursor.
34 wx.CURSOR_RIGHT_ARROW A standard arrow cursor pointing to the right.
35 wx.CURSOR_BLANK Transparent cursor.
36 wx.CURSOR_BULLSEYE Bullseye cursor.
37 wx.CURSOR_CHAR Rectangular character cursor.
38 wx.CURSOR_CROSS A cross cursor.
39 wx.CURSOR_HAND A hand cursor.
40 wx.CURSOR_IBEAM An I-beam cursor (vertical line).
41 wx.CURSOR_LEFT_BUTTON Represents a mouse with the left button depressed.
42 wx.CURSOR_MAGNIFIER A magnifier icon.
43 wx.CURSOR_MIDDLE_BUTTON Represents a mouse with the middle button depressed.
44 wx.CURSOR_NO_ENTRY A no-entry sign cursor.
45 wx.CURSOR_PAINT_BRUSH A paintbrush cursor.
46 wx.CURSOR_PENCIL A pencil cursor.
47 wx.CURSOR_POINT_LEFT A cursor that points left.
48 wx.CURSOR_POINT_RIGHT A cursor that points right.
49 wx.CURSOR_QUESTION_ARROW An arrow and question mark.
50 wx.CURSOR_RIGHT_BUTTON Represents a mouse with the right button depressed.
51 wx.CURSOR_SIZENESW A sizing cursor pointing NE-SW.
52 wx.CURSOR_SIZENS A sizing cursor pointing N-S.
53 wx.CURSOR_SIZENWSE A sizing cursor pointing NW-SE.
54 wx.CURSOR_SIZEWE A sizing cursor pointing W-E.
55 wx.CURSOR_SIZING A general sizing cursor.
56 wx.CURSOR_SPRAYCAN A spraycan cursor.
57 wx.CURSOR_WAIT A wait cursor.
58 wx.CURSOR_WATCH A watch cursor.
59 wx.CURSOR_ARROWWAIT A cursor with both an arrow and an hourglass, (windows.)
60 ======================== ======================================
61
62 ");
63
64 class wxCursor : public wxGDIObject
65 {
66 public:
67
68 %extend {
69 DocStr(wxCursor,
70 "Construct a Cursor from a file. Specify the type of file using
71 wx.BITAMP_TYPE* constants, and specify the hotspot if not using a cur
72 file.
73
74 This constructor is not available on wxGTK, use ``wx.StockCursor``,
75 ``wx.CursorFromImage``, or ``wx.CursorFromBits`` instead.", "");
76 wxCursor(const wxString* cursorName, long type, int hotSpotX=0, int hotSpotY=0) {
77 %#ifdef __WXGTK__
78 wxCHECK_MSG(False, NULL,
79 wxT("wx.Cursor constructor not implemented for wxGTK, use wx.StockCursor, wx.CursorFromImage, or wx.CursorFromBits instead."));
80 %#else
81 return new wxCursor(*cursorName, type, hotSpotX, hotSpotY);
82 %#endif
83 }
84 }
85
86 ~wxCursor();
87
88 DocCtorStrName(
89 wxCursor(int id),
90 "Create a cursor using one of the stock cursors. Note that not all
91 cursors are available on all platforms.", "",
92 StockCursor);
93
94
95 DocCtorStrName(
96 wxCursor(const wxImage& image),
97 "Constructs a cursor from a wxImage. The cursor is monochrome, colors
98 with the RGB elements all greater than 127 will be foreground, colors
99 less than this background. The mask (if any) will be used as
100 transparent.",
101 "
102 In MSW the foreground will be white and the background
103 black. The cursor is resized to 32x32.
104
105 In GTK, the two most frequent colors will be used for foreground and
106 background. The cursor will be displayed at the size of the image.
107
108 On MacOS the cursor is resized to 16x16 and currently only shown as
109 black/white (mask respected).",
110 CursorFromImage);
111
112
113 // %extend {
114 // DocStr(wxCursor,
115 // "");
116 // %name(CursorFromBits) wxCursor(PyObject* bits, int width, int height,
117 // int hotSpotX=-1, int hotSpotY=-1,
118 // PyObject* maskBits=NULL) {
119 // char* bitsbuf;
120 // char* maskbuf = NULL;
121 // int length;
122 // PyString_AsStringAndSize(bits, &bitsbuf, &length);
123 // if (maskBits)
124 // PyString_AsStringAndSize(maskBits, &maskbuf, &length);
125 // return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
126 // }
127 // }
128
129
130
131 #ifdef __WXMSW__
132 DocDeclStr(
133 long , GetHandle(),
134 "Get the MS Windows handle for the cursor", "");
135
136 %extend {
137 DocStr(SetHandle,
138 "Set the MS Windows handle to use for the cursor", "");
139 void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
140 }
141
142 #endif
143
144 DocDeclStr(
145 bool , Ok(),
146 "", "");
147
148 %pythoncode { def __nonzero__(self): return self.Ok() }
149
150
151 #ifdef __WXMSW__
152 DocDeclStr(
153 int , GetWidth(),
154 "", "");
155
156 DocDeclStr(
157 int , GetHeight(),
158 "", "");
159
160 DocDeclStr(
161 int , GetDepth(),
162 "", "");
163
164 DocDeclStr(
165 void , SetWidth(int w),
166 "", "");
167
168 DocDeclStr(
169 void , SetHeight(int h),
170 "", "");
171
172 DocDeclStr(
173 void , SetDepth(int d),
174 "", "");
175
176 DocDeclStr(
177 void , SetSize(const wxSize& size),
178 "", "");
179
180 #endif
181
182 };
183
184
185 //---------------------------------------------------------------------------
186 //---------------------------------------------------------------------------