]> git.saurik.com Git - wxWidgets.git/commitdiff
Added a wxIconFromBitmap "constructor" for wxIcon.
authorRobin Dunn <robin@alldunn.com>
Fri, 8 Mar 2002 23:04:56 +0000 (23:04 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 8 Mar 2002 23:04:56 +0000 (23:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14499 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/gdi.i
wxPython/src/msw/gdi.cpp
wxPython/src/msw/gdi.py

index 7544659159a201588beb8e9e1addbbd252350861..0e75af1efeadbd67b244995ab3522072f154821d 100644 (file)
@@ -234,6 +234,7 @@ public:
 // Declarations of some alternate "constructors"
 %new wxIcon* wxEmptyIcon();
 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
+%new wxIcon* wxIconFromBitmap(const wxBitmap& bmp);
 
 %{ // Implementations of some alternate "constructors"
     wxIcon* wxEmptyIcon() {
@@ -251,6 +252,12 @@ public:
         delete [] cArray;
         return icon;
     }
+
+    wxIcon* wxIconFromBitmap(const wxBitmap& bmp) {
+        wxIcon* icon = new wxIcon();
+        icon->CopyFromBitmap(bmp);
+        return icon;
+    }
 %}
 
 //---------------------------------------------------------------------------
index 1db419967172656c5b6dfa0a381f72e143f9251a..df8157be1c0cfaf0f11f813916e9177ad04397fa 100644 (file)
@@ -172,6 +172,12 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
         delete [] cArray;
         return icon;
     }
+
+    wxIcon* wxIconFromBitmap(const wxBitmap& bmp) {
+        wxIcon* icon = new wxIcon();
+        icon->CopyFromBitmap(bmp);
+        return icon;
+    }
                               // Alternate 'constructor'
     wxCursor* wxPyStockCursor(int id) {
         return new wxCursor(id);
@@ -488,6 +494,40 @@ static PyObject *_wrap_wxIconFromXPMData(PyObject *self, PyObject *args, PyObjec
     return _resultobj;
 }
 
+static PyObject *_wrap_wxIconFromBitmap(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxIcon * _result;
+    wxBitmap * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "bmp", NULL };
+    char _ptemp[128];
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIconFromBitmap",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmap_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIconFromBitmap. Expected _wxBitmap_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+        _result = (wxIcon *)wxIconFromBitmap(*_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    if (_result) {
+        SWIG_MakePtr(_ptemp, (char *) _result,"_wxIcon_p");
+        _resultobj = Py_BuildValue("s",_ptemp);
+    } else {
+        Py_INCREF(Py_None);
+        _resultobj = Py_None;
+    }
+    return _resultobj;
+}
+
 static PyObject *_wrap_wxStockCursor(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxCursor * _result;
@@ -13449,6 +13489,7 @@ static PyMethodDef gdicMethods[] = {
         { "wxMemoryDCFromDC", (PyCFunction) _wrap_wxMemoryDCFromDC, METH_VARARGS | METH_KEYWORDS },
         { "wxNamedColour", (PyCFunction) _wrap_wxNamedColour, METH_VARARGS | METH_KEYWORDS },
         { "wxStockCursor", (PyCFunction) _wrap_wxStockCursor, METH_VARARGS | METH_KEYWORDS },
+        { "wxIconFromBitmap", (PyCFunction) _wrap_wxIconFromBitmap, METH_VARARGS | METH_KEYWORDS },
         { "wxIconFromXPMData", (PyCFunction) _wrap_wxIconFromXPMData, METH_VARARGS | METH_KEYWORDS },
         { "wxEmptyIcon", (PyCFunction) _wrap_wxEmptyIcon, METH_VARARGS | METH_KEYWORDS },
         { "wxMaskColour", (PyCFunction) _wrap_wxMaskColour, METH_VARARGS | METH_KEYWORDS },
index 2b4388988aeccb33e1cd9149207ebee08835f8e5..101a9b12ce43e61f13b8384d7d607e4de824eeed 100644 (file)
@@ -1401,6 +1401,11 @@ def wxIconFromXPMData(*_args, **_kwargs):
     if val: val = wxIconPtr(val); val.thisown = 1
     return val
 
+def wxIconFromBitmap(*_args, **_kwargs):
+    val = apply(gdic.wxIconFromBitmap,_args,_kwargs)
+    if val: val = wxIconPtr(val); val.thisown = 1
+    return val
+
 def wxStockCursor(*_args, **_kwargs):
     val = apply(gdic.wxStockCursor,_args,_kwargs)
     if val: val = wxCursorPtr(val); val.thisown = 1