]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_cursor.i
PalmOS headers have ssize_t with no sign of it so we have to assume they are always...
[wxWidgets.git] / wxPython / src / _cursor.i
CommitLineData
d14a1e28
RD
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
4c42683a
RD
18
19DocStr(wxCursor,
d07d2bc9
RD
20"A cursor is a small bitmap usually used for denoting where the mouse
21pointer is, with a picture that might indicate the interpretation of a
22mouse click.
4c42683a
RD
23
24A single cursor object may be used in many windows (any subwindow
d07d2bc9
RD
25type). The wxWindows convention is to set the cursor for a window, as
26in X, rather than to set it globally as in MS Windows, although a
27global `wx.SetCursor` function is also available for use on MS Windows.
28","
29
30Stock Cursor IDs
31-----------------
32 ======================== ======================================
4c42683a
RD
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.)
d07d2bc9 60 ======================== ======================================
4c42683a
RD
61
62");
63
ab1f7d2a
RD
64MustHaveApp(wxCursor);
65
d14a1e28
RD
66class wxCursor : public wxGDIObject
67{
68public:
4c42683a 69
d14a1e28 70 %extend {
4c42683a 71 DocStr(wxCursor,
d07d2bc9 72 "Construct a Cursor from a file. Specify the type of file using
aeee37c3
RD
73wx.BITAMP_TYPE* constants, and specify the hotspot if not using a .cur
74file.","
7c1f6b54 75:see: Alternate constructors `wx.StockCursor`,`wx.CursorFromImage`");
aeee37c3 76 wxCursor(const wxString& cursorName, long type, int hotSpotX=0, int hotSpotY=0) {
4c42683a 77%#ifdef __WXGTK__
aeee37c3 78 wxImage img(cursorName, type);
35e7d669
RD
79 img.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX);
80 img.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotSpotY);
aeee37c3 81 return new wxCursor(img);
4c42683a 82%#else
aeee37c3 83 return new wxCursor(cursorName, type, hotSpotX, hotSpotY);
4c42683a 84%#endif
d14a1e28
RD
85 }
86 }
87
88 ~wxCursor();
89
4c42683a
RD
90 DocCtorStrName(
91 wxCursor(int id),
d07d2bc9 92 "Create a cursor using one of the stock cursors. Note that not all
aeee37c3 93stock cursors are available on all platforms.", "",
4c42683a
RD
94 StockCursor);
95
96
97 DocCtorStrName(
98 wxCursor(const wxImage& image),
35e7d669 99 "Constructs a cursor from a `wx.Image`. The mask (if any) will be used
7c1f6b54 100for setting the transparent portions of the cursor.",
d07d2bc9 101"
35e7d669 102In MSW the cursor is resized to 32x32.
d07d2bc9 103
35e7d669 104In GTK the cursor will be displayed at the size of the image.
d07d2bc9 105
35e7d669 106On MacOS the cursor is resized to 16x16.",
4c42683a
RD
107 CursorFromImage);
108
109
110// %extend {
111// DocStr(wxCursor,
112// "");
1b8c7ba6 113// %RenameCtor(CursorFromBits, wxCursor(PyObject* bits, int width, int height,
4c42683a 114// int hotSpotX=-1, int hotSpotY=-1,
1b8c7ba6
RD
115// PyObject* maskBits=NULL))
116// {
4c42683a
RD
117// char* bitsbuf;
118// char* maskbuf = NULL;
119// int length;
120// PyString_AsStringAndSize(bits, &bitsbuf, &length);
121// if (maskBits)
122// PyString_AsStringAndSize(maskBits, &maskbuf, &length);
123// return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
124// }
125// }
126
127
d14a1e28 128
d14a1e28 129#ifdef __WXMSW__
4c42683a
RD
130 DocDeclStr(
131 long , GetHandle(),
d07d2bc9 132 "Get the MS Windows handle for the cursor", "");
4c42683a 133
a0c956e8
RD
134 %extend {
135 DocStr(SetHandle,
d07d2bc9 136 "Set the MS Windows handle to use for the cursor", "");
a0c956e8
RD
137 void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
138 }
4c42683a 139
d14a1e28
RD
140#endif
141
4c42683a
RD
142 DocDeclStr(
143 bool , Ok(),
d07d2bc9 144 "", "");
4c42683a
RD
145
146 %pythoncode { def __nonzero__(self): return self.Ok() }
147
d14a1e28
RD
148
149#ifdef __WXMSW__
4c42683a
RD
150 DocDeclStr(
151 int , GetWidth(),
d07d2bc9 152 "", "");
4c42683a
RD
153
154 DocDeclStr(
155 int , GetHeight(),
d07d2bc9 156 "", "");
4c42683a
RD
157
158 DocDeclStr(
159 int , GetDepth(),
d07d2bc9 160 "", "");
4c42683a
RD
161
162 DocDeclStr(
163 void , SetWidth(int w),
d07d2bc9 164 "", "");
4c42683a
RD
165
166 DocDeclStr(
167 void , SetHeight(int h),
d07d2bc9 168 "", "");
4c42683a
RD
169
170 DocDeclStr(
171 void , SetDepth(int d),
d07d2bc9 172 "", "");
4c42683a
RD
173
174 DocDeclStr(
175 void , SetSize(const wxSize& size),
d07d2bc9 176 "", "");
4c42683a 177
d14a1e28
RD
178#endif
179
d14a1e28
RD
180};
181
182
183//---------------------------------------------------------------------------
184//---------------------------------------------------------------------------