Added wxCursorFromBits.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@21087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-06-13 01:01:49 +00:00
parent fa499d55ca
commit e702e59878
2 changed files with 31 additions and 5 deletions

View File

@@ -69,6 +69,8 @@ still accepted for compatibility, but this will go away in a future
release,) SetItemMinSize can now take a wxSize (or 2-tuple) parameter, release,) SetItemMinSize can now take a wxSize (or 2-tuple) parameter,
and Spacers can be specified with a wxSize (or 2-tuple) parameter and Spacers can be specified with a wxSize (or 2-tuple) parameter
Added wxCursorFromBits.

View File

@@ -303,7 +303,17 @@ public:
class wxCursor : public wxGDIObject class wxCursor : public wxGDIObject
{ {
public: public:
wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0); %addmethods {
wxCursor(const wxString* cursorName, long flags, int hotSpotX=0, int hotSpotY=0) {
#ifdef __WXGTK__
wxCHECK_MSG(FALSE, NULL,
wxT("wxCursor constructor not implemented for wxGTK, use wxStockCursor, wxCursorFromImage, or wxCursorFromBits instead."));
#else
return new wxCursor(*cursorName, flags, hotSpotX, hotSpotY);
#endif
}
}
~wxCursor(); ~wxCursor();
// wxGDIImage methods // wxGDIImage methods
@@ -325,17 +335,31 @@ public:
}; };
%name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id); %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
%{ // Alternate 'constructor' %new wxCursor* wxCursorFromImage(const wxImage& image);
%new wxCursor* wxCursorFromBits(PyObject* bits, int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
PyObject* maskBits=0);
%{
wxCursor* wxPyStockCursor(int id) { wxCursor* wxPyStockCursor(int id) {
return new wxCursor(id); return new wxCursor(id);
} }
%}
%new wxCursor* wxCursorFromImage(const wxImage& image);
%{
wxCursor* wxCursorFromImage(const wxImage& image) { wxCursor* wxCursorFromImage(const wxImage& image) {
return new wxCursor(image); return new wxCursor(image);
} }
wxCursor* wxCursorFromBits(PyObject* bits, int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
PyObject* maskBits=0) {
char* bitsbuf;
char* maskbuf = NULL;
int length;
PyString_AsStringAndSize(bits, &bitsbuf, &length);
if (maskBits)
PyString_AsStringAndSize(maskBits, &maskbuf, &length);
return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
}
%} %}
//---------------------------------------------------------------------- //----------------------------------------------------------------------