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:
@@ -303,7 +303,17 @@ public:
|
||||
class wxCursor : public wxGDIObject
|
||||
{
|
||||
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();
|
||||
|
||||
// wxGDIImage methods
|
||||
@@ -325,17 +335,31 @@ public:
|
||||
};
|
||||
|
||||
%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) {
|
||||
return new wxCursor(id);
|
||||
}
|
||||
%}
|
||||
|
||||
%new wxCursor* wxCursorFromImage(const wxImage& image);
|
||||
%{
|
||||
wxCursor* wxCursorFromImage(const wxImage& 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);
|
||||
}
|
||||
%}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user