]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_cursor.i
AddFile isn't just for wxMSW
[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 class wxCursor : public wxGDIObject
19 {
20 public:
21 %extend {
22 wxCursor(const wxString* cursorName, long flags, int hotSpotX=0, int hotSpotY=0) {
23 #ifdef __WXGTK__
24 wxCHECK_MSG(False, NULL,
25 wxT("wxCursor constructor not implemented for wxGTK, use wxStockCursor, wxCursorFromImage, or wxCursorFromBits instead."));
26 #else
27 return new wxCursor(*cursorName, flags, hotSpotX, hotSpotY);
28 #endif
29 }
30 }
31
32 ~wxCursor();
33
34 // alternate constructors
35 %name(StockCursor) wxCursor(int id);
36 %name(CursorFromImage) wxCursor(const wxImage& image);
37 %extend {
38 %name(CursorFromBits) wxCursor(PyObject* bits, int width, int height,
39 int hotSpotX=-1, int hotSpotY=-1,
40 PyObject* maskBits=0) {
41 char* bitsbuf;
42 char* maskbuf = NULL;
43 int length;
44 PyString_AsStringAndSize(bits, &bitsbuf, &length);
45 if (maskBits)
46 PyString_AsStringAndSize(maskBits, &maskbuf, &length);
47 return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
48 }
49 }
50
51 // wxGDIImage methods
52 #ifdef __WXMSW__
53 long GetHandle();
54 void SetHandle(long handle);
55 #endif
56
57 bool Ok();
58
59 #ifdef __WXMSW__
60 int GetWidth();
61 int GetHeight();
62 int GetDepth();
63 void SetWidth(int w);
64 void SetHeight(int h);
65 void SetDepth(int d);
66 void SetSize(const wxSize& size);
67 #endif
68
69 %pythoncode { def __nonzero__(self): return self.Ok() }
70 };
71
72
73 //---------------------------------------------------------------------------
74 //---------------------------------------------------------------------------