A saner implementation for the new wxToolBar methods that keeps

backwards compatilibilty (including keyword args names for wxPython)
and still exposes the new stuff.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14887 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-04-01 20:29:35 +00:00
parent 342639eb74
commit 15030c51b8
5 changed files with 288 additions and 456 deletions

View File

@ -51,11 +51,10 @@ UNICODE!
MSLU, (Microsoft Layer for Unicode). It simply gets out of the MSLU, (Microsoft Layer for Unicode). It simply gets out of the
way if the app is run on an NT box, or if run on a win9x box it way if the app is run on an NT box, or if run on a win9x box it
loads a special DLL that provides the unicode versions of the loads a special DLL that provides the unicode versions of the
windows API. So far I have not been able to get this to work on windows API. So far I have not been able to get this to work
win9x with the stock python.exe and pythonw.exe executables. perfectly on win9x. Most things work fine but wxTaskBarIcon for
Instead I've had to rebuild the Python loaders linked with this example will cause a crash if used with the unicode build on
MSLU library from Microsoft. I'd like to find a way to build win95.
wxWindows/wxPython such that this is not needed...
So how do you use it? It's very simple. When unicode is enabled, So how do you use it? It's very simple. When unicode is enabled,
then all functions and methods in wxPython that return a wxString then all functions and methods in wxPython that return a wxString
@ -70,10 +69,6 @@ UNICODE!
method. method.
Bad news: The API for adding tools to toolbars has changed again.
Good news: Toolbar tools can now have labels!
2.3.2.1 2.3.2.1

View File

@ -23,26 +23,26 @@ class TestToolBar(wxFrame):
self.CreateStatusBar() self.CreateStatusBar()
tb.AddSimpleTool(10, '', images.getNewBitmap(), "New", "Long help for 'New'") tb.AddSimpleTool(10, images.getNewBitmap(), "New", "Long help for 'New'")
EVT_TOOL(self, 10, self.OnToolClick) EVT_TOOL(self, 10, self.OnToolClick)
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick) EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
tb.AddSimpleTool(20, '', images.getOpenBitmap(), "Open", "Long help for 'Open'") tb.AddSimpleTool(20, images.getOpenBitmap(), "Open", "Long help for 'Open'")
EVT_TOOL(self, 20, self.OnToolClick) EVT_TOOL(self, 20, self.OnToolClick)
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick) EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
tb.AddSeparator() tb.AddSeparator()
tb.AddSimpleTool(30, '', images.getCopyBitmap(), "Copy", "Long help for 'Copy'") tb.AddSimpleTool(30, images.getCopyBitmap(), "Copy", "Long help for 'Copy'")
EVT_TOOL(self, 30, self.OnToolClick) EVT_TOOL(self, 30, self.OnToolClick)
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick) EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
tb.AddSimpleTool(40, '', images.getPasteBitmap(), "Paste", "Long help for 'Paste'") tb.AddSimpleTool(40, images.getPasteBitmap(), "Paste", "Long help for 'Paste'")
EVT_TOOL(self, 40, self.OnToolClick) EVT_TOOL(self, 40, self.OnToolClick)
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick) EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
tb.AddSeparator() tb.AddSeparator()
tool = tb.AddCheckTool(50, '', images.getTog1Bitmap(), tool = tb.AddCheckTool(50, images.getTog1Bitmap(),
shortHelp="Toggle this") shortHelp="Toggle this")
EVT_TOOL(self, 50, self.OnToolClick) EVT_TOOL(self, 50, self.OnToolClick)

View File

