Added menu icon methods everywhere

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-08-12 17:44:11 +00:00
parent e118897acb
commit 04c883f8c9
4 changed files with 89 additions and 8 deletions

View File

@ -269,8 +269,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
# Show how to put an icon in the menu
item = wxMenuItem(menu, tPopupID1,"One")
if wxPlatform == '__WXMSW__':
item.SetBitmap(images.getSmilesBitmap())
item.SetBitmap(images.getSmilesBitmap())
menu.AppendItem(item)
menu.Append(tPopupID2, "Two")

View File

@ -11264,7 +11264,82 @@ static PyObject *_wrap_wxMenuItem_GetLabelFromText(PyObject *self, PyObject *arg
return _resultobj;
}
#define wxMenuItem_SetBitmap(_swigobj,_swigarg0) (_swigobj->SetBitmap(_swigarg0))
static PyObject *_wrap_wxMenuItem_SetBitmap(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxMenuItem * _arg0;
wxBitmap * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","bitmap", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxMenuItem_SetBitmap",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMenuItem_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMenuItem_SetBitmap. Expected _wxMenuItem_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxMenuItem_SetBitmap. Expected _wxBitmap_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxMenuItem_SetBitmap(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxMenuItem_GetBitmap(_swigobj) (_swigobj->GetBitmap())
static PyObject *_wrap_wxMenuItem_GetBitmap(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxBitmap * _result;
wxMenuItem * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMenuItem_GetBitmap",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMenuItem_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMenuItem_GetBitmap. Expected _wxMenuItem_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
const wxBitmap & _result_ref = wxMenuItem_GetBitmap(_arg0);
_result = (wxBitmap *) &_result_ref;
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxBitmap_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static PyMethodDef windowscMethods[] = {
{ "wxMenuItem_GetBitmap", (PyCFunction) _wrap_wxMenuItem_GetBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxMenuItem_SetBitmap", (PyCFunction) _wrap_wxMenuItem_SetBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxMenuItem_GetLabelFromText", (PyCFunction) _wrap_wxMenuItem_GetLabelFromText, METH_VARARGS | METH_KEYWORDS },
{ "wxMenuItem_SetAccel", (PyCFunction) _wrap_wxMenuItem_SetAccel, METH_VARARGS | METH_KEYWORDS },
{ "wxMenuItem_GetAccel", (PyCFunction) _wrap_wxMenuItem_GetAccel, METH_VARARGS | METH_KEYWORDS },

View File

@ -1098,6 +1098,13 @@ class wxMenuItemPtr(wxObjectPtr):
def SetAccel(self, *_args, **_kwargs):
val = apply(windowsc.wxMenuItem_SetAccel,(self,) + _args, _kwargs)
return val
def SetBitmap(self, *_args, **_kwargs):
val = apply(windowsc.wxMenuItem_SetBitmap,(self,) + _args, _kwargs)
return val
def GetBitmap(self, *_args, **_kwargs):
val = apply(windowsc.wxMenuItem_GetBitmap,(self,) + _args, _kwargs)
if val: val = wxBitmapPtr(val)
return val
def __repr__(self):
return "<C wxMenuItem instance at %s>" % (self.this,)
class wxMenuItem(wxMenuItemPtr):

View File

@ -827,18 +827,18 @@ public:
wxColour GetBackgroundColour();
void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap);
void SetBitmap(const wxBitmap& bmpChecked);
wxBitmap GetBitmap(bool bChecked = TRUE);
//void SetBitmap(const wxBitmap& bmpChecked);
//wxBitmap GetBitmap(bool bChecked = TRUE);
void SetMarginWidth(int nWidth);
int GetMarginWidth();
static int GetDefaultMarginWidth();
//void SetName(const wxString& strName);
//const wxString& GetName();
//void SetCheckable(bool checkable);
//bool IsCheckable();
bool IsOwnerDrawn();
void ResetOwnerDrawn();
#endif
void SetBitmap(const wxBitmap& bitmap);
const wxBitmap& GetBitmap();
};
//---------------------------------------------------------------------------