@ -1561,21 +1561,21 @@ static void *SwigwxToolBarBaseTowxObject(void *ptr) {
return (void *) dest; return (void *) dest;
} }
static wxToolBarToolBase * wxToolBarBase_AddTool(wxToolBarBase *self,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,wxItemKind kind,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) { static wxToolBarToolBase * wxToolBarBase_DoAddTool(wxToolBarBase *self,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,wxItemKind kind,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) {
wxPyUserData* udata = NULL; wxPyUserData* udata = NULL;
if (clientData) if (clientData && clientData != Py_None)
udata = new wxPyUserData(clientData); udata = new wxPyUserData(clientData);
return self->AddTool(id, label, bitmap, bmpDisabled, kind, return self->AddTool(id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, udata); shortHelp, longHelp, udata);
} }
static PyObject *_wrap_wxToolBarBase_AddTool(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxToolBarBase_DoAddTool(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxToolBarToolBase * _result; wxToolBarToolBase * _result;
wxToolBarBase * _arg0; wxToolBarBase * _arg0;
int _arg1; int _arg1;
wxString * _arg2; wxString * _arg2;
wxBitmap * _arg3; wxBitmap * _arg3;
wxBitmap * _arg4; wxBitmap * _arg4 = (wxBitmap *) &wxNullBitmap;
wxItemKind _arg5 = (wxItemKind ) wxITEM_NORMAL; wxItemKind _arg5 = (wxItemKind ) wxITEM_NORMAL;
wxString * _arg6 = (wxString *) &wxPyEmptyString; wxString * _arg6 = (wxString *) &wxPyEmptyString;
wxString * _arg7 = (wxString *) &wxPyEmptyString; wxString * _arg7 = (wxString *) &wxPyEmptyString;
@ -1590,12 +1590,12 @@ static PyObject *_wrap_wxToolBarBase_AddTool(PyObject *self, PyObject *args, PyO
char *_kwnames[] = { "self","id","label","bitmap","bmpDisabled","kind","shortHelp","longHelp","clientData", NULL }; char *_kwnames[] = { "self","id","label","bitmap","bmpDisabled","kind","shortHelp","longHelp","clientData", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOOO|iOOO:wxToolBarBase_AddTool",_kwnames,&_argo0,&_arg1,&_obj2,&_argo3,&_argo4,&_arg5,&_obj6,&_obj7,&_obj8)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOO|OiOOO:wxToolBarBase_DoAddTool",_kwnames,&_argo0,&_arg1,&_obj2,&_argo3,&_argo4,&_arg5,&_obj6,&_obj7,&_obj8))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) { else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_AddTool. Expected _wxToolBarBase_p."); PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_DoAddTool. Expected _wxToolBarBase_p.");
return NULL; return NULL;
} }
} }
@ -1607,14 +1607,14 @@ static PyObject *_wrap_wxToolBarBase_AddTool(PyObject *self, PyObject *args, PyO
if (_argo3) { if (_argo3) {
if (_argo3 == Py_None) { _arg3 = NULL; } if (_argo3 == Py_None) { _arg3 = NULL; }
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBitmap_p")) { else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxToolBarBase_AddTool. Expected _wxBitmap_p."); PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxToolBarBase_DoAddTool. Expected _wxBitmap_p.");
return NULL; return NULL;
} }
} }
if (_argo4) { if (_argo4) {
if (_argo4 == Py_None) { _arg4 = NULL; } if (_argo4 == Py_None) { _arg4 = NULL; }
else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxBitmap_p")) { else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxToolBarBase_AddTool. Expected _wxBitmap_p."); PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxToolBarBase_DoAddTool. Expected _wxBitmap_p.");
return NULL; return NULL;
} }
} }
@ -1636,7 +1636,7 @@ static PyObject *_wrap_wxToolBarBase_AddTool(PyObject *self, PyObject *args, PyO
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxToolBarToolBase *)wxToolBarBase_AddTool(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5,*_arg6,*_arg7,_arg8); _result = (wxToolBarToolBase *)wxToolBarBase_DoAddTool(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5,*_arg6,*_arg7,_arg8);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
@ -1656,274 +1656,9 @@ static PyObject *_wrap_wxToolBarBase_AddTool(PyObject *self, PyObject *args, PyO
return _resultobj; return _resultobj;
} }
static wxToolBarToolBase * wxToolBarBase_AddSimpleTool(wxToolBarBase *self,int id,const wxString & label,const wxBitmap & bitmap,const wxString & shortHelp,const wxString & longHelp,wxItemKind kind) {
return self->AddTool(id, label, bitmap, wxNullBitmap, kind,
shortHelp, longHelp, NULL);
}
static PyObject *_wrap_wxToolBarBase_AddSimpleTool(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxToolBarToolBase * _result;
wxToolBarBase * _arg0;
int _arg1;
wxString * _arg2;
wxBitmap * _arg3;
wxString * _arg4 = (wxString *) &wxPyEmptyString;
wxString * _arg5 = (wxString *) &wxPyEmptyString;
wxItemKind _arg6 = (wxItemKind ) wxITEM_NORMAL;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
PyObject * _argo3 = 0;
PyObject * _obj4 = 0;
PyObject * _obj5 = 0;
char *_kwnames[] = { "self","id","label","bitmap","shortHelp","longHelp","kind", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOO|OOi:wxToolBarBase_AddSimpleTool",_kwnames,&_argo0,&_arg1,&_obj2,&_argo3,&_obj4,&_obj5,&_arg6))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_AddSimpleTool. Expected _wxToolBarBase_p.");
return NULL;
}
}
{
_arg2 = wxString_in_helper(_obj2);
if (_arg2 == NULL)
return NULL;
}
if (_argo3) {
if (_argo3 == Py_None) { _arg3 = NULL; }
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxToolBarBase_AddSimpleTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_obj4)
{
_arg4 = wxString_in_helper(_obj4);
if (_arg4 == NULL)
return NULL;
}
if (_obj5)
{
_arg5 = wxString_in_helper(_obj5);
if (_arg5 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxToolBarToolBase *)wxToolBarBase_AddSimpleTool(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
}{ _resultobj = wxPyMake_wxObject(_result); }
{
if (_obj2)
delete _arg2;
}
{
if (_obj4)
delete _arg4;
}
{
if (_obj5)
delete _arg5;
}
return _resultobj;
}
static wxToolBarToolBase * wxToolBarBase_AddCheckTool(wxToolBarBase *self,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) {
wxPyUserData* udata = NULL;
if (clientData)
udata = new wxPyUserData(clientData);
return self->AddCheckTool(id, label, bitmap, bmpDisabled,
shortHelp, longHelp, udata);
}
static PyObject *_wrap_wxToolBarBase_AddCheckTool(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxToolBarToolBase * _result;
wxToolBarBase * _arg0;
int _arg1;
wxString * _arg2;
wxBitmap * _arg3;
wxBitmap * _arg4 = (wxBitmap *) &wxNullBitmap;
wxString * _arg5 = (wxString *) &wxPyEmptyString;
wxString * _arg6 = (wxString *) &wxPyEmptyString;
PyObject * _arg7 = (PyObject *) NULL;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
PyObject * _argo3 = 0;
PyObject * _argo4 = 0;
PyObject * _obj5 = 0;
PyObject * _obj6 = 0;
PyObject * _obj7 = 0;
char *_kwnames[] = { "self","id","label","bitmap","bmpDisabled","shortHelp","longHelp","clientData", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOO|OOOO:wxToolBarBase_AddCheckTool",_kwnames,&_argo0,&_arg1,&_obj2,&_argo3,&_argo4,&_obj5,&_obj6,&_obj7))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_AddCheckTool. Expected _wxToolBarBase_p.");
return NULL;
}
}
{
_arg2 = wxString_in_helper(_obj2);
if (_arg2 == NULL)
return NULL;
}
if (_argo3) {
if (_argo3 == Py_None) { _arg3 = NULL; }
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxToolBarBase_AddCheckTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_argo4) {
if (_argo4 == Py_None) { _arg4 = NULL; }
else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxToolBarBase_AddCheckTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_obj5)
{
_arg5 = wxString_in_helper(_obj5);
if (_arg5 == NULL)
return NULL;
}
if (_obj6)
{
_arg6 = wxString_in_helper(_obj6);
if (_arg6 == NULL)
return NULL;
}
if (_obj7)
{
_arg7 = _obj7;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxToolBarToolBase *)wxToolBarBase_AddCheckTool(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,*_arg6,_arg7);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
}{ _resultobj = wxPyMake_wxObject(_result); }
{
if (_obj2)
delete _arg2;
}
{
if (_obj5)
delete _arg5;
}
{
if (_obj6)
delete _arg6;
}
return _resultobj;
}
static wxToolBarToolBase * wxToolBarBase_AddRadioTool(wxToolBarBase *self,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) {
wxPyUserData* udata = NULL;
if (clientData)
udata = new wxPyUserData(clientData);
return self->AddRadioTool(id, label, bitmap, bmpDisabled,
shortHelp, longHelp, udata);
}
static PyObject *_wrap_wxToolBarBase_AddRadioTool(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxToolBarToolBase * _result;
wxToolBarBase * _arg0;
int _arg1;
wxString * _arg2;
wxBitmap * _arg3;
wxBitmap * _arg4 = (wxBitmap *) &wxNullBitmap;
wxString * _arg5 = (wxString *) &wxPyEmptyString;
wxString * _arg6 = (wxString *) &wxPyEmptyString;
PyObject * _arg7 = (PyObject *) NULL;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
PyObject * _argo3 = 0;
PyObject * _argo4 = 0;
PyObject * _obj5 = 0;
PyObject * _obj6 = 0;
PyObject * _obj7 = 0;
char *_kwnames[] = { "self","id","label","bitmap","bmpDisabled","shortHelp","longHelp","clientData", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOO|OOOO:wxToolBarBase_AddRadioTool",_kwnames,&_argo0,&_arg1,&_obj2,&_argo3,&_argo4,&_obj5,&_obj6,&_obj7))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_AddRadioTool. Expected _wxToolBarBase_p.");
return NULL;
}
}
{
_arg2 = wxString_in_helper(_obj2);
if (_arg2 == NULL)
return NULL;
}
if (_argo3) {
if (_argo3 == Py_None) { _arg3 = NULL; }
else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxToolBarBase_AddRadioTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_argo4) {
if (_argo4 == Py_None) { _arg4 = NULL; }
else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxToolBarBase_AddRadioTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_obj5)
{
_arg5 = wxString_in_helper(_obj5);
if (_arg5 == NULL)
return NULL;
}
if (_obj6)
{
_arg6 = wxString_in_helper(_obj6);
if (_arg6 == NULL)
return NULL;
}
if (_obj7)
{
_arg7 = _obj7;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxToolBarToolBase *)wxToolBarBase_AddRadioTool(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,*_arg6,_arg7);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
}{ _resultobj = wxPyMake_wxObject(_result); }
{
if (_obj2)
delete _arg2;
}
{
if (_obj5)
delete _arg5;
}
{
if (_obj6)
delete _arg6;
}
return _resultobj;
}
static wxToolBarToolBase * wxToolBarBase_InsertTool(wxToolBarBase *self,size_t pos,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,wxItemKind kind,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) { static wxToolBarToolBase * wxToolBarBase_InsertTool(wxToolBarBase *self,size_t pos,int id,const wxString & label,const wxBitmap & bitmap,const wxBitmap & bmpDisabled,wxItemKind kind,const wxString & shortHelp,const wxString & longHelp,PyObject * clientData) {
wxPyUserData* udata = NULL; wxPyUserData* udata = NULL;
if (clientData) if (clientData && clientData != Py_None)
udata = new wxPyUserData(clientData); udata = new wxPyUserData(clientData);
return self->InsertTool(pos, id, label, bitmap, bmpDisabled, kind, return self->InsertTool(pos, id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, udata); shortHelp, longHelp, udata);
@ -2017,84 +1752,6 @@ static PyObject *_wrap_wxToolBarBase_InsertTool(PyObject *self, PyObject *args,
return _resultobj; return _resultobj;
} }
static wxToolBarToolBase * wxToolBarBase_InsertSimpleTool(wxToolBarBase *self,size_t pos,int id,const wxString & label,const wxBitmap & bitmap,wxItemKind kind,const wxString & shortHelp,const wxString & longHelp) {
return self->InsertTool(pos, id, label, bitmap, wxNullBitmap, kind,
shortHelp, longHelp);
}
static PyObject *_wrap_wxToolBarBase_InsertSimpleTool(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxToolBarToolBase * _result;
wxToolBarBase * _arg0;
size_t _arg1;
int _arg2;
wxString * _arg3;
wxBitmap * _arg4;
wxItemKind _arg5 = (wxItemKind ) wxITEM_NORMAL;
wxString * _arg6 = (wxString *) &wxPyEmptyString;
wxString * _arg7 = (wxString *) &wxPyEmptyString;
PyObject * _argo0 = 0;
PyObject * _obj3 = 0;
PyObject * _argo4 = 0;
PyObject * _obj6 = 0;
PyObject * _obj7 = 0;
char *_kwnames[] = { "self","pos","id","label","bitmap","kind","shortHelp","longHelp", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOO|iOO:wxToolBarBase_InsertSimpleTool",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_argo4,&_arg5,&_obj6,&_obj7))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxToolBarBase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxToolBarBase_InsertSimpleTool. Expected _wxToolBarBase_p.");
return NULL;
}
}
{
_arg3 = wxString_in_helper(_obj3);
if (_arg3 == NULL)
return NULL;
}
if (_argo4) {
if (_argo4 == Py_None) { _arg4 = NULL; }
else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxToolBarBase_InsertSimpleTool. Expected _wxBitmap_p.");
return NULL;
}
}
if (_obj6)
{
_arg6 = wxString_in_helper(_obj6);
if (_arg6 == NULL)
return NULL;
}
if (_obj7)
{
_arg7 = wxString_in_helper(_obj7);
if (_arg7 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxToolBarToolBase *)wxToolBarBase_InsertSimpleTool(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,*_arg6,*_arg7);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
}{ _resultobj = wxPyMake_wxObject(_result); }
{
if (_obj3)
delete _arg3;
}
{
if (_obj6)
delete _arg6;
}
{
if (_obj7)
delete _arg7;
}
return _resultobj;
}
#define wxToolBarBase_AddControl(_swigobj,_swigarg0) (_swigobj->AddControl(_swigarg0)) #define wxToolBarBase_AddControl(_swigobj,_swigarg0) (_swigobj->AddControl(_swigarg0))
static PyObject *_wrap_wxToolBarBase_AddControl(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxToolBarBase_AddControl(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
@ -3775,12 +3432,8 @@ static PyMethodDef stattoolcMethods[] = {
{ "wxToolBarBase_AddSeparator", (PyCFunction) _wrap_wxToolBarBase_AddSeparator, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarBase_AddSeparator", (PyCFunction) _wrap_wxToolBarBase_AddSeparator, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_InsertControl", (PyCFunction) _wrap_wxToolBarBase_InsertControl, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarBase_InsertControl", (PyCFunction) _wrap_wxToolBarBase_InsertControl, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_AddControl", (PyCFunction) _wrap_wxToolBarBase_AddControl, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarBase_AddControl", (PyCFunction) _wrap_wxToolBarBase_AddControl, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_InsertSimpleTool", (PyCFunction) _wrap_wxToolBarBase_InsertSimpleTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_InsertTool", (PyCFunction) _wrap_wxToolBarBase_InsertTool, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarBase_InsertTool", (PyCFunction) _wrap_wxToolBarBase_InsertTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_AddRadioTool", (PyCFunction) _wrap_wxToolBarBase_AddRadioTool, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarBase_DoAddTool", (PyCFunction) _wrap_wxToolBarBase_DoAddTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_AddCheckTool", (PyCFunction) _wrap_wxToolBarBase_AddCheckTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_AddSimpleTool", (PyCFunction) _wrap_wxToolBarBase_AddSimpleTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarBase_AddTool", (PyCFunction) _wrap_wxToolBarBase_AddTool, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarToolBase_SetClientData", (PyCFunction) _wrap_wxToolBarToolBase_SetClientData, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarToolBase_SetClientData", (PyCFunction) _wrap_wxToolBarToolBase_SetClientData, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarToolBase_GetClientData", (PyCFunction) _wrap_wxToolBarToolBase_GetClientData, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarToolBase_GetClientData", (PyCFunction) _wrap_wxToolBarToolBase_GetClientData, METH_VARARGS | METH_KEYWORDS },
{ "wxToolBarToolBase_Attach", (PyCFunction) _wrap_wxToolBarToolBase_Attach, METH_VARARGS | METH_KEYWORDS }, { "wxToolBarToolBase_Attach", (PyCFunction) _wrap_wxToolBarToolBase_Attach, METH_VARARGS | METH_KEYWORDS },

View File

@ -13,6 +13,7 @@ from controls import *
from events import * from events import *
import wx import wx
wxITEM_NORMAL = 0 # predeclare this since wx isn't fully imported yet
class wxStatusBarPtr(wxWindowPtr): class wxStatusBarPtr(wxWindowPtr):
def __init__(self,this): def __init__(self,this):
self.this = this self.this = this
@ -181,24 +182,12 @@ class wxToolBarBasePtr(wxControlPtr):
def __init__(self,this): def __init__(self,this):
self.this = this self.this = this
self.thisown = 0 self.thisown = 0
def AddTool(self, *_args, **_kwargs): def DoAddTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_AddTool,(self,) + _args, _kwargs) val = apply(stattoolc.wxToolBarBase_DoAddTool,(self,) + _args, _kwargs)
return val
def AddSimpleTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_AddSimpleTool,(self,) + _args, _kwargs)
return val
def AddCheckTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_AddCheckTool,(self,) + _args, _kwargs)
return val
def AddRadioTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_AddRadioTool,(self,) + _args, _kwargs)
return val return val
def InsertTool(self, *_args, **_kwargs): def InsertTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_InsertTool,(self,) + _args, _kwargs) val = apply(stattoolc.wxToolBarBase_InsertTool,(self,) + _args, _kwargs)
return val return val
def InsertSimpleTool(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_InsertSimpleTool,(self,) + _args, _kwargs)
return val
def AddControl(self, *_args, **_kwargs): def AddControl(self, *_args, **_kwargs):
val = apply(stattoolc.wxToolBarBase_AddControl,(self,) + _args, _kwargs) val = apply(stattoolc.wxToolBarBase_AddControl,(self,) + _args, _kwargs)
return val return val
@ -316,6 +305,130 @@ class wxToolBarBasePtr(wxControlPtr):
return val return val
def __repr__(self): def __repr__(self):
return "<C wxToolBarBase instance at %s>" % (self.this,) return "<C wxToolBarBase instance at %s>" % (self.this,)
# These match the original Add methods for this class, kept for
# backwards compatibility with versions < 2.3.3.
def AddTool(self, id, bitmap,
pushedBitmap = wxNullBitmap,
isToggle = 0,
clientData = None,
shortHelpString = '',
longHelpString = '') :
'''Old style method to add a tool to the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoAddTool(id, '', bitmap, pushedBitmap, kind,
shortHelpString, longHelpString, clientData)
def AddSimpleTool(self, id, bitmap,
shortHelpString = '',
longHelpString = '',
isToggle = 0):
'''Old style method to add a tool to the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoAddTool(id, '', bitmap, wxNullBitmap, kind,
shortHelpString, longHelpString, None)
def InsertTool(self, pos, id, bitmap,
pushedBitmap = wxNullBitmap,
isToggle = 0,
clientData = None,
shortHelpString = '',
longHelpString = ''):
'''Old style method to insert a tool in the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoInsertTool(pos, id, '', bitmap, pushedBitmap, kind,
shortHelpString, longHelpString, clientData)
def InsertSimpleTool(self, pos, id, bitmap,
shortHelpString = '',
longHelpString = '',
isToggle = 0):
'''Old style method to insert a tool in the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoInsertTool(pos, id, '', bitmap, wxNullBitmap, kind,
shortHelpString, longHelpString, None)
# The following are the new toolbar Add methods starting with
# 2.3.3. They are renamed to have 'Label' in the name so as to be
# able to keep backwards compatibility with using the above
# methods. Eventually these should migrate to be the methods used
# primarily and loose the 'Label' in the name...
def AddLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
kind = wxITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None):
'''
The full AddTool() function.
If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
is created and used as the disabled image.
'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, clientData)
def InsertLabelTool(self, pos, id, label, bitmap,
bmpDisabled = wxNullBitmap,
kind = wxITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None):
'''
Insert the new tool at the given position, if pos == GetToolsCount(), it
is equivalent to AddTool()
'''
return self.DoInsertTool(pos, id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, clientData)
def AddCheckLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''Add a check tool, i.e. a tool which can be toggled'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, wx.wxITEM_CHECK,
shortHelp, longHelp, clientData)
def AddRadioLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''
Add a radio tool, i.e. a tool which can be toggled and releases any
other toggled radio tools in the same group when it happens
'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, wx.wxITEM_RADIO,
shortHelp, longHelp, clientData)
# For consistency with the backwards compatible methods above, here are
# some non-'Label' versions of the Check and Radio methods
def AddCheckTool(self, id, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''Add a check tool, i.e. a tool which can be toggled'''
return self.DoAddTool(id, '', bitmap, bmpDisabled, wx.wxITEM_CHECK,
shortHelp, longHelp, clientData)
def AddRadioTool(self, id, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''
Add a radio tool, i.e. a tool which can be toggled and releases any
other toggled radio tools in the same group when it happens
'''
return self.DoAddTool(id, '', bitmap, bmpDisabled, wx.wxITEM_RADIO,
shortHelp, longHelp, clientData)
class wxToolBarBase(wxToolBarBasePtr): class wxToolBarBase(wxToolBarBasePtr):
def __init__(self,this): def __init__(self,this):
self.this = this self.this = this

View File

@ -31,7 +31,7 @@
%import controls.i %import controls.i
%pragma(python) code = "import wx" %pragma(python) code = "import wx"
%pragma(python) code = "wxITEM_NORMAL = 0 # predeclare this since wx isn't fully imported yet"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -169,73 +169,30 @@ public:
%addmethods { %addmethods {
// the full AddTool() function // The full AddTool() function. Call it DoAddTool in wxPython and
// implement the other Add methods by calling it.
// //
// If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
// is created and used as the disabled image. // is created and used as the disabled image.
wxToolBarToolBase *AddTool(int id, wxToolBarToolBase *DoAddTool(int id,
const wxString& label, const wxString& label,
const wxBitmap& bitmap, const wxBitmap& bitmap,
const wxBitmap& bmpDisabled, const wxBitmap& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL, wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxPyEmptyString, const wxString& shortHelp = wxPyEmptyString,
const wxString& longHelp = wxPyEmptyString, const wxString& longHelp = wxPyEmptyString,
PyObject *clientData = NULL) PyObject *clientData = NULL)
{ {
wxPyUserData* udata = NULL; wxPyUserData* udata = NULL;
if (clientData) if (clientData && clientData != Py_None)
udata = new wxPyUserData(clientData); udata = new wxPyUserData(clientData);
return self->AddTool(id, label, bitmap, bmpDisabled, kind, return self->AddTool(id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, udata); shortHelp, longHelp, udata);
} }
// The most common version of AddTool
wxToolBarToolBase *AddSimpleTool(int id,
const wxString& label,
const wxBitmap& bitmap,
const wxString& shortHelp = wxPyEmptyString,
const wxString& longHelp = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
return self->AddTool(id, label, bitmap, wxNullBitmap, kind,
shortHelp, longHelp, NULL);
}
// add a check tool, i.e. a tool which can be toggled // Insert the new tool at the given position, if pos == GetToolsCount(), it
wxToolBarToolBase *AddCheckTool(int id, // is equivalent to DoAddTool()
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxPyEmptyString,
const wxString& longHelp = wxPyEmptyString,
PyObject *clientData = NULL)
{
wxPyUserData* udata = NULL;
if (clientData)
udata = new wxPyUserData(clientData);
return self->AddCheckTool(id, label, bitmap, bmpDisabled,
shortHelp, longHelp, udata);
}
// add a radio tool, i.e. a tool which can be toggled and releases any
// other toggled radio tools in the same group when it happens
wxToolBarToolBase *AddRadioTool(int id,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxPyEmptyString,
const wxString& longHelp = wxPyEmptyString,
PyObject *clientData = NULL)
{
wxPyUserData* udata = NULL;
if (clientData)
udata = new wxPyUserData(clientData);
return self->AddRadioTool(id, label, bitmap, bmpDisabled,
shortHelp, longHelp, udata);
}
// insert the new tool at the given position, if pos == GetToolsCount(), it
// is equivalent to AddTool()
wxToolBarToolBase *InsertTool(size_t pos, wxToolBarToolBase *InsertTool(size_t pos,
int id, int id,
const wxString& label, const wxString& label,
@ -247,27 +204,141 @@ public:
PyObject *clientData = NULL) PyObject *clientData = NULL)
{ {
wxPyUserData* udata = NULL; wxPyUserData* udata = NULL;
if (clientData) if (clientData && clientData != Py_None)
udata = new wxPyUserData(clientData); udata = new wxPyUserData(clientData);
return self->InsertTool(pos, id, label, bitmap, bmpDisabled, kind, return self->InsertTool(pos, id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, udata); shortHelp, longHelp, udata);
} }
// A simpler InsertTool
wxToolBarToolBase *InsertSimpleTool(size_t pos,
int id,
const wxString& label,
const wxBitmap& bitmap,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxPyEmptyString,
const wxString& longHelp = wxPyEmptyString)
{
return self->InsertTool(pos, id, label, bitmap, wxNullBitmap, kind,
shortHelp, longHelp);
}
} }
%pragma(python) addtoclass = "
# These match the original Add methods for this class, kept for
# backwards compatibility with versions < 2.3.3.
def AddTool(self, id, bitmap,
pushedBitmap = wxNullBitmap,
isToggle = 0,
clientData = None,
shortHelpString = '',
longHelpString = '') :
'''Old style method to add a tool to the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoAddTool(id, '', bitmap, pushedBitmap, kind,
shortHelpString, longHelpString, clientData)
def AddSimpleTool(self, id, bitmap,
shortHelpString = '',
longHelpString = '',
isToggle = 0):
'''Old style method to add a tool to the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoAddTool(id, '', bitmap, wxNullBitmap, kind,
shortHelpString, longHelpString, None)
def InsertTool(self, pos, id, bitmap,
pushedBitmap = wxNullBitmap,
isToggle = 0,
clientData = None,
shortHelpString = '',
longHelpString = ''):
'''Old style method to insert a tool in the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoInsertTool(pos, id, '', bitmap, pushedBitmap, kind,
shortHelpString, longHelpString, clientData)
def InsertSimpleTool(self, pos, id, bitmap,
shortHelpString = '',
longHelpString = '',
isToggle = 0):
'''Old style method to insert a tool in the toolbar.'''
kind = wx.wxITEM_NORMAL
if isToggle: kind = wx.wxITEM_CHECK
return self.DoInsertTool(pos, id, '', bitmap, wxNullBitmap, kind,
shortHelpString, longHelpString, None)
# The following are the new toolbar Add methods starting with
# 2.3.3. They are renamed to have 'Label' in the name so as to be
# able to keep backwards compatibility with using the above
# methods. Eventually these should migrate to be the methods used
# primarily and loose the 'Label' in the name...
def AddLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
kind = wxITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None):
'''
The full AddTool() function.
If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
is created and used as the disabled image.
'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, clientData)
def InsertLabelTool(self, pos, id, label, bitmap,
bmpDisabled = wxNullBitmap,
kind = wxITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None):
'''
Insert the new tool at the given position, if pos == GetToolsCount(), it
is equivalent to AddTool()
'''
return self.DoInsertTool(pos, id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, clientData)
def AddCheckLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''Add a check tool, i.e. a tool which can be toggled'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, wx.wxITEM_CHECK,
shortHelp, longHelp, clientData)
def AddRadioLabelTool(self, id, label, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''
Add a radio tool, i.e. a tool which can be toggled and releases any
other toggled radio tools in the same group when it happens
'''
return self.DoAddTool(id, label, bitmap, bmpDisabled, wx.wxITEM_RADIO,
shortHelp, longHelp, clientData)
# For consistency with the backwards compatible methods above, here are
# some non-'Label' versions of the Check and Radio methods
def AddCheckTool(self, id, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''Add a check tool, i.e. a tool which can be toggled'''
return self.DoAddTool(id, '', bitmap, bmpDisabled, wx.wxITEM_CHECK,
shortHelp, longHelp, clientData)
def AddRadioTool(self, id, bitmap,
bmpDisabled = wxNullBitmap,
shortHelp = '', longHelp = '',
clientData = None):
'''
Add a radio tool, i.e. a tool which can be toggled and releases any
other toggled radio tools in the same group when it happens
'''
return self.DoAddTool(id, '', bitmap, bmpDisabled, wx.wxITEM_RADIO,
shortHelp, longHelp, clientData)
"
wxToolBarToolBase *AddControl(wxControl *control); wxToolBarToolBase *AddControl(wxControl *control);
wxToolBarToolBase *InsertControl(size_t pos, wxControl *control); wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);