diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index ea105db1e8..c88ee3dd9d 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -455,6 +455,11 @@ Added wxPython.lib.mixins.rubberband module from Robb Shecter. Added wxTimeCtrl from Will Sadkin. +Added wxTreeListCtrl. (Looks like a wxTreeCtrl embedded in a +wxListCtrl, but actually is just giving multiple columns to a +wxTreeCtrl.) + + 2.3.2.1 diff --git a/wxPython/contrib/gizmos/gizmos.cpp b/wxPython/contrib/gizmos/gizmos.cpp index 0abd1ec076..166a07c9d6 100644 --- a/wxPython/contrib/gizmos/gizmos.cpp +++ b/wxPython/contrib/gizmos/gizmos.cpp @@ -59,7 +59,11 @@ extern PyObject *SWIG_newvarlink(void); #include #include #include + +#include #include +#include +#include "pytree.h" static PyObject* t_output_helper(PyObject* target, PyObject* o) { @@ -91,6 +95,8 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { // Put some wx default wxChar* values into wxStrings. static const wxString wxPyDynamicSashNameStr(wxT("dynamicSashWindow")); static const wxString wxPyEditableListBoxNameStr(wxT("editableListBox")); + static const wxString wxPyTreeListCtrlNameStr(wxT("treelistctrl")); + static const wxString wxPyEmptyString(wxT("")); typedef wxTreeCtrl wxPyTreeCtrl; @@ -123,6 +129,43 @@ public: PYPRIVATE; }; + // C++ version of Python aware control +class wxPyTreeListCtrl : public wxTreeListCtrl { + DECLARE_ABSTRACT_CLASS(wxPyTreeListCtrl); +public: + wxPyTreeListCtrl() : wxTreeListCtrl() {} + wxPyTreeListCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator &validator, + const wxString& name) : + wxTreeListCtrl(parent, id, pos, size, style, validator, name) {} + + int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) { + int rval = 0; + bool found; + wxPyBeginBlockThreads(); + if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { + PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0); + PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0); + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",o1,o2)); + Py_DECREF(o1); + Py_DECREF(o2); + } + wxPyEndBlockThreads(); + if (! found) + rval = wxTreeListCtrl::OnCompareItems(item1, item2); + return rval; + } + PYPRIVATE; +}; + +IMPLEMENT_ABSTRACT_CLASS(wxPyTreeListCtrl, wxTreeListCtrl) + + + static const long longzero = 0; #ifdef __cplusplus extern "C" { #endif @@ -1904,7 +1947,4034 @@ static PyObject *_wrap_wxLEDNumberCtrl_SetValue(PyObject *self, PyObject *args, return _resultobj; } +static void *SwigwxTreeListColumnInfoTowxObject(void *ptr) { + wxTreeListColumnInfo *src; + wxObject *dest; + src = (wxTreeListColumnInfo *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxTreeListColumnInfo(_swigarg0,_swigarg1,_swigarg2,_swigarg3) (new wxTreeListColumnInfo(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) +static PyObject *_wrap_new_wxTreeListColumnInfo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _result; + wxString * _arg0 = (wxString *) &wxPyEmptyString; + int _arg1 = (int ) -1; + size_t _arg2 = (size_t ) 100; + wxTreeListColumnAlign _arg3 = (wxTreeListColumnAlign ) (wxTL_ALIGN_LEFT); + PyObject * _obj0 = 0; + char *_kwnames[] = { "text","image","width","alignment", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|Oiii:new_wxTreeListColumnInfo",_kwnames,&_obj0,&_arg1,&_arg2,&_arg3)) + return NULL; + if (_obj0) +{ + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxTreeListColumnInfo *)new_wxTreeListColumnInfo(*_arg0,_arg1,_arg2,_arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxTreeListColumnInfo_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } +{ + if (_obj0) + delete _arg0; +} + return _resultobj; +} + +#define wxTreeListColumnInfo_GetAlignment(_swigobj) (_swigobj->GetAlignment()) +static PyObject *_wrap_wxTreeListColumnInfo_GetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnAlign _result; + wxTreeListColumnInfo * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListColumnInfo_GetAlignment",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_GetAlignment. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxTreeListColumnAlign )wxTreeListColumnInfo_GetAlignment(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListColumnInfo_GetText(_swigobj) (_swigobj->GetText()) +static PyObject *_wrap_wxTreeListColumnInfo_GetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxTreeListColumnInfo * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListColumnInfo_GetText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_GetText. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxTreeListColumnInfo_GetText(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + +#define wxTreeListColumnInfo_GetImage(_swigobj) (_swigobj->GetImage()) +static PyObject *_wrap_wxTreeListColumnInfo_GetImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxTreeListColumnInfo * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListColumnInfo_GetImage",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_GetImage. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxTreeListColumnInfo_GetImage(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListColumnInfo_GetSelectedImage(_swigobj) (_swigobj->GetSelectedImage()) +static PyObject *_wrap_wxTreeListColumnInfo_GetSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxTreeListColumnInfo * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListColumnInfo_GetSelectedImage",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_GetSelectedImage. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxTreeListColumnInfo_GetSelectedImage(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListColumnInfo_GetWidth(_swigobj) (_swigobj->GetWidth()) +static PyObject *_wrap_wxTreeListColumnInfo_GetWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxTreeListColumnInfo * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListColumnInfo_GetWidth",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_GetWidth. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListColumnInfo_GetWidth(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListColumnInfo_SetAlignment(_swigobj,_swigarg0) (_swigobj->SetAlignment(_swigarg0)) +static PyObject *_wrap_wxTreeListColumnInfo_SetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _arg0; + wxTreeListColumnAlign _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","alignment", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListColumnInfo_SetAlignment",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_SetAlignment. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo_SetAlignment(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListColumnInfo_SetText(_swigobj,_swigarg0) (_swigobj->SetText(_swigarg0)) +static PyObject *_wrap_wxTreeListColumnInfo_SetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListColumnInfo_SetText",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_SetText. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo_SetText(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxTreeListColumnInfo_SetImage(_swigobj,_swigarg0) (_swigobj->SetImage(_swigarg0)) +static PyObject *_wrap_wxTreeListColumnInfo_SetImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","image", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListColumnInfo_SetImage",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_SetImage. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo_SetImage(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListColumnInfo_SetSelectedImage(_swigobj,_swigarg0) (_swigobj->SetSelectedImage(_swigarg0)) +static PyObject *_wrap_wxTreeListColumnInfo_SetSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","image", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListColumnInfo_SetSelectedImage",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_SetSelectedImage. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo_SetSelectedImage(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListColumnInfo_SetWidth(_swigobj,_swigarg0) (_swigobj->SetWidth(_swigarg0)) +static PyObject *_wrap_wxTreeListColumnInfo_SetWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","with", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListColumnInfo_SetWidth",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListColumnInfo_SetWidth. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo_SetWidth(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static void *SwigwxPyTreeListCtrlTowxControl(void *ptr) { + wxPyTreeListCtrl *src; + wxControl *dest; + src = (wxPyTreeListCtrl *) ptr; + dest = (wxControl *) src; + return (void *) dest; +} + +static void *SwigwxPyTreeListCtrlTowxWindow(void *ptr) { + wxPyTreeListCtrl *src; + wxWindow *dest; + src = (wxPyTreeListCtrl *) ptr; + dest = (wxWindow *) src; + return (void *) dest; +} + +static void *SwigwxPyTreeListCtrlTowxEvtHandler(void *ptr) { + wxPyTreeListCtrl *src; + wxEvtHandler *dest; + src = (wxPyTreeListCtrl *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +static void *SwigwxPyTreeListCtrlTowxObject(void *ptr) { + wxPyTreeListCtrl *src; + wxObject *dest; + src = (wxPyTreeListCtrl *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxTreeListCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (new wxPyTreeListCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6)) +static PyObject *_wrap_new_wxTreeListCtrl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _result; + wxWindow * _arg0; + wxWindowID _arg1 = (wxWindowID ) -1; + wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg3 = (wxSize *) &wxDefaultSize; + long _arg4 = (long ) wxTR_DEFAULT_STYLE; + wxValidator * _arg5 = (wxValidator *) &wxDefaultValidator; + wxString * _arg6 = (wxString *) &wxPyTreeListCtrlNameStr; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj2 = 0; + wxSize temp0; + PyObject * _obj3 = 0; + PyObject * _argo5 = 0; + PyObject * _obj6 = 0; + char *_kwnames[] = { "parent","id","pos","size","style","validator","name", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOlOO:new_wxTreeListCtrl",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_argo5,&_obj6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxTreeListCtrl. Expected _wxWindow_p."); + return NULL; + } + } + if (_obj2) +{ + _arg2 = &temp; + if (! wxPoint_helper(_obj2, &_arg2)) + return NULL; +} + if (_obj3) +{ + _arg3 = &temp0; + if (! wxSize_helper(_obj3, &_arg3)) + return NULL; +} + if (_argo5) { + if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_wxValidator_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of new_wxTreeListCtrl. Expected _wxValidator_p."); + return NULL; + } + } + if (_obj6) +{ + _arg6 = wxString_in_helper(_obj6); + if (_arg6 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxPyTreeListCtrl *)new_wxTreeListCtrl(_arg0,_arg1,*_arg2,*_arg3,_arg4,*_arg5,*_arg6); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyTreeListCtrl_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } +{ + if (_obj6) + delete _arg6; +} + return _resultobj; +} + +#define new_wxPreTreeListCtrl() (new wxPyTreeListCtrl()) +static PyObject *_wrap_new_wxPreTreeListCtrl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxPreTreeListCtrl",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxPyTreeListCtrl *)new_wxPreTreeListCtrl(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyTreeListCtrl_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxTreeListCtrl_Create(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (_swigobj->Create(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6)) +static PyObject *_wrap_wxTreeListCtrl_Create(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxWindow * _arg1; + wxWindowID _arg2 = (wxWindowID ) -1; + wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg4 = (wxSize *) &wxDefaultSize; + long _arg5 = (long ) wxTR_DEFAULT_STYLE; + wxValidator * _arg6 = (wxValidator *) &wxDefaultValidator; + wxString * _arg7 = (wxString *) &wxPyTreeListCtrlNameStr; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + wxPoint temp; + PyObject * _obj3 = 0; + wxSize temp0; + PyObject * _obj4 = 0; + PyObject * _argo6 = 0; + PyObject * _obj7 = 0; + char *_kwnames[] = { "self","parent","id","pos","size","style","validator","name", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|iOOlOO:wxTreeListCtrl_Create",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_arg5,&_argo6,&_obj7)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Create. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Create. Expected _wxWindow_p."); + return NULL; + } + } + if (_obj3) +{ + _arg3 = &temp; + if (! wxPoint_helper(_obj3, &_arg3)) + return NULL; +} + if (_obj4) +{ + _arg4 = &temp0; + if (! wxSize_helper(_obj4, &_arg4)) + return NULL; +} + if (_argo6) { + if (SWIG_GetPtrObj(_argo6,(void **) &_arg6,"_wxValidator_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 7 of wxTreeListCtrl_Create. Expected _wxValidator_p."); + return NULL; + } + } + if (_obj7) +{ + _arg7 = wxString_in_helper(_obj7); + if (_arg7 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_Create(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,*_arg6,*_arg7); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj7) + delete _arg7; +} + return _resultobj; +} + +#define wxTreeListCtrl__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + PyObject * _arg1; + PyObject * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl__setCallbackInfo. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg1 = _obj1; +} +{ + _arg2 = _obj2; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl__setCallbackInfo(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetCount(_swigobj) (_swigobj->GetCount()) +static PyObject *_wrap_wxTreeListCtrl_GetCount(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetCount",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetCount. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListCtrl_GetCount(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_GetIndent(_swigobj) (_swigobj->GetIndent()) +static PyObject *_wrap_wxTreeListCtrl_GetIndent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + unsigned int _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetIndent",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetIndent. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (unsigned int )wxTreeListCtrl_GetIndent(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetIndent(_swigobj,_swigarg0) (_swigobj->SetIndent(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetIndent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + unsigned int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","indent", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_SetIndent",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetIndent. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetIndent(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetSpacing(_swigobj) (_swigobj->GetSpacing()) +static PyObject *_wrap_wxTreeListCtrl_GetSpacing(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + unsigned int _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetSpacing",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetSpacing. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (unsigned int )wxTreeListCtrl_GetSpacing(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetSpacing(_swigobj,_swigarg0) (_swigobj->SetSpacing(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetSpacing(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + unsigned int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","spacing", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_SetSpacing",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetSpacing. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetSpacing(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetImageList(_swigobj) (_swigobj->GetImageList()) +static PyObject *_wrap_wxTreeListCtrl_GetImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImageList * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetImageList",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxImageList *)wxTreeListCtrl_GetImageList(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxTreeListCtrl_GetStateImageList(_swigobj) (_swigobj->GetStateImageList()) +static PyObject *_wrap_wxTreeListCtrl_GetStateImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImageList * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetStateImageList",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetStateImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxImageList *)wxTreeListCtrl_GetStateImageList(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxTreeListCtrl_GetButtonsImageList(_swigobj) (_swigobj->GetButtonsImageList()) +static PyObject *_wrap_wxTreeListCtrl_GetButtonsImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImageList * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetButtonsImageList",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetButtonsImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxImageList *)wxTreeListCtrl_GetButtonsImageList(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxTreeListCtrl_SetImageList(_swigobj,_swigarg0) (_swigobj->SetImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_SetImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetStateImageList(_swigobj,_swigarg0) (_swigobj->SetStateImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetStateImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_SetStateImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetStateImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetStateImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetStateImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetButtonsImageList(_swigobj,_swigarg0) (_swigobj->SetButtonsImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetButtonsImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_SetButtonsImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetButtonsImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetButtonsImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetButtonsImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_AssignImageList(_swigobj,_swigarg0) (_swigobj->AssignImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_AssignImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_AssignImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AssignImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_AssignImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_AssignImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_AssignStateImageList(_swigobj,_swigarg0) (_swigobj->AssignStateImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_AssignStateImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_AssignStateImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AssignStateImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_AssignStateImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_AssignStateImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_AssignButtonsImageList(_swigobj,_swigarg0) (_swigobj->AssignButtonsImageList(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_AssignButtonsImageList(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxImageList * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","imageList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_AssignButtonsImageList",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AssignButtonsImageList. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_AssignButtonsImageList. Expected _wxImageList_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_AssignButtonsImageList(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_AddColumn(_swigobj,_swigarg0) (_swigobj->AddColumn(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_AddColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_AddColumn",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AddColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_AddColumn(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxTreeListCtrl_AddColumnInfo(_swigobj,_swigarg0) (_swigobj->AddColumn(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_AddColumnInfo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeListColumnInfo * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_AddColumnInfo",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AddColumnInfo. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_AddColumnInfo. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_AddColumnInfo(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_InsertColumn(_swigobj,_swigarg0,_swigarg1) (_swigobj->InsertColumn(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_InsertColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","before","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxTreeListCtrl_InsertColumn",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_InsertColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_InsertColumn(_arg0,_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxTreeListCtrl_InsertColumnInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->InsertColumn(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_InsertColumnInfo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + wxTreeListColumnInfo * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","before","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxTreeListCtrl_InsertColumnInfo",_kwnames,&_argo0,&_arg1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_InsertColumnInfo. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo2) { + if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxTreeListCtrl_InsertColumnInfo. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_InsertColumnInfo(_arg0,_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_RemoveColumn(_swigobj,_swigarg0) (_swigobj->RemoveColumn(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_RemoveColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_RemoveColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_RemoveColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_RemoveColumn(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetColumnCount(_swigobj) (_swigobj->GetColumnCount()) +static PyObject *_wrap_wxTreeListCtrl_GetColumnCount(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetColumnCount",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetColumnCount. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListCtrl_GetColumnCount(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetColumnWidth(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetColumnWidth(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetColumnWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + size_t _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column","width", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxTreeListCtrl_SetColumnWidth",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetColumnWidth. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetColumnWidth(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetColumnWidth(_swigobj,_swigarg0) (_swigobj->GetColumnWidth(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetColumnWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_GetColumnWidth",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetColumnWidth. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxTreeListCtrl_GetColumnWidth(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetMainColumn(_swigobj,_swigarg0) (_swigobj->SetMainColumn(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SetMainColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_SetMainColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetMainColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetMainColumn(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetMainColumn(_swigobj) (_swigobj->GetMainColumn()) +static PyObject *_wrap_wxTreeListCtrl_GetMainColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetMainColumn",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetMainColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListCtrl_GetMainColumn(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetColumnText(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetColumnText(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetColumnText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","column","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxTreeListCtrl_SetColumnText",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetColumnText. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetColumnText(_arg0,_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxTreeListCtrl_GetColumnText(_swigobj,_swigarg0) (_swigobj->GetColumnText(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetColumnText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_GetColumnText",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetColumnText. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxTreeListCtrl_GetColumnText(_arg0,_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + +#define wxTreeListCtrl_SetColumn(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetColumn(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + wxTreeListColumnInfo * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","column","info", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxTreeListCtrl_SetColumn",_kwnames,&_argo0,&_arg1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo2) { + if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxTreeListColumnInfo_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxTreeListCtrl_SetColumn. Expected _wxTreeListColumnInfo_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetColumn(_arg0,_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetColumn(_swigobj,_swigarg0) (_swigobj->GetColumn(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeListColumnInfo * _result; + wxPyTreeListCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxTreeListCtrl_GetColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetColumn. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListColumnInfo & _result_ref = wxTreeListCtrl_GetColumn(_arg0,_arg1); + _result = (wxTreeListColumnInfo *) &_result_ref; + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxTreeListColumnInfo_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static wxString wxPyTreeListCtrl_GetItemText(wxPyTreeListCtrl *self,const wxTreeItemId & item,int column) { + if (column < 0) column = self->GetMainColumn(); + return self->GetItemText(item, column); + } +static PyObject *_wrap_wxTreeListCtrl_GetItemText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + int _arg2 = (int ) -1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeListCtrl_GetItemText",_kwnames,&_argo0,&_argo1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetItemText. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetItemText. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxPyTreeListCtrl_GetItemText(_arg0,*_arg1,_arg2)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + +static int wxPyTreeListCtrl_GetItemImage(wxPyTreeListCtrl *self,const wxTreeItemId & item,int column,wxTreeItemIcon which) { + if (column < 0) column = self->GetMainColumn(); + return self->GetItemImage(item, column, which); + } +static PyObject *_wrap_wxTreeListCtrl_GetItemImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + int _arg2 = (int ) -1; + wxTreeItemIcon _arg3 = (wxTreeItemIcon ) wxTreeItemIcon_Normal; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item","column","which", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|ii:wxTreeListCtrl_GetItemImage",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetItemImage. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetItemImage. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxPyTreeListCtrl_GetItemImage(_arg0,*_arg1,_arg2,_arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static void wxPyTreeListCtrl_SetItemText(wxPyTreeListCtrl *self,const wxTreeItemId & item,const wxString & text,int column) { + if (column < 0) column = self->GetMainColumn(); + self->SetItemText(item, column, text); + } +static PyObject *_wrap_wxTreeListCtrl_SetItemText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxString * _arg2; + int _arg3 = (int ) -1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","text","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|i:wxTreeListCtrl_SetItemText",_kwnames,&_argo0,&_argo1,&_obj2,&_arg3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemText. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemText. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxPyTreeListCtrl_SetItemText(_arg0,*_arg1,*_arg2,_arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +static void wxPyTreeListCtrl_SetItemImage(wxPyTreeListCtrl *self,const wxTreeItemId & item,int image,int column,wxTreeItemIcon which) { + if (column < 0) column = self->GetMainColumn(); + self->SetItemImage(item, column, image, which); + } +static PyObject *_wrap_wxTreeListCtrl_SetItemImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + int _arg2; + int _arg3 = (int ) -1; + wxTreeItemIcon _arg4 = (wxTreeItemIcon ) wxTreeItemIcon_Normal; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item","image","column","which", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi|ii:wxTreeListCtrl_SetItemImage",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3,&_arg4)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemImage. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemImage. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxPyTreeListCtrl_SetItemImage(_arg0,*_arg1,_arg2,_arg3,_arg4); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static wxPyTreeItemData * wxPyTreeListCtrl_GetItemData(wxPyTreeListCtrl *self,const wxTreeItemId & item) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(); + data->SetId(item); // set the id + self->SetItemData(item, data); + } + return data; + } +static PyObject *_wrap_wxTreeListCtrl_GetItemData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeItemData * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetItemData",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetItemData. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetItemData. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxPyTreeItemData *)wxPyTreeListCtrl_GetItemData(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyTreeItemData_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static void wxPyTreeListCtrl_SetItemData(wxPyTreeListCtrl *self,const wxTreeItemId & item,wxPyTreeItemData * data) { + data->SetId(item); // set the id + self->SetItemData(item, data); + } +static PyObject *_wrap_wxTreeListCtrl_SetItemData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxPyTreeItemData * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","item","data", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_SetItemData",_kwnames,&_argo0,&_argo1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemData. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemData. Expected _wxTreeItemId_p."); + return NULL; + } + } + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxTreeListCtrl_SetItemData. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxPyTreeListCtrl_SetItemData(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyObject * wxPyTreeListCtrl_GetPyData(wxPyTreeListCtrl *self,const wxTreeItemId & item) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(); + data->SetId(item); // set the id + self->SetItemData(item, data); + } + return data->GetData(); + } +static PyObject *_wrap_wxTreeListCtrl_GetPyData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetPyData",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetPyData. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetPyData. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (PyObject *)wxPyTreeListCtrl_GetPyData(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +static void wxPyTreeListCtrl_SetPyData(wxPyTreeListCtrl *self,const wxTreeItemId & item,PyObject * obj) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(obj); + data->SetId(item); // set the id + self->SetItemData(item, data); + } else + data->SetData(obj); + } +static PyObject *_wrap_wxTreeListCtrl_SetPyData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","obj", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_SetPyData",_kwnames,&_argo0,&_argo1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetPyData. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetPyData. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = _obj2; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxPyTreeListCtrl_SetPyData(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetItemHasChildren(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemHasChildren(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemHasChildren(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + bool _arg2 = (bool ) TRUE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + int tempbool2 = (int) TRUE; + char *_kwnames[] = { "self","item","has", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeListCtrl_SetItemHasChildren",_kwnames,&_argo0,&_argo1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemHasChildren. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemHasChildren. Expected _wxTreeItemId_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemHasChildren(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetItemBold(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemBold(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemBold(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + bool _arg2 = (bool ) TRUE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + int tempbool2 = (int) TRUE; + char *_kwnames[] = { "self","item","bold", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeListCtrl_SetItemBold",_kwnames,&_argo0,&_argo1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemBold. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemBold. Expected _wxTreeItemId_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemBold(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetItemTextColour(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemTextColour(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_SetItemTextColour",_kwnames,&_argo0,&_argo1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemTextColour. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemTextColour. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemTextColour(_arg0,*_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetItemBackgroundColour(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemBackgroundColour(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_SetItemBackgroundColour",_kwnames,&_argo0,&_argo1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemBackgroundColour. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemBackgroundColour. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemBackgroundColour(_arg0,*_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SetItemFont(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemFont(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxFont * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","item","font", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_SetItemFont",_kwnames,&_argo0,&_argo1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemFont. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemFont. Expected _wxTreeItemId_p."); + return NULL; + } + } + if (_argo2) { + if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxTreeListCtrl_SetItemFont. Expected _wxFont_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemFont(_arg0,*_arg1,*_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_IsVisible(_swigobj,_swigarg0) (_swigobj->IsVisible(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_IsVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_IsVisible",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_IsVisible. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_IsVisible. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_IsVisible(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_ItemHasChildren(_swigobj,_swigarg0) (_swigobj->ItemHasChildren(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_ItemHasChildren(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_ItemHasChildren",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_ItemHasChildren. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_ItemHasChildren. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_ItemHasChildren(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_IsExpanded(_swigobj,_swigarg0) (_swigobj->IsExpanded(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_IsExpanded(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_IsExpanded",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_IsExpanded. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_IsExpanded. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_IsExpanded(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_IsSelected(_swigobj,_swigarg0) (_swigobj->IsSelected(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_IsSelected(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_IsSelected",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_IsSelected. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_IsSelected. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_IsSelected(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_IsBold(_swigobj,_swigarg0) (_swigobj->IsBold(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_IsBold(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_IsBold",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_IsBold. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_IsBold. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxTreeListCtrl_IsBold(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_GetChildrenCount(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetChildrenCount(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_GetChildrenCount(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + bool _arg2 = (bool ) TRUE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + int tempbool2 = (int) TRUE; + char *_kwnames[] = { "self","item","recursively", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeListCtrl_GetChildrenCount",_kwnames,&_argo0,&_argo1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetChildrenCount. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetChildrenCount. Expected _wxTreeItemId_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListCtrl_GetChildrenCount(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_GetRootItem(_swigobj) (_swigobj->GetRootItem()) +static PyObject *_wrap_wxTreeListCtrl_GetRootItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetRootItem",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetRootItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetRootItem(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetSelection(_swigobj) (_swigobj->GetSelection()) +static PyObject *_wrap_wxTreeListCtrl_GetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetSelection",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetSelection. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetSelection(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetSelections(_swigobj,_swigarg0) (_swigobj->GetSelections(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetSelections(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + size_t _result; + wxPyTreeListCtrl * _arg0; + wxArrayTreeItemIds * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","arg2", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetSelections",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetSelections. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxArrayTreeItemIds_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetSelections. Expected _wxArrayTreeItemIds_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (size_t )wxTreeListCtrl_GetSelections(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_GetItemParent(_swigobj,_swigarg0) (_swigobj->GetParent(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetItemParent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetItemParent",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetItemParent. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetItemParent. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetItemParent(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetFirstChild(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetFirstChild(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_GetFirstChild(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + long * _arg2 = (long *) &longzero; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + long temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","INOUT", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|O:wxTreeListCtrl_GetFirstChild",_kwnames,&_argo0,&_argo1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetFirstChild. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetFirstChild. Expected _wxTreeItemId_p."); + return NULL; + } + } + if (_obj2) +{ + temp = (long) PyInt_AsLong(_obj2); + _arg2 = &temp; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetFirstChild(_arg0,*_arg1,*_arg2)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +#define wxTreeListCtrl_GetNextChild(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetNextChild(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_GetNextChild(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + long * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + long temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","item","INOUT", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTreeListCtrl_GetNextChild",_kwnames,&_argo0,&_argo1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetNextChild. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetNextChild. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + temp = (long) PyInt_AsLong(_obj2); + _arg2 = &temp; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetNextChild(_arg0,*_arg1,*_arg2)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +#define wxTreeListCtrl_GetLastChild(_swigobj,_swigarg0) (_swigobj->GetLastChild(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetLastChild(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetLastChild",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetLastChild. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetLastChild. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetLastChild(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetNextSibling(_swigobj,_swigarg0) (_swigobj->GetNextSibling(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetNextSibling(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetNextSibling",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetNextSibling. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetNextSibling. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetNextSibling(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetPrevSibling(_swigobj,_swigarg0) (_swigobj->GetPrevSibling(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetPrevSibling(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetPrevSibling",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetPrevSibling. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetPrevSibling. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetPrevSibling(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetFirstVisibleItem(_swigobj) (_swigobj->GetFirstVisibleItem()) +static PyObject *_wrap_wxTreeListCtrl_GetFirstVisibleItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetFirstVisibleItem",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetFirstVisibleItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetFirstVisibleItem(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetNextVisible(_swigobj,_swigarg0) (_swigobj->GetNextVisible(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetNextVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetNextVisible",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetNextVisible. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetNextVisible. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetNextVisible(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetPrevVisible(_swigobj,_swigarg0) (_swigobj->GetPrevVisible(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetPrevVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetPrevVisible",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetPrevVisible. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetPrevVisible. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetPrevVisible(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_GetNext(_swigobj,_swigarg0) (_swigobj->GetNext(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetNext(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetNext",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetNext. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetNext. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_GetNext(_arg0,*_arg1)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxTreeListCtrl_AddRoot(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->AddRoot(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) +static PyObject *_wrap_wxTreeListCtrl_AddRoot(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxString * _arg1; + int _arg2 = (int ) -1; + int _arg3 = (int ) -1; + wxPyTreeItemData * _arg4 = (wxPyTreeItemData *) NULL; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + PyObject * _argo4 = 0; + char *_kwnames[] = { "self","text","image","selectedImage","data", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|iiO:wxTreeListCtrl_AddRoot",_kwnames,&_argo0,&_obj1,&_arg2,&_arg3,&_argo4)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AddRoot. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} + if (_argo4) { + if (_argo4 == Py_None) { _arg4 = NULL; } + else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxTreeListCtrl_AddRoot. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_AddRoot(_arg0,*_arg1,_arg2,_arg3,_arg4)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxTreeListCtrl_PrependItem(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (_swigobj->PrependItem(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) +static PyObject *_wrap_wxTreeListCtrl_PrependItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxString * _arg2; + int _arg3 = (int ) -1; + int _arg4 = (int ) -1; + wxPyTreeItemData * _arg5 = (wxPyTreeItemData *) NULL; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _obj2 = 0; + PyObject * _argo5 = 0; + char *_kwnames[] = { "self","parent","text","image","selectedImage","data", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|iiO:wxTreeListCtrl_PrependItem",_kwnames,&_argo0,&_argo1,&_obj2,&_arg3,&_arg4,&_argo5)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_PrependItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_PrependItem. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} + if (_argo5) { + if (_argo5 == Py_None) { _arg5 = NULL; } + else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of wxTreeListCtrl_PrependItem. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_PrependItem(_arg0,*_arg1,*_arg2,_arg3,_arg4,_arg5)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxTreeListCtrl_InsertItem(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->InsertItem(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_wxTreeListCtrl_InsertItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxTreeItemId * _arg2; + wxString * _arg3; + int _arg4 = (int ) -1; + int _arg5 = (int ) -1; + wxPyTreeItemData * _arg6 = (wxPyTreeItemData *) NULL; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _argo2 = 0; + PyObject * _obj3 = 0; + PyObject * _argo6 = 0; + char *_kwnames[] = { "self","parent","idPrevious","text","image","selectedImage","data", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO|iiO:wxTreeListCtrl_InsertItem",_kwnames,&_argo0,&_argo1,&_argo2,&_obj3,&_arg4,&_arg5,&_argo6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_InsertItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_InsertItem. Expected _wxTreeItemId_p."); + return NULL; + } + } + if (_argo2) { + if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxTreeListCtrl_InsertItem. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) + return NULL; +} + if (_argo6) { + if (_argo6 == Py_None) { _arg6 = NULL; } + else if (SWIG_GetPtrObj(_argo6,(void **) &_arg6,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 7 of wxTreeListCtrl_InsertItem. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_InsertItem(_arg0,*_arg1,*_arg2,*_arg3,_arg4,_arg5,_arg6)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + if (_obj3) + delete _arg3; +} + return _resultobj; +} + +#define wxTreeListCtrl_InsertItemBefore(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->InsertItem(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_wxTreeListCtrl_InsertItemBefore(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + size_t _arg2; + wxString * _arg3; + int _arg4 = (int ) -1; + int _arg5 = (int ) -1; + wxPyTreeItemData * _arg6 = (wxPyTreeItemData *) NULL; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _obj3 = 0; + PyObject * _argo6 = 0; + char *_kwnames[] = { "self","parent","index","text","image","selectedImage","data", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOiO|iiO:wxTreeListCtrl_InsertItemBefore",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_arg4,&_arg5,&_argo6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_InsertItemBefore. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_InsertItemBefore. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) + return NULL; +} + if (_argo6) { + if (_argo6 == Py_None) { _arg6 = NULL; } + else if (SWIG_GetPtrObj(_argo6,(void **) &_arg6,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 7 of wxTreeListCtrl_InsertItemBefore. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_InsertItemBefore(_arg0,*_arg1,_arg2,*_arg3,_arg4,_arg5,_arg6)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + if (_obj3) + delete _arg3; +} + return _resultobj; +} + +#define wxTreeListCtrl_AppendItem(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (_swigobj->AppendItem(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) +static PyObject *_wrap_wxTreeListCtrl_AppendItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + wxString * _arg2; + int _arg3 = (int ) -1; + int _arg4 = (int ) -1; + wxPyTreeItemData * _arg5 = (wxPyTreeItemData *) NULL; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _obj2 = 0; + PyObject * _argo5 = 0; + char *_kwnames[] = { "self","parent","text","image","selectedImage","data", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|iiO:wxTreeListCtrl_AppendItem",_kwnames,&_argo0,&_argo1,&_obj2,&_arg3,&_arg4,&_argo5)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_AppendItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_AppendItem. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) + return NULL; +} + if (_argo5) { + if (_argo5 == Py_None) { _arg5 = NULL; } + else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_wxPyTreeItemData_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of wxTreeListCtrl_AppendItem. Expected _wxPyTreeItemData_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_AppendItem(_arg0,*_arg1,*_arg2,_arg3,_arg4,_arg5)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxTreeListCtrl_Delete(_swigobj,_swigarg0) (_swigobj->Delete(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_Delete(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_Delete",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Delete. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Delete. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Delete(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_DeleteChildren(_swigobj,_swigarg0) (_swigobj->DeleteChildren(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_DeleteChildren(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_DeleteChildren",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_DeleteChildren. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_DeleteChildren. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_DeleteChildren(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_DeleteAllItems(_swigobj) (_swigobj->DeleteAllItems()) +static PyObject *_wrap_wxTreeListCtrl_DeleteAllItems(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_DeleteAllItems",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_DeleteAllItems. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_DeleteAllItems(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_Expand(_swigobj,_swigarg0) (_swigobj->Expand(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_Expand(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_Expand",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Expand. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Expand. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Expand(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_ExpandAll(_swigobj,_swigarg0) (_swigobj->ExpandAll(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_ExpandAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_ExpandAll",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_ExpandAll. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_ExpandAll. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_ExpandAll(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_Collapse(_swigobj,_swigarg0) (_swigobj->Collapse(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_Collapse(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_Collapse",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Collapse. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Collapse. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Collapse(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_CollapseAndReset(_swigobj,_swigarg0) (_swigobj->CollapseAndReset(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_CollapseAndReset(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_CollapseAndReset",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_CollapseAndReset. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_CollapseAndReset. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_CollapseAndReset(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_Toggle(_swigobj,_swigarg0) (_swigobj->Toggle(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_Toggle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_Toggle",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Toggle. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Toggle. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Toggle(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_Unselect(_swigobj) (_swigobj->Unselect()) +static PyObject *_wrap_wxTreeListCtrl_Unselect(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_Unselect",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Unselect. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Unselect(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_UnselectAll(_swigobj) (_swigobj->UnselectAll()) +static PyObject *_wrap_wxTreeListCtrl_UnselectAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_UnselectAll",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_UnselectAll. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_UnselectAll(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SelectItem(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SelectItem(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxTreeListCtrl_SelectItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + bool _arg2 = (bool ) TRUE; + bool _arg3 = (bool ) FALSE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + int tempbool2 = (int) TRUE; + int tempbool3 = (int) FALSE; + char *_kwnames[] = { "self","item","unselect_others","extended_select", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|ii:wxTreeListCtrl_SelectItem",_kwnames,&_argo0,&_argo1,&tempbool2,&tempbool3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SelectItem. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SelectItem. Expected _wxTreeItemId_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; + _arg3 = (bool ) tempbool3; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SelectItem(_arg0,*_arg1,_arg2,_arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_EnsureVisible(_swigobj,_swigarg0) (_swigobj->EnsureVisible(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_EnsureVisible",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_EnsureVisible. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_EnsureVisible. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_EnsureVisible(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_ScrollTo(_swigobj,_swigarg0) (_swigobj->ScrollTo(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_ScrollTo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_ScrollTo",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_ScrollTo. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_ScrollTo. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_ScrollTo(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_HitTest(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->HitTest(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxTreeListCtrl_HitTest(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTreeItemId * _result; + wxPyTreeListCtrl * _arg0; + wxPoint * _arg1; + int * _arg2; + int temp; + int * _arg3; + int temp0; + PyObject * _argo0 = 0; + wxPoint temp1; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","point", NULL }; + char _ptemp[128]; + + self = self; +{ + _arg2 = &temp; +} +{ + _arg3 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_HitTest",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_HitTest. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp1; + if (! wxPoint_helper(_obj1, &_arg1)) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxTreeItemId (wxTreeListCtrl_HitTest(_arg0,*_arg1,*_arg2,*_arg3)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p"); + _resultobj = Py_BuildValue("s",_ptemp); +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg3)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +static PyObject * wxPyTreeListCtrl_GetBoundingRect(wxPyTreeListCtrl *self,const wxTreeItemId & item,bool textOnly) { + wxRect rect; + if (self->GetBoundingRect(item, rect, textOnly)) { + wxPyBeginBlockThreads(); + wxRect* r = new wxRect(rect); + PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1); + wxPyEndBlockThreads(); + return val; + } + else { + Py_INCREF(Py_None); + return Py_None; + } + } +static PyObject *_wrap_wxTreeListCtrl_GetBoundingRect(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + bool _arg2 = (bool ) FALSE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + int tempbool2 = (int) FALSE; + char *_kwnames[] = { "self","item","textOnly", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeListCtrl_GetBoundingRect",_kwnames,&_argo0,&_argo1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetBoundingRect. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetBoundingRect. Expected _wxTreeItemId_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (PyObject *)wxPyTreeListCtrl_GetBoundingRect(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +#define wxTreeListCtrl_EditLabel(_swigobj,_swigarg0) (_swigobj->EditLabel(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_EditLabel(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_EditLabel",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_EditLabel. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_EditLabel. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_EditLabel(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_Edit(_swigobj,_swigarg0) (_swigobj->Edit(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_Edit(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_Edit",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_Edit. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_Edit. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_Edit(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_SortChildren(_swigobj,_swigarg0) (_swigobj->SortChildren(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_SortChildren(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_SortChildren",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SortChildren. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SortChildren. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SortChildren(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetItemSelectedImage(_swigobj,_swigarg0) (_swigobj->GetItemSelectedImage(_swigarg0)) +static PyObject *_wrap_wxTreeListCtrl_GetItemSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeListCtrl_GetItemSelectedImage",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetItemSelectedImage. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_GetItemSelectedImage. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxTreeListCtrl_GetItemSelectedImage(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxTreeListCtrl_SetItemSelectedImage(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemSelectedImage(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxTreeListCtrl_SetItemSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeListCtrl * _arg0; + wxTreeItemId * _arg1; + int _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item","image", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxTreeListCtrl_SetItemSelectedImage",_kwnames,&_argo0,&_argo1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_SetItemSelectedImage. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeListCtrl_SetItemSelectedImage. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxTreeListCtrl_SetItemSelectedImage(_arg0,*_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxTreeListCtrl_GetHeaderWindow(_swigobj) (_swigobj->GetHeaderWindow()) +static PyObject *_wrap_wxTreeListCtrl_GetHeaderWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetHeaderWindow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetHeaderWindow. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxTreeListCtrl_GetHeaderWindow(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxTreeListCtrl_GetMainWindow(_swigobj) (_swigobj->GetMainWindow()) +static PyObject *_wrap_wxTreeListCtrl_GetMainWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + wxPyTreeListCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeListCtrl_GetMainWindow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeListCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeListCtrl_GetMainWindow. Expected _wxPyTreeListCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxTreeListCtrl_GetMainWindow(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + static PyMethodDef gizmoscMethods[] = { + { "wxTreeListCtrl_GetMainWindow", (PyCFunction) _wrap_wxTreeListCtrl_GetMainWindow, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetHeaderWindow", (PyCFunction) _wrap_wxTreeListCtrl_GetHeaderWindow, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemSelectedImage", (PyCFunction) _wrap_wxTreeListCtrl_SetItemSelectedImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetItemSelectedImage", (PyCFunction) _wrap_wxTreeListCtrl_GetItemSelectedImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SortChildren", (PyCFunction) _wrap_wxTreeListCtrl_SortChildren, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Edit", (PyCFunction) _wrap_wxTreeListCtrl_Edit, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_EditLabel", (PyCFunction) _wrap_wxTreeListCtrl_EditLabel, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetBoundingRect", (PyCFunction) _wrap_wxTreeListCtrl_GetBoundingRect, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_HitTest", (PyCFunction) _wrap_wxTreeListCtrl_HitTest, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_ScrollTo", (PyCFunction) _wrap_wxTreeListCtrl_ScrollTo, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_EnsureVisible", (PyCFunction) _wrap_wxTreeListCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SelectItem", (PyCFunction) _wrap_wxTreeListCtrl_SelectItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_UnselectAll", (PyCFunction) _wrap_wxTreeListCtrl_UnselectAll, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Unselect", (PyCFunction) _wrap_wxTreeListCtrl_Unselect, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Toggle", (PyCFunction) _wrap_wxTreeListCtrl_Toggle, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_CollapseAndReset", (PyCFunction) _wrap_wxTreeListCtrl_CollapseAndReset, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Collapse", (PyCFunction) _wrap_wxTreeListCtrl_Collapse, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_ExpandAll", (PyCFunction) _wrap_wxTreeListCtrl_ExpandAll, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Expand", (PyCFunction) _wrap_wxTreeListCtrl_Expand, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_DeleteAllItems", (PyCFunction) _wrap_wxTreeListCtrl_DeleteAllItems, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_DeleteChildren", (PyCFunction) _wrap_wxTreeListCtrl_DeleteChildren, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Delete", (PyCFunction) _wrap_wxTreeListCtrl_Delete, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AppendItem", (PyCFunction) _wrap_wxTreeListCtrl_AppendItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_InsertItemBefore", (PyCFunction) _wrap_wxTreeListCtrl_InsertItemBefore, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_InsertItem", (PyCFunction) _wrap_wxTreeListCtrl_InsertItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_PrependItem", (PyCFunction) _wrap_wxTreeListCtrl_PrependItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AddRoot", (PyCFunction) _wrap_wxTreeListCtrl_AddRoot, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetNext", (PyCFunction) _wrap_wxTreeListCtrl_GetNext, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetPrevVisible", (PyCFunction) _wrap_wxTreeListCtrl_GetPrevVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetNextVisible", (PyCFunction) _wrap_wxTreeListCtrl_GetNextVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetFirstVisibleItem", (PyCFunction) _wrap_wxTreeListCtrl_GetFirstVisibleItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetPrevSibling", (PyCFunction) _wrap_wxTreeListCtrl_GetPrevSibling, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetNextSibling", (PyCFunction) _wrap_wxTreeListCtrl_GetNextSibling, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetLastChild", (PyCFunction) _wrap_wxTreeListCtrl_GetLastChild, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetNextChild", (PyCFunction) _wrap_wxTreeListCtrl_GetNextChild, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetFirstChild", (PyCFunction) _wrap_wxTreeListCtrl_GetFirstChild, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetItemParent", (PyCFunction) _wrap_wxTreeListCtrl_GetItemParent, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetSelections", (PyCFunction) _wrap_wxTreeListCtrl_GetSelections, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetSelection", (PyCFunction) _wrap_wxTreeListCtrl_GetSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetRootItem", (PyCFunction) _wrap_wxTreeListCtrl_GetRootItem, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetChildrenCount", (PyCFunction) _wrap_wxTreeListCtrl_GetChildrenCount, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_IsBold", (PyCFunction) _wrap_wxTreeListCtrl_IsBold, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_IsSelected", (PyCFunction) _wrap_wxTreeListCtrl_IsSelected, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_IsExpanded", (PyCFunction) _wrap_wxTreeListCtrl_IsExpanded, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_ItemHasChildren", (PyCFunction) _wrap_wxTreeListCtrl_ItemHasChildren, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_IsVisible", (PyCFunction) _wrap_wxTreeListCtrl_IsVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemFont", (PyCFunction) _wrap_wxTreeListCtrl_SetItemFont, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemBackgroundColour", (PyCFunction) _wrap_wxTreeListCtrl_SetItemBackgroundColour, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemTextColour", (PyCFunction) _wrap_wxTreeListCtrl_SetItemTextColour, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemBold", (PyCFunction) _wrap_wxTreeListCtrl_SetItemBold, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemHasChildren", (PyCFunction) _wrap_wxTreeListCtrl_SetItemHasChildren, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetPyData", (PyCFunction) _wrap_wxTreeListCtrl_SetPyData, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetPyData", (PyCFunction) _wrap_wxTreeListCtrl_GetPyData, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemData", (PyCFunction) _wrap_wxTreeListCtrl_SetItemData, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetItemData", (PyCFunction) _wrap_wxTreeListCtrl_GetItemData, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemImage", (PyCFunction) _wrap_wxTreeListCtrl_SetItemImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetItemText", (PyCFunction) _wrap_wxTreeListCtrl_SetItemText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetItemImage", (PyCFunction) _wrap_wxTreeListCtrl_GetItemImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetItemText", (PyCFunction) _wrap_wxTreeListCtrl_GetItemText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetColumn", (PyCFunction) _wrap_wxTreeListCtrl_GetColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetColumn", (PyCFunction) _wrap_wxTreeListCtrl_SetColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetColumnText", (PyCFunction) _wrap_wxTreeListCtrl_GetColumnText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetColumnText", (PyCFunction) _wrap_wxTreeListCtrl_SetColumnText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetMainColumn", (PyCFunction) _wrap_wxTreeListCtrl_GetMainColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetMainColumn", (PyCFunction) _wrap_wxTreeListCtrl_SetMainColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetColumnWidth", (PyCFunction) _wrap_wxTreeListCtrl_GetColumnWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetColumnWidth", (PyCFunction) _wrap_wxTreeListCtrl_SetColumnWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetColumnCount", (PyCFunction) _wrap_wxTreeListCtrl_GetColumnCount, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_RemoveColumn", (PyCFunction) _wrap_wxTreeListCtrl_RemoveColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_InsertColumnInfo", (PyCFunction) _wrap_wxTreeListCtrl_InsertColumnInfo, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_InsertColumn", (PyCFunction) _wrap_wxTreeListCtrl_InsertColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AddColumnInfo", (PyCFunction) _wrap_wxTreeListCtrl_AddColumnInfo, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AddColumn", (PyCFunction) _wrap_wxTreeListCtrl_AddColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AssignButtonsImageList", (PyCFunction) _wrap_wxTreeListCtrl_AssignButtonsImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AssignStateImageList", (PyCFunction) _wrap_wxTreeListCtrl_AssignStateImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_AssignImageList", (PyCFunction) _wrap_wxTreeListCtrl_AssignImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetButtonsImageList", (PyCFunction) _wrap_wxTreeListCtrl_SetButtonsImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetStateImageList", (PyCFunction) _wrap_wxTreeListCtrl_SetStateImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetImageList", (PyCFunction) _wrap_wxTreeListCtrl_SetImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetButtonsImageList", (PyCFunction) _wrap_wxTreeListCtrl_GetButtonsImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetStateImageList", (PyCFunction) _wrap_wxTreeListCtrl_GetStateImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetImageList", (PyCFunction) _wrap_wxTreeListCtrl_GetImageList, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetSpacing", (PyCFunction) _wrap_wxTreeListCtrl_SetSpacing, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetSpacing", (PyCFunction) _wrap_wxTreeListCtrl_GetSpacing, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_SetIndent", (PyCFunction) _wrap_wxTreeListCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetIndent", (PyCFunction) _wrap_wxTreeListCtrl_GetIndent, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_GetCount", (PyCFunction) _wrap_wxTreeListCtrl_GetCount, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl__setCallbackInfo", (PyCFunction) _wrap_wxTreeListCtrl__setCallbackInfo, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListCtrl_Create", (PyCFunction) _wrap_wxTreeListCtrl_Create, METH_VARARGS | METH_KEYWORDS }, + { "new_wxPreTreeListCtrl", (PyCFunction) _wrap_new_wxPreTreeListCtrl, METH_VARARGS | METH_KEYWORDS }, + { "new_wxTreeListCtrl", (PyCFunction) _wrap_new_wxTreeListCtrl, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_SetWidth", (PyCFunction) _wrap_wxTreeListColumnInfo_SetWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_SetSelectedImage", (PyCFunction) _wrap_wxTreeListColumnInfo_SetSelectedImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_SetImage", (PyCFunction) _wrap_wxTreeListColumnInfo_SetImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_SetText", (PyCFunction) _wrap_wxTreeListColumnInfo_SetText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_SetAlignment", (PyCFunction) _wrap_wxTreeListColumnInfo_SetAlignment, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_GetWidth", (PyCFunction) _wrap_wxTreeListColumnInfo_GetWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_GetSelectedImage", (PyCFunction) _wrap_wxTreeListColumnInfo_GetSelectedImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_GetImage", (PyCFunction) _wrap_wxTreeListColumnInfo_GetImage, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_GetText", (PyCFunction) _wrap_wxTreeListColumnInfo_GetText, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeListColumnInfo_GetAlignment", (PyCFunction) _wrap_wxTreeListColumnInfo_GetAlignment, METH_VARARGS | METH_KEYWORDS }, + { "new_wxTreeListColumnInfo", (PyCFunction) _wrap_new_wxTreeListColumnInfo, METH_VARARGS | METH_KEYWORDS }, { "wxLEDNumberCtrl_SetValue", (PyCFunction) _wrap_wxLEDNumberCtrl_SetValue, METH_VARARGS | METH_KEYWORDS }, { "wxLEDNumberCtrl_SetDrawFaded", (PyCFunction) _wrap_wxLEDNumberCtrl_SetDrawFaded, METH_VARARGS | METH_KEYWORDS }, { "wxLEDNumberCtrl_SetAlignment", (PyCFunction) _wrap_wxLEDNumberCtrl_SetAlignment, METH_VARARGS | METH_KEYWORDS }, @@ -2009,6 +6079,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_wxSplitterWindow","_wxThinSplitterWindow",SwigwxThinSplitterWindowTowxSplitterWindow}, + { "_wxObject","_wxPyTreeListCtrl",SwigwxPyTreeListCtrlTowxObject}, + { "_wxObject","_wxTreeListColumnInfo",SwigwxTreeListColumnInfoTowxObject}, { "_wxObject","_wxLEDNumberCtrl",SwigwxLEDNumberCtrlTowxObject}, { "_wxObject","_wxSplitterScrolledWindow",SwigwxSplitterScrolledWindowTowxObject}, { "_wxObject","_wxThinSplitterWindow",SwigwxThinSplitterWindowTowxObject}, @@ -2022,6 +6094,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxScrolledWindow","_wxSplitterScrolledWindow",SwigwxSplitterScrolledWindowTowxScrolledWindow}, { "_unsigned_char","_byte",0}, + { "_wxControl","_wxPyTreeListCtrl",SwigwxPyTreeListCtrlTowxControl}, { "_wxControl","_wxLEDNumberCtrl",SwigwxLEDNumberCtrlTowxControl}, { "_wxControl","_wxRemotelyScrolledTreeCtrl",SwigwxRemotelyScrolledTreeCtrlTowxControl}, { "_unsigned_int","_wxCoord",0}, @@ -2072,6 +6145,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxCoord","_size_t",0}, { "_wxCoord","_time_t",0}, { "_wxCoord","_wxPrintQuality",0}, + { "_wxEvtHandler","_wxPyTreeListCtrl",SwigwxPyTreeListCtrlTowxEvtHandler}, { "_wxEvtHandler","_wxLEDNumberCtrl",SwigwxLEDNumberCtrlTowxEvtHandler}, { "_wxEvtHandler","_wxSplitterScrolledWindow",SwigwxSplitterScrolledWindowTowxEvtHandler}, { "_wxEvtHandler","_wxThinSplitterWindow",SwigwxThinSplitterWindowTowxEvtHandler}, @@ -2079,6 +6153,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEvtHandler","_wxRemotelyScrolledTreeCtrl",SwigwxRemotelyScrolledTreeCtrlTowxEvtHandler}, { "_wxEvtHandler","_wxEditableListBox",SwigwxEditableListBoxTowxEvtHandler}, { "_wxEvtHandler","_wxDynamicSashWindow",SwigwxDynamicSashWindowTowxEvtHandler}, + { "_wxWindow","_wxPyTreeListCtrl",SwigwxPyTreeListCtrlTowxWindow}, { "_wxWindow","_wxLEDNumberCtrl",SwigwxLEDNumberCtrlTowxWindow}, { "_wxWindow","_wxSplitterScrolledWindow",SwigwxSplitterScrolledWindowTowxWindow}, { "_wxWindow","_wxThinSplitterWindow",SwigwxThinSplitterWindowTowxWindow}, @@ -2109,12 +6184,17 @@ SWIGEXPORT(void) initgizmosc() { PyDict_SetItemString(d,"wxLED_ALIGN_CENTER", PyInt_FromLong((long) wxLED_ALIGN_CENTER)); PyDict_SetItemString(d,"wxLED_ALIGN_MASK", PyInt_FromLong((long) wxLED_ALIGN_MASK)); PyDict_SetItemString(d,"wxLED_DRAW_FADED", PyInt_FromLong((long) wxLED_DRAW_FADED)); + PyDict_SetItemString(d,"wxTL_ALIGN_LEFT", PyInt_FromLong((long) wxTL_ALIGN_LEFT)); + PyDict_SetItemString(d,"wxTL_ALIGN_RIGHT", PyInt_FromLong((long) wxTL_ALIGN_RIGHT)); + PyDict_SetItemString(d,"wxTL_ALIGN_CENTER", PyInt_FromLong((long) wxTL_ALIGN_CENTER)); + PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMCOLUMN", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMCOLUMN)); wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow"); + wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl"); { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/wxPython/contrib/gizmos/gizmos.i b/wxPython/contrib/gizmos/gizmos.i index 1af639a5b7..751e5bfaf7 100644 --- a/wxPython/contrib/gizmos/gizmos.i +++ b/wxPython/contrib/gizmos/gizmos.i @@ -19,7 +19,11 @@ #include #include #include + +#include #include +#include +#include "pytree.h" %} //--------------------------------------------------------------------------- @@ -32,6 +36,8 @@ %extern _defs.i %extern events.i %extern controls.i +%extern controls2.i +%extern gdi.i //---------------------------------------------------------------------- @@ -40,6 +46,8 @@ // Put some wx default wxChar* values into wxStrings. static const wxString wxPyDynamicSashNameStr(wxT("dynamicSashWindow")); static const wxString wxPyEditableListBoxNameStr(wxT("editableListBox")); + static const wxString wxPyTreeListCtrlNameStr(wxT("treelistctrl")); + static const wxString wxPyEmptyString(wxT("")); %} ///---------------------------------------------------------------------- @@ -390,6 +398,492 @@ public: }; + + +//---------------------------------------------------------------------------- +// wxTreeListCtrl - the multicolumn tree control +//---------------------------------------------------------------------------- + +enum wxTreeListColumnAlign { + wxTL_ALIGN_LEFT, + wxTL_ALIGN_RIGHT, + wxTL_ALIGN_CENTER +}; + + + +enum { + wxTREE_HITTEST_ONITEMCOLUMN +}; + + + + +class wxTreeListColumnInfo: public wxObject { +public: + wxTreeListColumnInfo(const wxString& text = wxPyEmptyString, + int image = -1, + size_t width = 100, + wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT); + + wxTreeListColumnAlign GetAlignment() const; + wxString GetText() const; + int GetImage() const; + int GetSelectedImage() const; + size_t GetWidth() const; + + void SetAlignment(wxTreeListColumnAlign alignment); + void SetText(const wxString& text); + void SetImage(int image); + void SetSelectedImage(int image); + void SetWidth(size_t with); +}; + + + + +%{ // C++ version of Python aware control +class wxPyTreeListCtrl : public wxTreeListCtrl { + DECLARE_ABSTRACT_CLASS(wxPyTreeListCtrl); +public: + wxPyTreeListCtrl() : wxTreeListCtrl() {} + wxPyTreeListCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator &validator, + const wxString& name) : + wxTreeListCtrl(parent, id, pos, size, style, validator, name) {} + + int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) { + int rval = 0; + bool found; + wxPyBeginBlockThreads(); + if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { + PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0); + PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0); + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",o1,o2)); + Py_DECREF(o1); + Py_DECREF(o2); + } + wxPyEndBlockThreads(); + if (! found) + rval = wxTreeListCtrl::OnCompareItems(item1, item2); + return rval; + } + PYPRIVATE; +}; + +IMPLEMENT_ABSTRACT_CLASS(wxPyTreeListCtrl, wxTreeListCtrl) + +%} + + + + +// These are for the GetFirstChild/GetNextChild methods below +%{ + static const long longzero = 0; +%} +%typemap(python, in) long& INOUT = long* INOUT; +%typemap(python, argout) long& INOUT = long* INOUT; + + +%name(wxTreeListCtrl) class wxPyTreeListCtrl : public wxControl +{ +public: + wxPyTreeListCtrl(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxPyTreeListCtrlNameStr ); + %name(wxPreTreeListCtrl)wxPyTreeListCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxPyTreeListCtrlNameStr ); + + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTreeListCtrl)" + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPreTreeListCtrl:val._setOORInfo(val)" + + + + // get the total number of items in the control + size_t GetCount() const; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + unsigned int GetIndent() const; + void SetIndent(unsigned int indent); + + // spacing is the number of pixels between the start and the Text + unsigned int GetSpacing() const; + void SetSpacing(unsigned int spacing); + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that when assigned with + // SetImageList, the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. If you use + // AssignImageList, the control _does_ delete the image list. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const; + wxImageList *GetStateImageList() const; + wxImageList *GetButtonsImageList() const; + + void SetImageList(wxImageList *imageList); + void SetStateImageList(wxImageList *imageList); + void SetButtonsImageList(wxImageList *imageList); + void AssignImageList(wxImageList *imageList); + void AssignStateImageList(wxImageList *imageList); + void AssignButtonsImageList(wxImageList *imageList); + + + + // adds a column + void AddColumn(const wxString& text); + %name(AddColumnInfo) void AddColumn(const wxTreeListColumnInfo& col); + + // inserts a column before the given one + void InsertColumn(size_t before, const wxString& text); + %name(InsertColumnInfo) void InsertColumn(size_t before, const wxTreeListColumnInfo& col); + + // deletes the given column - does not delete the corresponding column + // of each item + void RemoveColumn(size_t column); + + // returns the number of columns in the ctrl + size_t GetColumnCount() const; + + void SetColumnWidth(size_t column, size_t width); + int GetColumnWidth(size_t column) const; + + // tells which column is the "main" one, i.e. the "threaded" one + void SetMainColumn(size_t column); + size_t GetMainColumn() const; + + void SetColumnText(size_t column, const wxString& text); + wxString GetColumnText(size_t column) const; + + void SetColumn(size_t column, const wxTreeListColumnInfo& info); + wxTreeListColumnInfo& GetColumn(size_t column); + + + + %addmethods { + // retrieves item's label of the given column (main column by default) + wxString GetItemText(const wxTreeItemId& item, int column = -1) { + if (column < 0) column = self->GetMainColumn(); + return self->GetItemText(item, column); + } + + // get one of the images associated with the item (normal by default) + int GetItemImage(const wxTreeItemId& item, int column = -1, + wxTreeItemIcon which = wxTreeItemIcon_Normal) { + if (column < 0) column = self->GetMainColumn(); + return self->GetItemImage(item, column, which); + } + + // set item's label (main column by default) + void SetItemText(const wxTreeItemId& item, const wxString& text, int column = -1) { + if (column < 0) column = self->GetMainColumn(); + self->SetItemText(item, column, text); + } + + // set one of the images associated with the item (normal by default) + // the which parameter is ignored for all columns but the main one + void SetItemImage(const wxTreeItemId& item, int image, int column = -1, + wxTreeItemIcon which = wxTreeItemIcon_Normal) { + if (column < 0) column = self->GetMainColumn(); + self->SetItemImage(item, column, image, which); + } + + + // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData + // if needed. + wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(); + data->SetId(item); // set the id + self->SetItemData(item, data); + } + return data; + } + + void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { + data->SetId(item); // set the id + self->SetItemData(item, data); + } + + // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by + // automatically creating data classes. + PyObject* GetPyData(const wxTreeItemId& item) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(); + data->SetId(item); // set the id + self->SetItemData(item, data); + } + return data->GetData(); + } + + void SetPyData(const wxTreeItemId& item, PyObject* obj) { + wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); + if (data == NULL) { + data = new wxPyTreeItemData(obj); + data->SetId(item); // set the id + self->SetItemData(item, data); + } else + data->SetData(obj); + } + } + + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); + + // the item will be shown in bold + void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + + // set the item's text colour + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + + // set the item's background colour + void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col); + + // set the item's font (should be of the same height for all items) + void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + + // TODO: Where are the Getters for item colour, font, etc? + + + // is the item visible (it might be outside the view or not expanded)? + bool IsVisible(const wxTreeItemId& item) const; + + // does the item has any children? + bool ItemHasChildren(const wxTreeItemId& item) const; + + // is the item expanded (only makes sense if HasChildren())? + bool IsExpanded(const wxTreeItemId& item) const; + + // is this item currently selected (the same as has focus)? + bool IsSelected(const wxTreeItemId& item) const; + + // is item text in bold font? + bool IsBold(const wxTreeItemId& item) const; + + // if 'recursively' is FALSE, only immediate children count, otherwise + // the returned number is the number of all items in this branch + size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); + + + // wxTreeItemId.IsOk() will return FALSE if there is no such item + + // get the root tree item + wxTreeItemId GetRootItem() const; + + // get the item currently selected (may return NULL if no selection) + wxTreeItemId GetSelection() const; + + // get the items currently selected, return the number of such item + size_t GetSelections(wxArrayTreeItemIds&) const; + + // get the parent of this item (may return NULL if root) + %name(GetItemParent)wxTreeItemId GetParent(const wxTreeItemId& item) const; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT = longzero) const; + + // get the next child + wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT) const; + + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + // get the next sibling of this item + wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + + // get the previous sibling + wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + // get first visible item + wxTreeItemId GetFirstVisibleItem() const; + + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + + // get the previous visible item: item must be visible itself! + wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // Only for internal use right now, but should probably be public + wxTreeItemId GetNext(const wxTreeItemId& item) const; + + + // add the root node to the tree + wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxPyTreeItemData *data = NULL); + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxPyTreeItemData *data = NULL); + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selectedImage = -1, + wxPyTreeItemData *data = NULL); + + // insert a new item before the one with the given index + %name(InsertItemBefore) + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, + int image = -1, int selectedImage = -1, + wxPyTreeItemData *data = NULL); + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxPyTreeItemData *data = NULL); + + // delete this item and associated data if any + void Delete(const wxTreeItemId& item); + + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteChildren(const wxTreeItemId& item); + + // delete all items from the tree + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteAllItems(); + + // expand this item + void Expand(const wxTreeItemId& item); + + // expand this item and all subitems recursively + void ExpandAll(const wxTreeItemId& item); + + // collapse the item without removing its children + void Collapse(const wxTreeItemId& item); + + // collapse the item and remove all children + void CollapseAndReset(const wxTreeItemId& item); + + // toggles the current state + void Toggle(const wxTreeItemId& item); + + // remove the selection from currently selected item (if any) + void Unselect(); + void UnselectAll(); + + // select this item + void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, + bool extended_select=FALSE); + + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + void EnsureVisible(const wxTreeItemId& item); + + // scroll to this item (but don't expand its parent) + void ScrollTo(const wxTreeItemId& item); + + // Returns wxTreeItemId, flags, and column + wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT, int& OUTPUT); + + %addmethods { + // get the bounding rectangle of the item (or of its label only) + PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = FALSE) { + wxRect rect; + if (self->GetBoundingRect(item, rect, textOnly)) { + wxPyBeginBlockThreads(); + wxRect* r = new wxRect(rect); + PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1); + wxPyEndBlockThreads(); + return val; + } + else { + Py_INCREF(Py_None); + return Py_None; + } + } + } + + + // Start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. + void EditLabel( const wxTreeItemId& item ); + void Edit( const wxTreeItemId& item ); + + // sort the children of this item using OnCompareItems + void SortChildren(const wxTreeItemId& item); + + // get the selected item image + int GetItemSelectedImage(const wxTreeItemId& item) const; + + // set the selected item image + void SetItemSelectedImage(const wxTreeItemId& item, int image); + + + wxWindow* GetHeaderWindow() const; + wxWindow* GetMainWindow() const; + +%pragma(python) addtoclass = " + # Redefine some methods that SWIG gets a bit confused on... + def GetFirstChild(self, *_args, **_kwargs): + val1,val2 = controls2c.wxTreeCtrl_GetFirstChild(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1,val2) + def GetNextChild(self, *_args, **_kwargs): + val1,val2 = controls2c.wxTreeCtrl_GetNextChild(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1,val2) + def HitTest(self, *_args, **_kwargs): + val1, val2, val3 = controls2c.wxTreeCtrl_HitTest(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1, val2, val3) +" +}; + + + + //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -399,6 +893,7 @@ public: wxClassInfo::InitializeClasses(); wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow"); + wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl"); %} diff --git a/wxPython/contrib/gizmos/gizmos.py b/wxPython/contrib/gizmos/gizmos.py index b4acfae556..b1b9561446 100644 --- a/wxPython/contrib/gizmos/gizmos.py +++ b/wxPython/contrib/gizmos/gizmos.py @@ -280,6 +280,374 @@ def wxPreLEDNumberCtrl(*_args,**_kwargs): return val +class wxTreeListColumnInfoPtr(wxObjectPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetAlignment(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_GetAlignment(self, *_args, **_kwargs) + return val + def GetText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_GetText(self, *_args, **_kwargs) + return val + def GetImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_GetImage(self, *_args, **_kwargs) + return val + def GetSelectedImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_GetSelectedImage(self, *_args, **_kwargs) + return val + def GetWidth(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_GetWidth(self, *_args, **_kwargs) + return val + def SetAlignment(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_SetAlignment(self, *_args, **_kwargs) + return val + def SetText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_SetText(self, *_args, **_kwargs) + return val + def SetImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_SetImage(self, *_args, **_kwargs) + return val + def SetSelectedImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_SetSelectedImage(self, *_args, **_kwargs) + return val + def SetWidth(self, *_args, **_kwargs): + val = gizmosc.wxTreeListColumnInfo_SetWidth(self, *_args, **_kwargs) + return val + def __repr__(self): + return "<%s.%s instance; proxy of C++ wxTreeListColumnInfo instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this) +class wxTreeListColumnInfo(wxTreeListColumnInfoPtr): + def __init__(self,*_args,**_kwargs): + self.this = gizmosc.new_wxTreeListColumnInfo(*_args,**_kwargs) + self.thisown = 1 + + + + +class wxTreeListCtrlPtr(wxControlPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def Create(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Create(self, *_args, **_kwargs) + return val + def _setCallbackInfo(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl__setCallbackInfo(self, *_args, **_kwargs) + return val + def GetCount(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetCount(self, *_args, **_kwargs) + return val + def GetIndent(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetIndent(self, *_args, **_kwargs) + return val + def SetIndent(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetIndent(self, *_args, **_kwargs) + return val + def GetSpacing(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetSpacing(self, *_args, **_kwargs) + return val + def SetSpacing(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetSpacing(self, *_args, **_kwargs) + return val + def GetImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetImageList(self, *_args, **_kwargs) + return val + def GetStateImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetStateImageList(self, *_args, **_kwargs) + return val + def GetButtonsImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetButtonsImageList(self, *_args, **_kwargs) + return val + def SetImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetImageList(self, *_args, **_kwargs) + return val + def SetStateImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetStateImageList(self, *_args, **_kwargs) + return val + def SetButtonsImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetButtonsImageList(self, *_args, **_kwargs) + return val + def AssignImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AssignImageList(self, *_args, **_kwargs) + return val + def AssignStateImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AssignStateImageList(self, *_args, **_kwargs) + return val + def AssignButtonsImageList(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AssignButtonsImageList(self, *_args, **_kwargs) + return val + def AddColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AddColumn(self, *_args, **_kwargs) + return val + def AddColumnInfo(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AddColumnInfo(self, *_args, **_kwargs) + return val + def InsertColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_InsertColumn(self, *_args, **_kwargs) + return val + def InsertColumnInfo(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_InsertColumnInfo(self, *_args, **_kwargs) + return val + def RemoveColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_RemoveColumn(self, *_args, **_kwargs) + return val + def GetColumnCount(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetColumnCount(self, *_args, **_kwargs) + return val + def SetColumnWidth(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetColumnWidth(self, *_args, **_kwargs) + return val + def GetColumnWidth(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetColumnWidth(self, *_args, **_kwargs) + return val + def SetMainColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetMainColumn(self, *_args, **_kwargs) + return val + def GetMainColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetMainColumn(self, *_args, **_kwargs) + return val + def SetColumnText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetColumnText(self, *_args, **_kwargs) + return val + def GetColumnText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetColumnText(self, *_args, **_kwargs) + return val + def SetColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetColumn(self, *_args, **_kwargs) + return val + def GetColumn(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetColumn(self, *_args, **_kwargs) + if val: val = wxTreeListColumnInfoPtr(val) + return val + def GetItemText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetItemText(self, *_args, **_kwargs) + return val + def GetItemImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetItemImage(self, *_args, **_kwargs) + return val + def SetItemText(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemText(self, *_args, **_kwargs) + return val + def SetItemImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemImage(self, *_args, **_kwargs) + return val + def GetItemData(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetItemData(self, *_args, **_kwargs) + if val: val = wxTreeItemDataPtr(val) + return val + def SetItemData(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemData(self, *_args, **_kwargs) + return val + def GetPyData(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetPyData(self, *_args, **_kwargs) + return val + def SetPyData(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetPyData(self, *_args, **_kwargs) + return val + def SetItemHasChildren(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemHasChildren(self, *_args, **_kwargs) + return val + def SetItemBold(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemBold(self, *_args, **_kwargs) + return val + def SetItemTextColour(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemTextColour(self, *_args, **_kwargs) + return val + def SetItemBackgroundColour(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemBackgroundColour(self, *_args, **_kwargs) + return val + def SetItemFont(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemFont(self, *_args, **_kwargs) + return val + def IsVisible(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_IsVisible(self, *_args, **_kwargs) + return val + def ItemHasChildren(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_ItemHasChildren(self, *_args, **_kwargs) + return val + def IsExpanded(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_IsExpanded(self, *_args, **_kwargs) + return val + def IsSelected(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_IsSelected(self, *_args, **_kwargs) + return val + def IsBold(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_IsBold(self, *_args, **_kwargs) + return val + def GetChildrenCount(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetChildrenCount(self, *_args, **_kwargs) + return val + def GetRootItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetRootItem(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetSelection(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetSelection(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetSelections(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetSelections(self, *_args, **_kwargs) + return val + def GetItemParent(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetItemParent(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetFirstChild(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetFirstChild(self, *_args, **_kwargs) + return val + def GetNextChild(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetNextChild(self, *_args, **_kwargs) + return val + def GetLastChild(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetLastChild(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetNextSibling(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetNextSibling(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetPrevSibling(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetPrevSibling(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetFirstVisibleItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetFirstVisibleItem(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetNextVisible(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetNextVisible(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetPrevVisible(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetPrevVisible(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def GetNext(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetNext(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def AddRoot(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AddRoot(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def PrependItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_PrependItem(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def InsertItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_InsertItem(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def InsertItemBefore(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_InsertItemBefore(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def AppendItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_AppendItem(self, *_args, **_kwargs) + if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1 + return val + def Delete(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Delete(self, *_args, **_kwargs) + return val + def DeleteChildren(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_DeleteChildren(self, *_args, **_kwargs) + return val + def DeleteAllItems(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_DeleteAllItems(self, *_args, **_kwargs) + return val + def Expand(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Expand(self, *_args, **_kwargs) + return val + def ExpandAll(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_ExpandAll(self, *_args, **_kwargs) + return val + def Collapse(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Collapse(self, *_args, **_kwargs) + return val + def CollapseAndReset(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_CollapseAndReset(self, *_args, **_kwargs) + return val + def Toggle(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Toggle(self, *_args, **_kwargs) + return val + def Unselect(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Unselect(self, *_args, **_kwargs) + return val + def UnselectAll(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_UnselectAll(self, *_args, **_kwargs) + return val + def SelectItem(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SelectItem(self, *_args, **_kwargs) + return val + def EnsureVisible(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_EnsureVisible(self, *_args, **_kwargs) + return val + def ScrollTo(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_ScrollTo(self, *_args, **_kwargs) + return val + def HitTest(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_HitTest(self, *_args, **_kwargs) + return val + def GetBoundingRect(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetBoundingRect(self, *_args, **_kwargs) + return val + def EditLabel(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_EditLabel(self, *_args, **_kwargs) + return val + def Edit(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_Edit(self, *_args, **_kwargs) + return val + def SortChildren(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SortChildren(self, *_args, **_kwargs) + return val + def GetItemSelectedImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetItemSelectedImage(self, *_args, **_kwargs) + return val + def SetItemSelectedImage(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_SetItemSelectedImage(self, *_args, **_kwargs) + return val + def GetHeaderWindow(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetHeaderWindow(self, *_args, **_kwargs) + return val + def GetMainWindow(self, *_args, **_kwargs): + val = gizmosc.wxTreeListCtrl_GetMainWindow(self, *_args, **_kwargs) + return val + def __repr__(self): + return "<%s.%s instance; proxy of C++ wxTreeListCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this) + + # Redefine some methods that SWIG gets a bit confused on... + def GetFirstChild(self, *_args, **_kwargs): + val1,val2 = controls2c.wxTreeCtrl_GetFirstChild(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1,val2) + def GetNextChild(self, *_args, **_kwargs): + val1,val2 = controls2c.wxTreeCtrl_GetNextChild(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1,val2) + def HitTest(self, *_args, **_kwargs): + val1, val2, val3 = controls2c.wxTreeCtrl_HitTest(self, *_args, **_kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1, val2, val3) + +class wxTreeListCtrl(wxTreeListCtrlPtr): + def __init__(self,*_args,**_kwargs): + self.this = gizmosc.new_wxTreeListCtrl(*_args,**_kwargs) + self.thisown = 1 + self._setCallbackInfo(self, wxTreeListCtrl) + self._setOORInfo(self) + + + +def wxPreTreeListCtrl(*_args,**_kwargs): + val = wxTreeListCtrlPtr(gizmosc.new_wxPreTreeListCtrl(*_args,**_kwargs)) + val.thisown = 1 + val._setOORInfo(val) + return val + + #-------------- FUNCTION WRAPPERS ------------------ @@ -300,6 +668,10 @@ wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER wxLED_ALIGN_MASK = gizmosc.wxLED_ALIGN_MASK wxLED_DRAW_FADED = gizmosc.wxLED_DRAW_FADED +wxTL_ALIGN_LEFT = gizmosc.wxTL_ALIGN_LEFT +wxTL_ALIGN_RIGHT = gizmosc.wxTL_ALIGN_RIGHT +wxTL_ALIGN_CENTER = gizmosc.wxTL_ALIGN_CENTER +wxTREE_HITTEST_ONITEMCOLUMN = gizmosc.wxTREE_HITTEST_ONITEMCOLUMN #-------------- USER INCLUDE ----------------------- diff --git a/wxPython/contrib/gizmos/treelistctrl.cpp b/wxPython/contrib/gizmos/treelistctrl.cpp new file mode 100644 index 0000000000..981d9af84e --- /dev/null +++ b/wxPython/contrib/gizmos/treelistctrl.cpp @@ -0,0 +1,4635 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: treelistctrl.cpp (derived by treectlg.h) +// Purpose: multi column tree control implementation +// Author: Robert Roebling +// Created: 01/02/97 +// Modified: Alberto Griggio, 2002 +// 22/10/98 - almost total rewrite, simpler interface (VZ) +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "treelistctrl.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + + +//#include "wx/gizmos/treelistctrl.h" +#include "treelistctrl.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __WXGTK__ + #include + #include +#endif + +// --------------------------------------------------------------------------- +// array types +// --------------------------------------------------------------------------- + +class wxTreeListItem; + +WX_DEFINE_EXPORTED_ARRAY(wxTreeListItem *, wxArrayTreeListItems); + +#include +WX_DECLARE_OBJARRAY(wxTreeListColumnInfo, wxArrayTreeListColumnInfo); +#include +WX_DEFINE_OBJARRAY(wxArrayTreeListColumnInfo); + +#if !wxCHECK_VERSION(2, 3, 3) +WX_DEFINE_ARRAY(short, wxArrayShort); +#endif + +// -------------------------------------------------------------------------- +// constants +// -------------------------------------------------------------------------- + +static const int NO_IMAGE = -1; + +#define PIXELS_PER_UNIT 10 + +const wxChar* wxTreeListCtrlNameStr = wxT("treelistctrl"); + +// --------------------------------------------------------------------------- +// private classes +// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// wxTreeListHeaderWindow (internal) +//----------------------------------------------------------------------------- + +class wxTreeListHeaderWindow : public wxWindow +{ +protected: + wxTreeListMainWindow *m_owner; + wxCursor *m_currentCursor; + wxCursor *m_resizeCursor; + bool m_isDragging; + + // column being resized + int m_column; + + // divider line position in logical (unscrolled) coords + int m_currentX; + + // minimal position beyond which the divider line can't be dragged in + // logical coords + int m_minX; + + wxArrayTreeListColumnInfo m_columns; + + // total width of the columns + int m_total_col_width; + + +public: + wxTreeListHeaderWindow(); + + wxTreeListHeaderWindow( wxWindow *win, + wxWindowID id, + wxTreeListMainWindow *owner, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxT("wxtreelistctrlcolumntitles") ); + + virtual ~wxTreeListHeaderWindow(); + + void DoDrawRect( wxDC *dc, int x, int y, int w, int h ); + void DrawCurrent(); + void AdjustDC(wxDC& dc); + + void OnPaint( wxPaintEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnSetFocus( wxFocusEvent &event ); + + + // columns manipulation + + size_t GetColumnCount() const { return m_columns.GetCount(); } + + void AddColumn(const wxTreeListColumnInfo& col); + + void InsertColumn(size_t before, const wxTreeListColumnInfo& col); + + void RemoveColumn(size_t column); + + void SetColumn(size_t column, const wxTreeListColumnInfo& info); + const wxTreeListColumnInfo& GetColumn(size_t column) const + { + static wxTreeListColumnInfo tmp; + wxCHECK_MSG(column < GetColumnCount(), tmp, wxT("Invalid column")); + return m_columns[column]; + } + wxTreeListColumnInfo& GetColumn(size_t column) + { + static wxTreeListColumnInfo tmp; + wxCHECK_MSG(column < GetColumnCount(), tmp, wxT("Invalid column")); + return m_columns[column]; + } + + void SetColumnWidth(size_t column, size_t width); + + void SetColumnText(size_t column, const wxString& text) + { + wxCHECK_RET(column < GetColumnCount(), wxT("Invalid column")); + m_columns[column].SetText(text); + } + + wxString GetColumnText(size_t column) const + { + wxCHECK_MSG(column < GetColumnCount(), wxEmptyString, wxT("Invalid column")); + return m_columns[column].GetText(); + } + + int GetColumnWidth(size_t column) const + { + wxCHECK_MSG(column < GetColumnCount(), -1, wxT("Invalid column")); + return m_columns[column].GetWidth(); + } + + int GetWidth() const { return m_total_col_width; } + + // needs refresh + bool m_dirty; + +private: + // common part of all ctors + void Init(); + + void SendListEvent(wxEventType type, wxPoint pos); + + DECLARE_DYNAMIC_CLASS(wxTreeListHeaderWindow) + DECLARE_EVENT_TABLE() +}; + + +// this is the "true" control +class wxTreeListMainWindow: public wxScrolledWindow +{ +public: + // creation + // -------- + wxTreeListMainWindow() { Init(); } + + wxTreeListMainWindow(wxTreeListCtrl *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxT("wxtreelistmainwindow")) + { + Init(); + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeListMainWindow(); + + bool Create(wxTreeListCtrl *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxT("wxtreelistctrl")); + + // accessors + // --------- + + // get the total number of items in the control + size_t GetCount() const; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + unsigned int GetIndent() const { return m_indent; } + void SetIndent(unsigned int indent); + + // spacing is the number of pixels between the start and the Text + unsigned int GetSpacing() const { return m_spacing; } + void SetSpacing(unsigned int spacing); + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that when assigned with + // SetImageList, the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. If you use + // AssignImageList, the control _does_ delete the image list. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const; + wxImageList *GetStateImageList() const; + wxImageList *GetButtonsImageList() const; + + void SetImageList(wxImageList *imageList); + void SetStateImageList(wxImageList *imageList); + void SetButtonsImageList(wxImageList *imageList); + void AssignImageList(wxImageList *imageList); + void AssignStateImageList(wxImageList *imageList); + void AssignButtonsImageList(wxImageList *imageList); + + // Functions to work with tree ctrl items. + + // accessors + // --------- + + // retrieve item's label + wxString GetItemText(const wxTreeItemId& item) const + { return GetItemText(item, GetMainColumn()); } + // get one of the images associated with the item (normal by default) + int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const + { return GetItemImage(item, GetMainColumn(), which); } + + // get the data associated with the item + wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + + // modifiers + // --------- + + // set item's label + void SetItemText(const wxTreeItemId& item, const wxString& text) + { SetItemText(item, GetMainColumn(), text); } + + // get one of the images associated with the item (normal by default) + void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) + { SetItemImage(item, GetMainColumn(), image, which); } + + // associate some data with the item + void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); + + // the item will be shown in bold + void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + + // set the item's text colour + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + + // set the item's background colour + void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col); + + // set the item's font (should be of the same height for all items) + void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + // set the window font + virtual bool SetFont( const wxFont &font ); + + // set the styles. No need to specify a GetWindowStyle here since + // the base wxWindow member function will do it for us + void SetWindowStyle(const long styles); + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + bool IsVisible(const wxTreeItemId& item) const; + // does the item has any children? + bool HasChildren(const wxTreeItemId& item) const + { return ItemHasChildren(item); } + bool ItemHasChildren(const wxTreeItemId& item) const; + // is the item expanded (only makes sense if HasChildren())? + bool IsExpanded(const wxTreeItemId& item) const; + // is this item currently selected (the same as has focus)? + bool IsSelected(const wxTreeItemId& item) const; + // is item text in bold font? + bool IsBold(const wxTreeItemId& item) const; + // does the layout include space for a button? + + // number of children + // ------------------ + + // if 'recursively' is FALSE, only immediate children count, otherwise + // the returned number is the number of all items in this branch + size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return FALSE if there is no such item + + // get the root tree item + wxTreeItemId GetRootItem() const { return m_anchor; } + + // get the item currently selected (may return NULL if no selection) + wxTreeItemId GetSelection() const { return m_current; } + + // get the items currently selected, return the number of such item + size_t GetSelections(wxArrayTreeItemIds&) const; + + // get the parent of this item (may return NULL if root) + wxTreeItemId GetParent(const wxTreeItemId& item) const; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const; + // get the next child + wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const; + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + // get the next sibling of this item + wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + // get the previous sibling + wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + // get first visible item + wxTreeItemId GetFirstVisibleItem() const; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + // get the previous visible item: item must be visible itself! + wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // Only for internal use right now, but should probably be public + wxTreeItemId GetNext(const wxTreeItemId& item) const; + + // operations + // ---------- + + // add the root node to the tree + wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item before the one with the given index + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // delete this item and associated data if any + void Delete(const wxTreeItemId& item); + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteChildren(const wxTreeItemId& item); + // delete all items from the tree + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteAllItems(); + + // expand this item + void Expand(const wxTreeItemId& item); + // expand this item and all subitems recursively + void ExpandAll(const wxTreeItemId& item); + // collapse the item without removing its children + void Collapse(const wxTreeItemId& item); + // collapse the item and remove all children + void CollapseAndReset(const wxTreeItemId& item); + // toggles the current state + void Toggle(const wxTreeItemId& item); + + // remove the selection from currently selected item (if any) + void Unselect(); + void UnselectAll(); + // select this item + void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, + bool extended_select=FALSE); + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + void EnsureVisible(const wxTreeItemId& item); + // scroll to this item (but don't expand its parent) + void ScrollTo(const wxTreeItemId& item); + void AdjustMyScrollbars(); + + // The first function is more portable (because easier to implement + // on other platforms), but the second one returns some extra info. + wxTreeItemId HitTest(const wxPoint& point) + { int dummy; return HitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags) + { int col; return HitTest(point, flags, col); } + // ALB + wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column); + + + // get the bounding rectangle of the item (or of its label only) + bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = FALSE) const; + + // Start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. + void EditLabel( const wxTreeItemId& item ) { Edit( item ); } + void Edit( const wxTreeItemId& item ); + + // sorting + // this function is called to compare 2 items and should return -1, 0 + // or +1 if the first item is less than, equal to or greater than the + // second one. The base class version performs alphabetic comparaison + // of item labels (GetText) + virtual int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2); + // sort the children of this item using OnCompareItems + // + // NB: this function is not reentrant and not MT-safe (FIXME)! + void SortChildren(const wxTreeItemId& item); + + // deprecated functions: use Set/GetItemImage directly + // get the selected item image + int GetItemSelectedImage(const wxTreeItemId& item) const + { return GetItemImage(item, wxTreeItemIcon_Selected); } + // set the selected item image + void SetItemSelectedImage(const wxTreeItemId& item, int image) + { SetItemImage(item, image, wxTreeItemIcon_Selected); } + + // implementation only from now on + + // overridden base class virtuals + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); + + // callbacks + void OnPaint( wxPaintEvent &event ); + void OnSetFocus( wxFocusEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnIdle( wxIdleEvent &event ); + void OnSize(wxSizeEvent& event); // ALB + void OnScroll(wxScrollWinEvent& event); // ALB + + // implementation helpers + void SendDeleteEvent(wxTreeListItem *itemBeingDeleted); + + void DrawBorder(const wxTreeItemId& item); + void DrawLine(const wxTreeItemId& item, bool below); + + size_t GetColumnCount() const + { return m_owner->GetHeaderWindow()->GetColumnCount(); } + + void SetMainColumn(size_t column) + { + if(column < GetColumnCount()) + m_main_column = column; + } + size_t GetMainColumn() const { return m_main_column; } + + void SetItemText(const wxTreeItemId& item, size_t column, + const wxString& text); + wxString GetItemText(const wxTreeItemId& item, size_t column) const; + + void SetItemImage(const wxTreeItemId& item, size_t column, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); + int GetItemImage(const wxTreeItemId& item, size_t column, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const; +protected: + wxTreeListCtrl* m_owner; // ALB + + size_t m_main_column; // ALB + + friend class wxTreeListItem; + friend class wxTreeRenameTimer; + friend class wxTreeListTextCtrl; + + wxFont m_normalFont; + wxFont m_boldFont; + + wxTreeListItem *m_anchor; + wxTreeListItem *m_current, *m_key_current, *m_currentEdit; + unsigned short m_indent; + unsigned short m_spacing; + int m_lineHeight; + wxPen m_dottedPen; + wxBrush *m_hilightBrush, + *m_hilightUnfocusedBrush; + bool m_hasFocus; +public: + bool m_dirty; +protected: + bool m_ownsImageListNormal, + m_ownsImageListState, + m_ownsImageListButtons; + bool m_isDragging; // true between BEGIN/END drag events + bool m_renameAccept; + bool m_lastOnSame; // last click on the same item as prev + wxImageList *m_imageListNormal, + *m_imageListState, + *m_imageListButtons; + + int m_dragCount; + wxPoint m_dragStart; + wxTreeListItem *m_dropTarget; + wxCursor m_oldCursor; // cursor is changed while dragging + wxTreeListItem *m_oldSelection; + + wxTimer *m_renameTimer; + wxString m_renameRes; + + // the common part of all ctors + void Init(); + + // misc helpers + wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t previous, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data); + bool HasButtons(void) const + { return (m_imageListButtons != NULL) + || HasFlag(wxTR_TWIST_BUTTONS|wxTR_HAS_BUTTONS); } + +protected: + void CalculateLineHeight(); + int GetLineHeight(wxTreeListItem *item) const; + void PaintLevel( wxTreeListItem *item, wxDC& dc, int level, int &y, + int x_offset); + void PaintItem( wxTreeListItem *item, wxDC& dc); + + void CalculateLevel( wxTreeListItem *item, wxDC &dc, int level, int &y, + int x_offset); + void CalculatePositions(); + void CalculateSize( wxTreeListItem *item, wxDC &dc ); + + void RefreshSubtree( wxTreeListItem *item ); + void RefreshLine( wxTreeListItem *item ); + + // redraw all selected items + void RefreshSelected(); + + // RefreshSelected() recursive helper + void RefreshSelectedUnder(wxTreeListItem *item); + + void OnRenameTimer(); + void OnRenameAccept(); + + void FillArray(wxTreeListItem*, wxArrayTreeItemIds&) const; + void SelectItemRange( wxTreeListItem *item1, wxTreeListItem *item2 ); + bool TagAllChildrenUntilLast(wxTreeListItem *crt_item, + wxTreeListItem *last_item, bool select); + bool TagNextChildren(wxTreeListItem *crt_item, wxTreeListItem *last_item, + bool select); + void UnselectAllChildren( wxTreeListItem *item ); + + void DrawDropEffect(wxTreeListItem *item); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxTreeListMainWindow) +}; + + +// timer used for enabling in-place edit +class wxTreeRenameTimer: public wxTimer +{ +public: + wxTreeRenameTimer( wxTreeListMainWindow *owner ); + + void Notify(); + +private: + wxTreeListMainWindow *m_owner; +}; + +// control used for in-place edit +class wxTreeListTextCtrl: public wxTextCtrl +{ +public: + wxTreeListTextCtrl( wxWindow *parent, + const wxWindowID id, + bool *accept, + wxString *res, + wxTreeListMainWindow *owner, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + int style = wxSIMPLE_BORDER, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxTextCtrlNameStr ); + + void OnChar( wxKeyEvent &event ); + void OnKeyUp( wxKeyEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + +private: + bool *m_accept; + wxString *m_res; + wxTreeListMainWindow *m_owner; + wxString m_startValue; + bool m_finished; + + DECLARE_EVENT_TABLE() +}; + +// a tree item +class wxTreeListItem +{ +public: + // ctors & dtor + wxTreeListItem() { m_data = NULL; } + wxTreeListItem( wxTreeListMainWindow *owner, + wxTreeListItem *parent, + const wxArrayString& text, + int image, + int selImage, + wxTreeItemData *data ); + + ~wxTreeListItem(); + + // trivial accessors + wxArrayTreeListItems& GetChildren() { return m_children; } + + const wxString& GetText() const + { + //return m_text; + static wxString empty = wxEmptyString; + if(m_text.GetCount() > 0) return m_text[0]; + return empty; + } + const wxString& GetText(size_t col) const + { + static wxString empty = wxEmptyString; + if(m_text.GetCount() > col) return m_text[col]; + return empty; + } + int GetImage(wxTreeItemIcon which = wxTreeItemIcon_Normal) const + { return m_images[which]; } + int GetImage(size_t col, wxTreeItemIcon which=wxTreeItemIcon_Normal) const + { + if(col == m_owner->GetMainColumn()) return m_images[which]; + if(col < m_col_images.GetCount()) return m_col_images[col]; + return NO_IMAGE; + } + wxTreeItemData *GetData() const { return m_data; } + + // returns the current image for the item (depending on its + // selected/expanded/whatever state) + int GetCurrentImage() const; + + void SetText( const wxString &text ); + void SetText(size_t col, const wxString& text) // ALB + { + if(col < m_text.GetCount()) + m_text[col] = text; + else if(col < m_owner->GetColumnCount()) { + int howmany = m_owner->GetColumnCount(); + for(int i = m_text.GetCount(); i < howmany; ++i) + m_text.Add(wxEmptyString); + m_text[col] = text; + } + } + void SetImage(int image, wxTreeItemIcon which) { m_images[which] = image; } + void SetImage(size_t col, int image, wxTreeItemIcon which) + { + if(col == m_owner->GetMainColumn()) m_images[which] = image; + else if(col < m_col_images.GetCount()) + m_col_images[col] = image; + else if(col < m_owner->GetColumnCount()) { + int howmany = m_owner->GetColumnCount(); + for(int i = m_col_images.GetCount(); i < howmany; ++i) + m_col_images.Add(NO_IMAGE); + m_col_images[col] = image; + } + } + + void SetData(wxTreeItemData *data) { m_data = data; } + + void SetHasPlus(bool has = TRUE) { m_hasPlus = has; } + + void SetBold(bool bold) { m_isBold = bold; } + + int GetX() const { return m_x; } + int GetY() const { return m_y; } + + void SetX(int x) { m_x = x; } + void SetY(int y) { m_y = y; } + + int GetHeight() const { return m_height; } + int GetWidth() const { return m_width; } + + void SetHeight(int h) { m_height = h; } + void SetWidth(int w) { m_width = w; } + + wxTreeListItem *GetParent() const { return m_parent; } + + // operations + // deletes all children notifying the treectrl about it if !NULL + // pointer given + void DeleteChildren(wxTreeListMainWindow *tree = NULL); + + // get count of all children (and grand children if 'recursively') + size_t GetChildrenCount(bool recursively = TRUE) const; + + void Insert(wxTreeListItem *child, size_t index) + { m_children.Insert(child, index); } + + void GetSize( int &x, int &y, const wxTreeListMainWindow* ); + + // return the item at given position (or NULL if no item), onButton is + // TRUE if the point belongs to the item's button, otherwise it lies + // on the button's label + wxTreeListItem *HitTest( const wxPoint& point, + const wxTreeListMainWindow *, + int &flags, + int level ); + wxTreeListItem *HitTest( const wxPoint& point, + const wxTreeListMainWindow *, + int &flags, int& column /*ALB*/, + int level ); + + void Expand() { m_isCollapsed = FALSE; } + void Collapse() { m_isCollapsed = TRUE; } + + void SetHilight( bool set = TRUE ) { m_hasHilight = set; } + + // status inquiries + bool HasChildren() const { return !m_children.IsEmpty(); } + bool IsSelected() const { return m_hasHilight != 0; } + bool IsExpanded() const { return !m_isCollapsed; } + bool HasPlus() const { return m_hasPlus || HasChildren(); } + bool IsBold() const { return m_isBold != 0; } + + // attributes + // get them - may be NULL + wxTreeItemAttr *GetAttributes() const { return m_attr; } + // get them ensuring that the pointer is not NULL + wxTreeItemAttr& Attr() + { + if ( !m_attr ) + { + m_attr = new wxTreeItemAttr; + m_ownsAttr = TRUE; + } + return *m_attr; + } + // set them + void SetAttributes(wxTreeItemAttr *attr) + { + if ( m_ownsAttr ) delete m_attr; + m_attr = attr; + m_ownsAttr = FALSE; + } + // set them and delete when done + void AssignAttributes(wxTreeItemAttr *attr) + { + SetAttributes(attr); + m_ownsAttr = TRUE; + } + +private: + wxTreeListMainWindow *m_owner; // control the item belongs to + + // since there can be very many of these, we save size by chosing + // the smallest representation for the elements and by ordering + // the members to avoid padding. + wxArrayString m_text; // labels to be rendered for item + + wxTreeItemData *m_data; // user-provided data + + wxArrayTreeListItems m_children; // list of children + wxTreeListItem *m_parent; // parent of this item + + wxTreeItemAttr *m_attr; // attributes??? + + // tree ctrl images for the normal, selected, expanded and + // expanded+selected states + short m_images[wxTreeItemIcon_Max]; + wxArrayShort m_col_images; // images for the various columns (!= main) + + wxCoord m_x; // (virtual) offset from top + short m_y; // (virtual) offset from left + short m_width; // width of this item + unsigned char m_height; // height of this item + + // use bitfields to save size + int m_isCollapsed :1; + int m_hasHilight :1; // same as focused + int m_hasPlus :1; // used for item which doesn't have + // children but has a [+] button + int m_isBold :1; // render the label in bold font + int m_ownsAttr :1; // delete attribute when done +}; + +// =========================================================================== +// implementation +// =========================================================================== + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// translate the key or mouse event flags to the type of selection we're +// dealing with +static void EventFlagsToSelType(long style, + bool shiftDown, + bool ctrlDown, + bool &is_multiple, + bool &extended_select, + bool &unselect_others) +{ + is_multiple = (style & wxTR_MULTIPLE) != 0; + extended_select = shiftDown && is_multiple; + unselect_others = !(extended_select || (ctrlDown && is_multiple)); +} + +// --------------------------------------------------------------------------- +// wxTreeRenameTimer (internal) +// --------------------------------------------------------------------------- + +wxTreeRenameTimer::wxTreeRenameTimer( wxTreeListMainWindow *owner ) +{ + m_owner = owner; +} + +void wxTreeRenameTimer::Notify() +{ + m_owner->OnRenameTimer(); +} + +//----------------------------------------------------------------------------- +// wxTreeListTextCtrl (internal) +//----------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxTreeListTextCtrl,wxTextCtrl) + EVT_CHAR (wxTreeListTextCtrl::OnChar) + EVT_KEY_UP (wxTreeListTextCtrl::OnKeyUp) + EVT_KILL_FOCUS (wxTreeListTextCtrl::OnKillFocus) +END_EVENT_TABLE() + +wxTreeListTextCtrl::wxTreeListTextCtrl( wxWindow *parent, + const wxWindowID id, + bool *accept, + wxString *res, + wxTreeListMainWindow *owner, + const wxString &value, + const wxPoint &pos, + const wxSize &size, + int style, + const wxValidator& validator, + const wxString &name ) + : wxTextCtrl( parent, id, value, pos, size, style, validator, name ) +{ + m_res = res; + m_accept = accept; + m_owner = owner; + (*m_accept) = FALSE; + (*m_res) = wxEmptyString; + m_startValue = value; + m_finished = FALSE; +} + +void wxTreeListTextCtrl::OnChar( wxKeyEvent &event ) +{ + if (event.m_keyCode == WXK_RETURN) + { + (*m_accept) = TRUE; + (*m_res) = GetValue(); + + if ((*m_res) != m_startValue) + m_owner->OnRenameAccept(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + m_finished = TRUE; + m_owner->SetFocus(); // This doesn't work. TODO. + + return; + } + if (event.m_keyCode == WXK_ESCAPE) + { + (*m_accept) = FALSE; + (*m_res) = wxEmptyString; + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + m_finished = TRUE; + m_owner->SetFocus(); // This doesn't work. TODO. + + return; + } + event.Skip(); +} + +void wxTreeListTextCtrl::OnKeyUp( wxKeyEvent &event ) +{ + if (m_finished) + { + event.Skip(); + return; + } + + // auto-grow the textctrl: + wxSize parentSize = m_owner->GetSize(); + wxPoint myPos = GetPosition(); + wxSize mySize = GetSize(); + int sx, sy; + GetTextExtent(GetValue() + _T("M"), &sx, &sy); + if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x; + if (mySize.x > sx) sx = mySize.x; + SetSize(sx, -1); + + event.Skip(); +} + +void wxTreeListTextCtrl::OnKillFocus( wxFocusEvent &event ) +{ + if (m_finished) + { + event.Skip(); + return; + } + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + (*m_accept) = TRUE; + (*m_res) = GetValue(); + + if ((*m_res) != m_startValue) + m_owner->OnRenameAccept(); +} + +//----------------------------------------------------------------------------- +// wxTreeListHeaderWindow +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow,wxWindow); + +BEGIN_EVENT_TABLE(wxTreeListHeaderWindow,wxWindow) + EVT_PAINT (wxTreeListHeaderWindow::OnPaint) + EVT_MOUSE_EVENTS (wxTreeListHeaderWindow::OnMouse) + EVT_SET_FOCUS (wxTreeListHeaderWindow::OnSetFocus) +END_EVENT_TABLE() + +void wxTreeListHeaderWindow::Init() +{ + m_currentCursor = (wxCursor *) NULL; + m_isDragging = FALSE; + m_dirty = FALSE; +} + +wxTreeListHeaderWindow::wxTreeListHeaderWindow() +{ + Init(); + + m_owner = (wxTreeListMainWindow *) NULL; + m_resizeCursor = (wxCursor *) NULL; +} + +wxTreeListHeaderWindow::wxTreeListHeaderWindow( wxWindow *win, + wxWindowID id, + wxTreeListMainWindow *owner, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString &name ) + : wxWindow( win, id, pos, size, style, name ) +{ + Init(); + + m_owner = owner; + m_resizeCursor = new wxCursor(wxCURSOR_SIZEWE); + + SetBackgroundColour(wxSystemSettings::GetSystemColour( + wxSYS_COLOUR_BTNFACE)); +} + +wxTreeListHeaderWindow::~wxTreeListHeaderWindow() +{ + delete m_resizeCursor; +} + +void wxTreeListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) +{ +#ifdef __WXGTK__ + GtkStateType state = m_parent->IsEnabled() ? GTK_STATE_NORMAL + : GTK_STATE_INSENSITIVE; + + x = dc->XLOG2DEV( x ); + + gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, + state, GTK_SHADOW_OUT, + (GdkRectangle*) NULL, m_wxwindow, "button", + x-1, y-1, w+2, h+2); +#elif defined( __WXMAC__ ) + const int m_corner = 1; + + dc->SetBrush( *wxTRANSPARENT_BRUSH ); + + dc->SetPen( wxPen(wxSystemSettings::GetSystemColour( + wxSYS_COLOUR_BTNSHADOW), 1, wxSOLID)); + dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer) + dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer) + + wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID ); + + dc->SetPen( pen ); + dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner) + dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner) + + dc->SetPen( *wxWHITE_PEN ); + dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer) + dc->DrawRectangle( x, y, 1, h ); // left (outer) + dc->DrawLine( x, y+h-1, x+1, y+h-1 ); + dc->DrawLine( x+w-1, y, x+w-1, y+1 ); +#else // !GTK, !Mac + const int m_corner = 1; + + dc->SetBrush( *wxTRANSPARENT_BRUSH ); + + dc->SetPen( *wxBLACK_PEN ); + dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer) + dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer) + + wxPen pen(wxSystemSettings::GetSystemColour( + wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID); + + dc->SetPen( pen ); + dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner) + dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner) + + dc->SetPen( *wxWHITE_PEN ); + dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer) + dc->DrawRectangle( x, y, 1, h ); // left (outer) + dc->DrawLine( x, y+h-1, x+1, y+h-1 ); + dc->DrawLine( x+w-1, y, x+w-1, y+1 ); +#endif +} + +// shift the DC origin to match the position of the main window horz +// scrollbar: this allows us to always use logical coords +void wxTreeListHeaderWindow::AdjustDC(wxDC& dc) +{ + int xpix; + m_owner->GetScrollPixelsPerUnit( &xpix, NULL ); + + int x; + m_owner->GetViewStart( &x, NULL ); + + // account for the horz scrollbar offset + dc.SetDeviceOrigin( -x * xpix, 0 ); +} + +void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) +{ + static const int HEADER_OFFSET_X = 1, HEADER_OFFSET_Y = 1; +#ifdef __WXGTK__ + wxClientDC dc( this ); +#else + wxPaintDC dc( this ); +#endif + + PrepareDC( dc ); + AdjustDC( dc ); + + dc.BeginDrawing(); + + dc.SetFont( GetFont() ); + + // width and height of the entire header window + int w, h; + GetClientSize( &w, &h ); + m_owner->CalcUnscrolledPosition(w, 0, &w, NULL); + + dc.SetBackgroundMode(wxTRANSPARENT); + + // do *not* use the listctrl colour for headers - one day we will have a + // function to set it separately + //dc.SetTextForeground( *wxBLACK ); + dc.SetTextForeground(wxSystemSettings:: + GetSystemColour( wxSYS_COLOUR_WINDOWTEXT )); + + int x = HEADER_OFFSET_X; + + int numColumns = GetColumnCount(); + for ( int i = 0; i < numColumns && x < w; i++ ) + { + wxTreeListColumnInfo& column = GetColumn(i); + int wCol = column.GetWidth(); + + // the width of the rect to draw: make it smaller to fit entirely + // inside the column rect + int cw = wCol - 2; + + dc.SetPen( *wxWHITE_PEN ); + + DoDrawRect( &dc, x, HEADER_OFFSET_Y, cw, h-2 ); + + // if we have an image, draw it on the right of the label + int image = column.GetImage(); //item.m_image; + int ix = -2, iy = 0; + wxImageList* imageList = m_owner->GetImageList(); + if(image != -1) { + if(imageList) { + imageList->GetSize(image, ix, iy); + } + //else: ignore the column image + } + + // extra margins around the text label + static const int EXTRA_WIDTH = 3; + static const int EXTRA_HEIGHT = 4; + + int text_width = 0; + int text_x = x; + int image_offset = cw - ix - 1; + + switch(column.GetAlignment()) { + case wxTL_ALIGN_LEFT: + text_x += EXTRA_WIDTH; + cw -= ix + 2; + break; + case wxTL_ALIGN_RIGHT: + dc.GetTextExtent(column.GetText(), &text_width, NULL); + text_x += cw - text_width - EXTRA_WIDTH; + image_offset = 0; + break; + case wxTL_ALIGN_CENTER: + dc.GetTextExtent(column.GetText(), &text_width, NULL); + text_x += (cw - text_width)/2 + ix + 2; + image_offset = (cw - text_width - ix - 2)/2; + break; + } + + // draw the image + if(image != -1 && imageList) { + imageList->Draw(image, dc, x + image_offset/*cw - ix - 1*/, + HEADER_OFFSET_Y + (h - 4 - iy)/2, + wxIMAGELIST_DRAW_TRANSPARENT); + } + + // draw the text clipping it so that it doesn't overwrite the column + // boundary + wxDCClipper clipper(dc, x, HEADER_OFFSET_Y, cw, h - 4 ); + + dc.DrawText( column.GetText(), + text_x, HEADER_OFFSET_Y + EXTRA_HEIGHT ); + + x += wCol; + } + + dc.EndDrawing(); +} + +void wxTreeListHeaderWindow::DrawCurrent() +{ + int x1 = m_currentX; + int y1 = 0; + ClientToScreen( &x1, &y1 ); + + int x2 = m_currentX-1; +#ifdef __WXMSW__ + ++x2; // but why ? +#endif + int y2 = 0; + m_owner->GetClientSize( NULL, &y2 ); + m_owner->ClientToScreen( &x2, &y2 ); + + wxScreenDC dc; + dc.SetLogicalFunction( wxINVERT ); + dc.SetPen( wxPen( *wxBLACK, 2, wxSOLID ) ); + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + + AdjustDC(dc); + + dc.DrawLine( x1, y1, x2, y2 ); + + dc.SetLogicalFunction( wxCOPY ); + + dc.SetPen( wxNullPen ); + dc.SetBrush( wxNullBrush ); +} + +void wxTreeListHeaderWindow::OnMouse( wxMouseEvent &event ) +{ + // we want to work with logical coords + int x; + m_owner->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL); + int y = event.GetY(); + + if (m_isDragging) + { + SendListEvent(wxEVT_COMMAND_LIST_COL_DRAGGING, + event.GetPosition()); + + // we don't draw the line beyond our window, but we allow dragging it + // there + int w = 0; + GetClientSize( &w, NULL ); + m_owner->CalcUnscrolledPosition(w, 0, &w, NULL); + w -= 6; + + // erase the line if it was drawn + if ( m_currentX < w ) + DrawCurrent(); + + if (event.ButtonUp()) + { + ReleaseMouse(); + m_isDragging = FALSE; + m_dirty = TRUE; + SetColumnWidth( m_column, m_currentX - m_minX ); + Refresh(); + SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG, + event.GetPosition()); + } + else + { + if (x > m_minX + 7) + m_currentX = x; + else + m_currentX = m_minX + 7; + + // draw in the new location + if ( m_currentX < w ) + DrawCurrent(); + } + } + else // not dragging + { + m_minX = 0; + bool hit_border = FALSE; + + // end of the current column + int xpos = 0; + + // find the column where this event occured + int countCol = GetColumnCount(); + for (int col = 0; col < countCol; col++) + { + xpos += GetColumnWidth( col ); + m_column = col; + + if ( (abs(x-xpos) < 3) && (y < 22) ) + { + // near the column border + hit_border = TRUE; + break; + } + + if ( x < xpos ) + { + // inside the column + break; + } + + m_minX = xpos; + } + + if (event.LeftDown() || event.RightUp()) + { + if (hit_border && event.LeftDown()) + { + m_isDragging = TRUE; + m_currentX = x; + DrawCurrent(); + CaptureMouse(); + SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, + event.GetPosition()); + } + else // click on a column + { + SendListEvent( event.LeftDown() + ? wxEVT_COMMAND_LIST_COL_CLICK + : wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, + event.GetPosition()); + } + } + else if (event.Moving()) + { + bool setCursor; + if (hit_border) + { + setCursor = m_currentCursor == wxSTANDARD_CURSOR; + m_currentCursor = m_resizeCursor; + } + else + { + setCursor = m_currentCursor != wxSTANDARD_CURSOR; + m_currentCursor = wxSTANDARD_CURSOR; + } + + if ( setCursor ) + SetCursor(*m_currentCursor); + } + } +} + +void wxTreeListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) +{ + m_owner->SetFocus(); +} + +void wxTreeListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos) +{ + wxWindow *parent = GetParent(); + wxListEvent le( type, parent->GetId() ); + le.SetEventObject( parent ); + le.m_pointDrag = pos; + + // the position should be relative to the parent window, not + // this one for compatibility with MSW and common sense: the + // user code doesn't know anything at all about this header + // window, so why should it get positions relative to it? + le.m_pointDrag.y -= GetSize().y; + + le.m_col = m_column; + parent->GetEventHandler()->ProcessEvent( le ); +} + +inline +void wxTreeListHeaderWindow::AddColumn(const wxTreeListColumnInfo& col) +{ + m_columns.Add(col); + m_total_col_width += col.GetWidth(); + //m_owner->GetHeaderWindow()->Refresh(); + //m_dirty = TRUE; + m_owner->AdjustMyScrollbars(); + m_owner->m_dirty = TRUE; + Refresh(); +} + +inline +void wxTreeListHeaderWindow::SetColumnWidth(size_t column, size_t width) +{ + if(column < GetColumnCount()) { + m_total_col_width -= m_columns[column].GetWidth(); + m_columns[column].SetWidth(width); + m_total_col_width += width; + m_owner->AdjustMyScrollbars(); + m_owner->m_dirty = TRUE; + //m_dirty = TRUE; + Refresh(); + } +} + + +inline +void wxTreeListHeaderWindow::InsertColumn(size_t before, + const wxTreeListColumnInfo& col) +{ + wxCHECK_RET(before < GetColumnCount(), wxT("Invalid column index")); + m_columns.Insert(col, before); + m_total_col_width += col.GetWidth(); + //m_dirty = TRUE; + //m_owner->GetHeaderWindow()->Refresh(); + m_owner->AdjustMyScrollbars(); + m_owner->m_dirty = TRUE; + Refresh(); +} + +inline +void wxTreeListHeaderWindow::RemoveColumn(size_t column) +{ + wxCHECK_RET(column < GetColumnCount(), wxT("Invalid column")); + m_total_col_width -= m_columns[column].GetWidth(); + m_columns.RemoveAt(column); + //m_dirty = TRUE; + m_owner->AdjustMyScrollbars(); + m_owner->m_dirty = TRUE; + Refresh(); +} + +inline +void wxTreeListHeaderWindow::SetColumn(size_t column, + const wxTreeListColumnInfo& info) +{ + wxCHECK_RET(column < GetColumnCount(), wxT("Invalid column")); + size_t w = m_columns[column].GetWidth(); + m_columns[column] = info; + //m_owner->GetHeaderWindow()->Refresh(); + //m_dirty = TRUE; + if(w != info.GetWidth()) { + m_total_col_width += info.GetWidth() - w; + m_owner->AdjustMyScrollbars(); + m_owner->m_dirty = TRUE; + } + Refresh(); +} + +// --------------------------------------------------------------------------- +// wxTreeListItem +// --------------------------------------------------------------------------- + +wxTreeListItem::wxTreeListItem(wxTreeListMainWindow *owner, + wxTreeListItem *parent, + const wxArrayString& text, + int image, int selImage, + wxTreeItemData *data) + : m_text(text) +{ + m_images[wxTreeItemIcon_Normal] = image; + m_images[wxTreeItemIcon_Selected] = selImage; + m_images[wxTreeItemIcon_Expanded] = NO_IMAGE; + m_images[wxTreeItemIcon_SelectedExpanded] = NO_IMAGE; + + m_data = data; + m_x = m_y = 0; + + m_isCollapsed = TRUE; + m_hasHilight = FALSE; + m_hasPlus = FALSE; + m_isBold = FALSE; + + m_owner = owner; + + m_parent = parent; + + m_attr = (wxTreeItemAttr *)NULL; + m_ownsAttr = FALSE; + + // We don't know the height here yet. + m_width = 0; + m_height = 0; +} + +wxTreeListItem::~wxTreeListItem() +{ + delete m_data; + + if (m_ownsAttr) delete m_attr; + + wxASSERT_MSG( m_children.IsEmpty(), + wxT("please call DeleteChildren() before deleting the item") ); +} + +void wxTreeListItem::DeleteChildren(wxTreeListMainWindow *tree) +{ + size_t count = m_children.Count(); + for ( size_t n = 0; n < count; n++ ) + { + wxTreeListItem *child = m_children[n]; + if (tree) + tree->SendDeleteEvent(child); + + child->DeleteChildren(tree); + delete child; + } + + m_children.Empty(); +} + +void wxTreeListItem::SetText( const wxString &text ) +{ + if(m_text.GetCount() > 0) m_text[0] = text; + else { + m_text.Add(text); + } +} + +size_t wxTreeListItem::GetChildrenCount(bool recursively) const +{ + size_t count = m_children.Count(); + if ( !recursively ) + return count; + + size_t total = count; + for (size_t n = 0; n < count; ++n) + { + total += m_children[n]->GetChildrenCount(); + } + + return total; +} + +void wxTreeListItem::GetSize( int &x, int &y, + const wxTreeListMainWindow *theButton ) +{ + int bottomY=m_y+theButton->GetLineHeight(this); + if ( y < bottomY ) y = bottomY; + int width = m_x + m_width; + if ( x < width ) x = width; + + if (IsExpanded()) + { + size_t count = m_children.Count(); + for ( size_t n = 0; n < count; ++n ) + { + m_children[n]->GetSize( x, y, theButton ); + } + } +} + +wxTreeListItem *wxTreeListItem::HitTest(const wxPoint& point, + const wxTreeListMainWindow *theCtrl, + int &flags, + int level) +{ + // for a hidden root node, don't evaluate it, but do evaluate children + if ( !(level == 0 && theCtrl->HasFlag(wxTR_HIDE_ROOT)) ) + { + // evaluate the item + int h = theCtrl->GetLineHeight(this); + if ((point.y > m_y) && (point.y < m_y + h)) + { + int y_mid = m_y + h/2; + if (point.y < y_mid ) + flags |= wxTREE_HITTEST_ONITEMUPPERPART; + else + flags |= wxTREE_HITTEST_ONITEMLOWERPART; + + // 5 is the size of the plus sign + int xCross = m_x - theCtrl->GetSpacing(); + if ((point.x > xCross-5) && (point.x < xCross+5) && + (point.y > y_mid-5) && (point.y < y_mid+5) && + HasPlus() && theCtrl->HasButtons() ) + { + flags |= wxTREE_HITTEST_ONITEMBUTTON; + return this; + } + + if ((point.x >= m_x) && (point.x <= m_x+m_width)) + { + int image_w = -1; + int image_h; + + //assuming every image (normal and selected) has the same size! + if ( (GetImage() != NO_IMAGE) && theCtrl->m_imageListNormal ) + theCtrl->m_imageListNormal->GetSize(GetImage(), + image_w, image_h); + + if ((image_w != -1) && (point.x <= m_x + image_w + 1)) + flags |= wxTREE_HITTEST_ONITEMICON; + else + flags |= wxTREE_HITTEST_ONITEMLABEL; + + return this; + } + + if (point.x < m_x) + flags |= wxTREE_HITTEST_ONITEMINDENT; + if (point.x > m_x+m_width) + flags |= wxTREE_HITTEST_ONITEMRIGHT; + + return this; + } + + // if children are expanded, fall through to evaluate them + if (m_isCollapsed) return (wxTreeListItem*) NULL; + } + + // evaluate children + size_t count = m_children.Count(); + for ( size_t n = 0; n < count; n++ ) + { + wxTreeListItem *res = m_children[n]->HitTest(point, theCtrl, + flags, level + 1); + if ( res != NULL ) + return res; + } + + return (wxTreeListItem*) NULL; +} + +// ALB +wxTreeListItem *wxTreeListItem::HitTest(const wxPoint& point, + const wxTreeListMainWindow *theCtrl, + int &flags, int& column, int level) +{ + column = -1; + wxTreeListItem* res = HitTest(point, theCtrl, flags, level); + + if(!res) return res; + if(flags & wxTREE_HITTEST_ONITEMINDENT) { + int x = 0; + for(size_t i = 0; i < theCtrl->GetMainColumn(); ++i) { + int w = theCtrl->m_owner->GetHeaderWindow()->GetColumnWidth(i); + if(point.x >= x && point.x < x+w) { + flags ^= wxTREE_HITTEST_ONITEMINDENT; + flags |= wxTREE_HITTEST_ONITEMCOLUMN; + column = i; + return res; + } + } + } + else if(flags & wxTREE_HITTEST_ONITEMRIGHT) { + int x = 0; + for(size_t i = 0; i < theCtrl->GetMainColumn()+1; ++i) { + x += theCtrl->m_owner->GetHeaderWindow()->GetColumnWidth(i); + } + for(size_t i = theCtrl->GetMainColumn()+1; + i < theCtrl->GetColumnCount(); ++i) { + int w = theCtrl->m_owner->GetHeaderWindow()->GetColumnWidth(i); + if(point.x >= x && point.x < x+w) { + flags ^= wxTREE_HITTEST_ONITEMRIGHT; + flags |= wxTREE_HITTEST_ONITEMCOLUMN; + column = i; + return res; + } + } + } + + return res; +} + + +int wxTreeListItem::GetCurrentImage() const +{ + int image = NO_IMAGE; + if ( IsExpanded() ) + { + if ( IsSelected() ) + { + image = GetImage(wxTreeItemIcon_SelectedExpanded); + } + + if ( image == NO_IMAGE ) + { + // we usually fall back to the normal item, but try just the + // expanded one (and not selected) first in this case + image = GetImage(wxTreeItemIcon_Expanded); + } + } + else // not expanded + { + if ( IsSelected() ) + image = GetImage(wxTreeItemIcon_Selected); + } + + // maybe it doesn't have the specific image we want, + // try the default one instead + if ( image == NO_IMAGE ) image = GetImage(); + + return image; +} + +// --------------------------------------------------------------------------- +// wxTreeListMainWindow implementation +// --------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTreeListMainWindow, wxScrolledWindow) + +BEGIN_EVENT_TABLE(wxTreeListMainWindow, wxScrolledWindow) + EVT_PAINT (wxTreeListMainWindow::OnPaint) + EVT_MOUSE_EVENTS (wxTreeListMainWindow::OnMouse) + EVT_CHAR (wxTreeListMainWindow::OnChar) + EVT_SET_FOCUS (wxTreeListMainWindow::OnSetFocus) + EVT_KILL_FOCUS (wxTreeListMainWindow::OnKillFocus) + EVT_IDLE (wxTreeListMainWindow::OnIdle) + //EVT_SIZE (wxTreeListMainWindow::OnSize) + EVT_SCROLLWIN (wxTreeListMainWindow::OnScroll) +END_EVENT_TABLE() + + +// --------------------------------------------------------------------------- +// construction/destruction +// --------------------------------------------------------------------------- + +void wxTreeListMainWindow::Init() +{ + m_current = m_key_current = m_anchor = (wxTreeListItem *) NULL; + m_hasFocus = FALSE; + m_dirty = FALSE; + + m_lineHeight = 10; + m_indent = 9; + m_spacing = 9; + + m_hilightBrush = new wxBrush + ( + wxSystemSettings::GetSystemColour + ( + wxSYS_COLOUR_HIGHLIGHT + ), + wxSOLID + ); + + m_hilightUnfocusedBrush = new wxBrush + ( + wxSystemSettings::GetSystemColour + ( + wxSYS_COLOUR_BTNSHADOW + ), + wxSOLID + ); + + m_imageListNormal = m_imageListButtons = + m_imageListState = (wxImageList *) NULL; + m_ownsImageListNormal = m_ownsImageListButtons = + m_ownsImageListState = FALSE; + + m_dragCount = 0; + m_isDragging = FALSE; + m_dropTarget = m_oldSelection = (wxTreeListItem *)NULL; + + m_renameTimer = new wxTreeRenameTimer( this ); + m_lastOnSame = FALSE; + + m_normalFont = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ); + m_boldFont = wxFont( m_normalFont.GetPointSize(), + m_normalFont.GetFamily(), + m_normalFont.GetStyle(), + wxBOLD, + m_normalFont.GetUnderlined()); +} + + +static const int HEADER_HEIGHT = 23; + +bool wxTreeListMainWindow::Create(wxTreeListCtrl *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator &validator, + const wxString& name ) +{ +#ifdef __WXMAC__ + int major,minor; + wxGetOsVersion( &major, &minor ); + + if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS; + if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS; + style &= ~wxTR_LINES_AT_ROOT; + style |= wxTR_NO_LINES; + if (major < 10) + style |= wxTR_ROW_LINES; +#endif + + wxScrolledWindow::Create( parent, id, pos, size, + style|wxHSCROLL|wxVSCROLL, name ); + + // If the tree display has no buttons, but does have + // connecting lines, we can use a narrower layout. + // It may not be a good idea to force this... + if (!HasButtons() && !HasFlag(wxTR_NO_LINES)) + { + m_indent= 10; + m_spacing = 10; + } + +#if wxUSE_VALIDATORS + SetValidator( validator ); +#endif + + SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) ); + +#ifdef __WXMSW__ + m_dottedPen = wxPen( "black", 0, wxDOT ); // too slow under XFree86 +#else + m_dottedPen = wxPen( wxT("grey"), 0, 0 ); +#endif + + // ALB + m_owner = parent; + m_main_column = 0; + + return TRUE; +} + +wxTreeListMainWindow::~wxTreeListMainWindow() +{ + delete m_hilightBrush; + delete m_hilightUnfocusedBrush; + + DeleteAllItems(); + + delete m_renameTimer; + if (m_ownsImageListNormal) delete m_imageListNormal; + if (m_ownsImageListState) delete m_imageListState; + if (m_ownsImageListButtons) delete m_imageListButtons; +} + + + +//----------------------------------------------------------------------------- +// accessors +//----------------------------------------------------------------------------- + +inline +size_t wxTreeListMainWindow::GetCount() const +{ + return m_anchor == NULL ? 0u : m_anchor->GetChildrenCount(); +} + +inline +void wxTreeListMainWindow::SetIndent(unsigned int indent) +{ + m_indent = indent; + m_dirty = TRUE; +} + +inline +void wxTreeListMainWindow::SetSpacing(unsigned int spacing) +{ + m_spacing = spacing; + m_dirty = TRUE; +} + +inline +size_t wxTreeListMainWindow::GetChildrenCount(const wxTreeItemId& item, + bool recursively) +{ + wxCHECK_MSG( item.IsOk(), 0u, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->GetChildrenCount(recursively); +} + +void wxTreeListMainWindow::SetWindowStyle(const long styles) +{ + // right now, just sets the styles. Eventually, we may + // want to update the inherited styles, but right now + // none of the parents has updatable styles + m_windowStyle = styles; + m_dirty = TRUE; +} + +//----------------------------------------------------------------------------- +// functions to work with tree items +//----------------------------------------------------------------------------- + +inline +int wxTreeListMainWindow::GetItemImage(const wxTreeItemId& item, size_t column, + wxTreeItemIcon which) const +{ + wxCHECK_MSG( item.IsOk(), -1, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->GetImage(column, which); +} + +inline +wxTreeItemData *wxTreeListMainWindow::GetItemData(const wxTreeItemId& item) + const +{ + wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->GetData(); +} + +inline +void wxTreeListMainWindow::SetItemImage(const wxTreeItemId& item, + size_t column, + int image, wxTreeItemIcon which) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->SetImage(column, image, which); + + wxClientDC dc(this); + CalculateSize(pItem, dc); + RefreshLine(pItem); +} + +inline +void wxTreeListMainWindow::SetItemData(const wxTreeItemId& item, + wxTreeItemData *data) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + ((wxTreeListItem*) item.m_pItem)->SetData(data); +} + +inline +void wxTreeListMainWindow::SetItemHasChildren(const wxTreeItemId& item, + bool has) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->SetHasPlus(has); + RefreshLine(pItem); +} + +inline +void wxTreeListMainWindow::SetItemBold(const wxTreeItemId& item, bool bold) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + // avoid redrawing the tree if no real change + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + if ( pItem->IsBold() != bold ) + { + pItem->SetBold(bold); + RefreshLine(pItem); + } +} + +inline +void wxTreeListMainWindow::SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->Attr().SetTextColour(col); + RefreshLine(pItem); +} + +inline +void wxTreeListMainWindow::SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->Attr().SetBackgroundColour(col); + RefreshLine(pItem); +} + +inline +void wxTreeListMainWindow::SetItemFont(const wxTreeItemId& item, + const wxFont& font) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->Attr().SetFont(font); + RefreshLine(pItem); +} + +inline +bool wxTreeListMainWindow::SetFont( const wxFont &font ) +{ + wxScrolledWindow::SetFont(font); + + m_normalFont = font ; + m_boldFont = wxFont( m_normalFont.GetPointSize(), + m_normalFont.GetFamily(), + m_normalFont.GetStyle(), + wxBOLD, + m_normalFont.GetUnderlined()); + + return TRUE; +} + + +// ---------------------------------------------------------------------------- +// item status inquiries +// ---------------------------------------------------------------------------- + +inline +bool wxTreeListMainWindow::IsVisible(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); + + // An item is only visible if it's not a descendant of a collapsed item + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + wxTreeListItem* parent = pItem->GetParent(); + while (parent) + { + if (!parent->IsExpanded()) + return FALSE; + parent = parent->GetParent(); + } + + int startX, startY; + GetViewStart(& startX, & startY); + + wxSize clientSize = GetClientSize(); + + wxRect rect; + if (!GetBoundingRect(item, rect)) + return FALSE; + if (rect.GetWidth() == 0 || rect.GetHeight() == 0) + return FALSE; + if (rect.GetBottom() < 0 || rect.GetTop() > clientSize.y) + return FALSE; + if (rect.GetRight() < 0 || rect.GetLeft() > clientSize.x) + return FALSE; + + return TRUE; +} + +inline +bool wxTreeListMainWindow::ItemHasChildren(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); + + // consider that the item does have children if it has the "+" button: it + // might not have them (if it had never been expanded yet) but then it + // could have them as well and it's better to err on this side rather than + // disabling some operations which are restricted to the items with + // children for an item which does have them + return ((wxTreeListItem*) item.m_pItem)->HasPlus(); +} + +inline +bool wxTreeListMainWindow::IsExpanded(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->IsExpanded(); +} + +inline +bool wxTreeListMainWindow::IsSelected(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->IsSelected(); +} + +inline +bool wxTreeListMainWindow::IsBold(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->IsBold(); +} + +// ---------------------------------------------------------------------------- +// navigation +// ---------------------------------------------------------------------------- + +inline +wxTreeItemId wxTreeListMainWindow::GetParent(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->GetParent(); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetFirstChild(const wxTreeItemId& item, + long& cookie) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + cookie = 0; + return GetNextChild(item, cookie); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetNextChild(const wxTreeItemId& item, + long& cookie) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxArrayTreeListItems& children = ((wxTreeListItem*) + item.m_pItem)->GetChildren(); + if ( (size_t)cookie < children.Count() ) + { + return children.Item((size_t)cookie++); + } + else + { + // there are no more of them + return wxTreeItemId(); + } +} + +inline +wxTreeItemId wxTreeListMainWindow::GetLastChild(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxArrayTreeListItems& children = ((wxTreeListItem*) item.m_pItem)->GetChildren(); + return (children.IsEmpty() ? wxTreeItemId() : wxTreeItemId(children.Last())); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetNextSibling(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + wxTreeListItem *parent = i->GetParent(); + if ( parent == NULL ) + { + // root item doesn't have any siblings + return wxTreeItemId(); + } + + wxArrayTreeListItems& siblings = parent->GetChildren(); + int index = siblings.Index(i); + wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? + + size_t n = (size_t)(index + 1); + return n == siblings.Count() ? wxTreeItemId() : wxTreeItemId(siblings[n]); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetPrevSibling(const wxTreeItemId& item) + const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + wxTreeListItem *parent = i->GetParent(); + if ( parent == NULL ) + { + // root item doesn't have any siblings + return wxTreeItemId(); + } + + wxArrayTreeListItems& siblings = parent->GetChildren(); + int index = siblings.Index(i); + wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? + + return index == 0 ? wxTreeItemId() + : wxTreeItemId(siblings[(size_t)(index - 1)]); +} + +// Only for internal use right now, but should probably be public +wxTreeItemId wxTreeListMainWindow::GetNext(const wxTreeItemId& item) const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + + // First see if there are any children. + wxArrayTreeListItems& children = i->GetChildren(); + if (children.GetCount() > 0) + { + return children.Item(0); + } + else + { + // Try a sibling of this or ancestor instead + wxTreeItemId p = item; + wxTreeItemId toFind; + do + { + toFind = GetNextSibling(p); + p = GetParent(p); + } while (p.IsOk() && !toFind.IsOk()); + return toFind; + } +} + +inline +wxTreeItemId wxTreeListMainWindow::GetFirstVisibleItem() const +{ + wxTreeItemId id = GetRootItem(); + if (!id.IsOk()) + return id; + + do + { + if (IsVisible(id)) + return id; + id = GetNext(id); + } while (id.IsOk()); + + return wxTreeItemId(); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetNextVisible(const wxTreeItemId& item) + const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxTreeItemId id = item; + if (id.IsOk()) + { + while (id = GetNext(id), id.IsOk()) + { + if (IsVisible(id)) + return id; + } + } + return wxTreeItemId(); +} + +inline +wxTreeItemId wxTreeListMainWindow::GetPrevVisible(const wxTreeItemId& item) + const +{ + wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); + + wxFAIL_MSG(wxT("not implemented")); + + return wxTreeItemId(); +} + +// ---------------------------------------------------------------------------- +// operations +// ---------------------------------------------------------------------------- + +wxTreeItemId wxTreeListMainWindow::DoInsertItem(const wxTreeItemId& parentId, + size_t previous, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + wxTreeListItem *parent = (wxTreeListItem*) parentId.m_pItem; + if ( !parent ) + { + // should we give a warning here? + return AddRoot(text, image, selImage, data); + } + + m_dirty = TRUE; // do this first so stuff below doesn't cause flicker + + // ALB + wxArrayString arr; + arr.Alloc(GetColumnCount()); + for(size_t i = 0; i < GetColumnCount(); ++i) { + arr.Add(wxEmptyString); + } + arr[m_main_column] = text; + wxTreeListItem *item = + new wxTreeListItem( this, parent, arr, image, selImage, data ); + + if ( data != NULL ) + { + data->SetId((long)item); + } + + parent->Insert( item, previous ); + + return item; +} + +wxTreeItemId wxTreeListMainWindow::AddRoot(const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + wxCHECK_MSG(!m_anchor, wxTreeItemId(), wxT("tree can have only one root")); + wxCHECK_MSG(GetColumnCount(), wxTreeItemId(), wxT("Add column(s) before adding the root item")); + + m_dirty = TRUE; // do this first so stuff below doesn't cause flicker + + // ALB + wxArrayString arr; + arr.Alloc(GetColumnCount()); + for(size_t i = 0; i < GetColumnCount(); ++i) { + arr.Add(wxEmptyString); + } + arr[m_main_column] = text; + m_anchor = new wxTreeListItem( this, (wxTreeListItem *)NULL, arr, + image, selImage, data); + if (HasFlag(wxTR_HIDE_ROOT)) + { + // if root is hidden, make sure we can navigate + // into children + m_anchor->SetHasPlus(); + Expand(m_anchor); + } + if ( data != NULL ) + { + data->SetId((long)m_anchor); + } + + if (!HasFlag(wxTR_MULTIPLE)) + { + m_current = m_key_current = m_anchor; + m_current->SetHilight( TRUE ); + } + + return m_anchor; +} + +inline +wxTreeItemId wxTreeListMainWindow::PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + return DoInsertItem(parent, 0u, text, image, selImage, data); +} + +inline +wxTreeItemId wxTreeListMainWindow::InsertItem(const wxTreeItemId& parentId, + const wxTreeItemId& idPrevious, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + wxTreeListItem *parent = (wxTreeListItem*) parentId.m_pItem; + if ( !parent ) + { + // should we give a warning here? + return AddRoot(text, image, selImage, data); + } + + int index = parent->GetChildren().Index((wxTreeListItem*) idPrevious.m_pItem); + wxASSERT_MSG( index != wxNOT_FOUND, + wxT("previous item in wxTreeListMainWindow::InsertItem() is not a sibling") ); + + return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data); +} + +inline +wxTreeItemId wxTreeListMainWindow::InsertItem(const wxTreeItemId& parentId, + size_t before, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + wxTreeListItem *parent = (wxTreeListItem*) parentId.m_pItem; + if ( !parent ) + { + // should we give a warning here? + return AddRoot(text, image, selImage, data); + } + + return DoInsertItem(parentId, before, text, image, selImage, data); +} + +inline +wxTreeItemId wxTreeListMainWindow::AppendItem(const wxTreeItemId& parentId, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) +{ + wxTreeListItem *parent = (wxTreeListItem*) parentId.m_pItem; + if ( !parent ) + { + // should we give a warning here? + return AddRoot(text, image, selImage, data); + } + + return DoInsertItem( parent, parent->GetChildren().Count(), text, + image, selImage, data); +} + +void wxTreeListMainWindow::SendDeleteEvent(wxTreeListItem *item) +{ + wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, m_owner->GetId() ); + event.SetItem((long) item); + event.SetEventObject( /*this*/m_owner ); + m_owner->ProcessEvent( event ); +} + +inline +void wxTreeListMainWindow::DeleteChildren(const wxTreeItemId& itemId) +{ + m_dirty = TRUE; // do this first so stuff below doesn't cause flicker + + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + item->DeleteChildren(this); +} + +inline +void wxTreeListMainWindow::Delete(const wxTreeItemId& itemId) +{ + m_dirty = TRUE; // do this first so stuff below doesn't cause flicker + + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + // don't stay with invalid m_key_current or we will crash in + // the next call to OnChar() + bool changeKeyCurrent = FALSE; + wxTreeListItem *itemKey = m_key_current; + while ( itemKey ) + { + if ( itemKey == item ) + { + // m_key_current is a descendant of the item being deleted + changeKeyCurrent = TRUE; + break; + } + itemKey = itemKey->GetParent(); + } + + wxTreeListItem *parent = item->GetParent(); + if ( parent ) + { + parent->GetChildren().Remove( item ); // remove by value + } + + if ( changeKeyCurrent ) + { + // may be NULL or not + m_key_current = parent; + } + + item->DeleteChildren(this); + SendDeleteEvent(item); + delete item; +} + +inline +void wxTreeListMainWindow::DeleteAllItems() +{ + if ( m_anchor ) + { + m_dirty = TRUE; + + m_anchor->DeleteChildren(this); + delete m_anchor; + + m_anchor = NULL; + } +} + +void wxTreeListMainWindow::Expand(const wxTreeItemId& itemId) +{ + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + wxCHECK_RET( item, _T("invalid item in wxTreeListMainWindow::Expand") ); + + if ( !item->HasPlus() ) + return; + + if ( item->IsExpanded() ) + return; + + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, m_owner->GetId() ); + event.SetItem( (long) item ); + event.SetEventObject( /*this*/m_owner ); + + if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() ) + { + // cancelled by program + return; + } + + item->Expand(); + CalculatePositions(); + + RefreshSubtree(item); + + event.SetEventType(wxEVT_COMMAND_TREE_ITEM_EXPANDED); + ProcessEvent( event ); +} + +void wxTreeListMainWindow::ExpandAll(const wxTreeItemId& item) +{ + Expand(item); + if ( IsExpanded(item) ) + { + long cookie; + wxTreeItemId child = GetFirstChild(item, cookie); + while ( child.IsOk() ) + { + ExpandAll(child); + + child = GetNextChild(item, cookie); + } + } +} + +void wxTreeListMainWindow::Collapse(const wxTreeItemId& itemId) +{ + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + if ( !item->IsExpanded() ) + return; + + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, m_owner->GetId() ); + event.SetItem( (long) item ); + event.SetEventObject( /*this*/m_owner ); + if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() ) + { + // cancelled by program + return; + } + + item->Collapse(); + +#if 0 // TODO why should items be collapsed recursively? + wxArrayTreeListItems& children = item->GetChildren(); + size_t count = children.Count(); + for ( size_t n = 0; n < count; n++ ) + { + Collapse(children[n]); + } +#endif + + CalculatePositions(); + + RefreshSubtree(item); + + event.SetEventType(wxEVT_COMMAND_TREE_ITEM_COLLAPSED); + ProcessEvent( event ); +} + +void wxTreeListMainWindow::CollapseAndReset(const wxTreeItemId& item) +{ + Collapse(item); + DeleteChildren(item); +} + +void wxTreeListMainWindow::Toggle(const wxTreeItemId& itemId) +{ + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + if (item->IsExpanded()) + Collapse(itemId); + else + Expand(itemId); +} + +void wxTreeListMainWindow::Unselect() +{ + if (m_current) + { + m_current->SetHilight( FALSE ); + RefreshLine( m_current ); + } +} + +void wxTreeListMainWindow::UnselectAllChildren(wxTreeListItem *item) +{ + if (item->IsSelected()) + { + item->SetHilight(FALSE); + RefreshLine(item); + } + + if (item->HasChildren()) + { + wxArrayTreeListItems& children = item->GetChildren(); + size_t count = children.Count(); + for ( size_t n = 0; n < count; ++n ) + { + UnselectAllChildren(children[n]); + } + } +} + +void wxTreeListMainWindow::UnselectAll() +{ + UnselectAllChildren((wxTreeListItem*) GetRootItem().m_pItem); +} + +// Recursive function ! +// To stop we must have crt_itemGetParent(); + + if (parent == NULL) // This is root item + return TagAllChildrenUntilLast(crt_item, last_item, select); + + wxArrayTreeListItems& children = parent->GetChildren(); + int index = children.Index(crt_item); + wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent? + + size_t count = children.Count(); + for (size_t n=(size_t)(index+1); nSetHilight(select); + RefreshLine(crt_item); + + if (crt_item==last_item) + return TRUE; + + if (crt_item->HasChildren()) + { + wxArrayTreeListItems& children = crt_item->GetChildren(); + size_t count = children.Count(); + for ( size_t n = 0; n < count; ++n ) + { + if (TagAllChildrenUntilLast(children[n], last_item, select)) + return TRUE; + } + } + + return FALSE; +} + +void wxTreeListMainWindow::SelectItemRange(wxTreeListItem *item1, wxTreeListItem *item2) +{ + // item2 is not necessary after item1 + wxTreeListItem *first=NULL, *last=NULL; + + // choice first' and 'last' between item1 and item2 + if (item1->GetY()GetY()) + { + first=item1; + last=item2; + } + else + { + first=item2; + last=item1; + } + + bool select = m_current->IsSelected(); + + if ( TagAllChildrenUntilLast(first,last,select) ) + return; + + TagNextChildren(first,last,select); +} + +void wxTreeListMainWindow::SelectItem(const wxTreeItemId& itemId, + bool unselect_others, + bool extended_select) +{ + wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") ); + + bool is_single=!(GetWindowStyleFlag() & wxTR_MULTIPLE); + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + //wxCHECK_RET( ( (!unselect_others) && is_single), + // wxT("this is a single selection tree") ); + + // to keep going anyhow !!! + if (is_single) + { + if (item->IsSelected()) + return; // nothing to do + unselect_others = TRUE; + extended_select = FALSE; + } + else if ( unselect_others && item->IsSelected() ) + { + // selection change if there is more than one item currently selected + wxArrayTreeItemIds selected_items; + if ( GetSelections(selected_items) == 1 ) + return; + } + + wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() ); + event.SetItem( (long) item ); + event.SetOldItem( (long) m_current ); + event.SetEventObject( /*this*/m_owner ); + // TODO : Here we don't send any selection mode yet ! + + if(m_owner->GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed()) + return; + + wxTreeItemId parent = GetParent( itemId ); + while (parent.IsOk()) + { + if (!IsExpanded(parent)) + Expand( parent ); + + parent = GetParent( parent ); + } + + EnsureVisible( itemId ); + + // ctrl press + if (unselect_others) + { + if (is_single) Unselect(); // to speed up thing + else UnselectAll(); + } + + // shift press + if (extended_select) + { + if ( !m_current ) + { + m_current = m_key_current = (wxTreeListItem*) GetRootItem().m_pItem; + } + + // don't change the mark (m_current) + SelectItemRange(m_current, item); + } + else + { + bool select=TRUE; // the default + + // Check if we need to toggle hilight (ctrl mode) + if (!unselect_others) + select=!item->IsSelected(); + + m_current = m_key_current = item; + m_current->SetHilight(select); + RefreshLine( m_current ); + } + + event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); + GetEventHandler()->ProcessEvent( event ); +} + +void wxTreeListMainWindow::FillArray(wxTreeListItem *item, + wxArrayTreeItemIds &array) const +{ + if ( item->IsSelected() ) + array.Add(wxTreeItemId(item)); + + if ( item->HasChildren() ) + { + wxArrayTreeListItems& children = item->GetChildren(); + size_t count = children.GetCount(); + for ( size_t n = 0; n < count; ++n ) + FillArray(children[n], array); + } +} + +size_t wxTreeListMainWindow::GetSelections(wxArrayTreeItemIds &array) const +{ + array.Empty(); + wxTreeItemId idRoot = GetRootItem(); + if ( idRoot.IsOk() ) + { + FillArray((wxTreeListItem*) idRoot.m_pItem, array); + } + //else: the tree is empty, so no selections + + return array.Count(); +} + +void wxTreeListMainWindow::EnsureVisible(const wxTreeItemId& item) +{ + if (!item.IsOk()) return; + + wxTreeListItem *gitem = (wxTreeListItem*) item.m_pItem; + + // first expand all parent branches + wxTreeListItem *parent = gitem->GetParent(); + while ( parent ) + { + Expand(parent); + parent = parent->GetParent(); + } + + //if (parent) CalculatePositions(); + + ScrollTo(item); +} + +void wxTreeListMainWindow::ScrollTo(const wxTreeItemId &item) +{ + if (!item.IsOk()) return; + + // We have to call this here because the label in + // question might just have been added and no screen + // update taken place. + if (m_dirty) wxYieldIfNeeded(); + + wxTreeListItem *gitem = (wxTreeListItem*) item.m_pItem; + + // now scroll to the item + int item_y = gitem->GetY(); + + int start_x = 0; + int start_y = 0; + GetViewStart( &start_x, &start_y ); + start_y *= PIXELS_PER_UNIT; + + int client_h = 0; + int client_w = 0; + GetClientSize( &client_w, &client_h ); + + if (item_y < start_y+3) + { + // going down + int x = 0; + int y = 0; + m_anchor->GetSize( x, y, this ); + x = m_owner->GetHeaderWindow()->GetWidth(); //m_total_col_width; // ALB + y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + //x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + int x_pos = GetScrollPos( wxHORIZONTAL ); + // Item should appear at top + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, item_y/PIXELS_PER_UNIT ); + } + else if (item_y+GetLineHeight(gitem) > start_y+client_h) + { + // going up + int x = 0; + int y = 0; + m_anchor->GetSize( x, y, this ); + y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + //x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + x = m_owner->GetHeaderWindow()->GetWidth(); //m_total_col_width; // ALB + item_y += PIXELS_PER_UNIT+2; + int x_pos = GetScrollPos( wxHORIZONTAL ); + // Item should appear at bottom + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, (item_y+GetLineHeight(gitem)-client_h)/PIXELS_PER_UNIT ); + } +} + +// FIXME: tree sorting functions are not reentrant and not MT-safe! +static wxTreeListMainWindow *s_treeBeingSorted = NULL; + +static int LINKAGEMODE tree_ctrl_compare_func(wxTreeListItem **item1, + wxTreeListItem **item2) +{ + wxCHECK_MSG( s_treeBeingSorted, 0, wxT("bug in wxTreeListMainWindow::SortChildren()") ); + + return s_treeBeingSorted->OnCompareItems(*item1, *item2); +} + +int wxTreeListMainWindow::OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) +{ + return wxStrcmp(GetItemText(item1), GetItemText(item2)); +} + +void wxTreeListMainWindow::SortChildren(const wxTreeItemId& itemId) +{ + wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") ); + + wxTreeListItem *item = (wxTreeListItem*) itemId.m_pItem; + + wxCHECK_RET( !s_treeBeingSorted, + wxT("wxTreeListMainWindow::SortChildren is not reentrant") ); + + wxArrayTreeListItems& children = item->GetChildren(); + if ( children.Count() > 1 ) + { + m_dirty = TRUE; + + s_treeBeingSorted = this; + children.Sort(tree_ctrl_compare_func); + s_treeBeingSorted = NULL; + } + //else: don't make the tree dirty as nothing changed +} + +inline +wxImageList *wxTreeListMainWindow::GetImageList() const +{ + return m_imageListNormal; +} + +inline +wxImageList *wxTreeListMainWindow::GetButtonsImageList() const +{ + return m_imageListButtons; +} + +inline +wxImageList *wxTreeListMainWindow::GetStateImageList() const +{ + return m_imageListState; +} + +void wxTreeListMainWindow::CalculateLineHeight() +{ + wxClientDC dc(this); + m_lineHeight = (int)(dc.GetCharHeight() + 4); + + if ( m_imageListNormal ) + { + // Calculate a m_lineHeight value from the normal Image sizes. + // May be toggle off. Then wxTreeListMainWindow will spread when + // necessary (which might look ugly). + int n = m_imageListNormal->GetImageCount(); + for (int i = 0; i < n ; i++) + { + int width = 0, height = 0; + m_imageListNormal->GetSize(i, width, height); + if (height > m_lineHeight) m_lineHeight = height; + } + } + + if (m_imageListButtons) + { + // Calculate a m_lineHeight value from the Button image sizes. + // May be toggle off. Then wxTreeListMainWindow will spread when + // necessary (which might look ugly). + int n = m_imageListButtons->GetImageCount(); + for (int i = 0; i < n ; i++) + { + int width = 0, height = 0; + m_imageListButtons->GetSize(i, width, height); + if (height > m_lineHeight) m_lineHeight = height; + } + } + + if (m_lineHeight < 30) + m_lineHeight += 2; // at least 2 pixels + else + m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing +} + +inline +void wxTreeListMainWindow::SetImageList(wxImageList *imageList) +{ + if (m_ownsImageListNormal) delete m_imageListNormal; + m_imageListNormal = imageList; + m_ownsImageListNormal = FALSE; + m_dirty = TRUE; + CalculateLineHeight(); +} + +inline +void wxTreeListMainWindow::SetStateImageList(wxImageList *imageList) +{ + if (m_ownsImageListState) delete m_imageListState; + m_imageListState = imageList; + m_ownsImageListState = FALSE; +} + +inline +void wxTreeListMainWindow::SetButtonsImageList(wxImageList *imageList) +{ + if (m_ownsImageListButtons) delete m_imageListButtons; + m_imageListButtons = imageList; + m_ownsImageListButtons = FALSE; + m_dirty = TRUE; + CalculateLineHeight(); +} + +inline +void wxTreeListMainWindow::AssignImageList(wxImageList *imageList) +{ + SetImageList(imageList); + m_ownsImageListNormal = TRUE; +} + +inline +void wxTreeListMainWindow::AssignStateImageList(wxImageList *imageList) +{ + SetStateImageList(imageList); + m_ownsImageListState = TRUE; +} + +inline +void wxTreeListMainWindow::AssignButtonsImageList(wxImageList *imageList) +{ + SetButtonsImageList(imageList); + m_ownsImageListButtons = TRUE; +} + +// ---------------------------------------------------------------------------- +// helpers +// ---------------------------------------------------------------------------- + +void wxTreeListMainWindow::AdjustMyScrollbars() +{ + if (m_anchor) + { + int x = 0, y = 0; + m_anchor->GetSize( x, y, this ); + y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + //x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels + int x_pos = GetScrollPos( wxHORIZONTAL ); + int y_pos = GetScrollPos( wxVERTICAL ); + x = m_owner->GetHeaderWindow()->GetWidth() + 2; + if(x < GetClientSize().GetWidth()) x_pos = 0; + //m_total_col_width + 2; // ALB + SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, + y/PIXELS_PER_UNIT, x_pos, y_pos ); + } + else + { + SetScrollbars( 0, 0, 0, 0 ); + } +} + +int wxTreeListMainWindow::GetLineHeight(wxTreeListItem *item) const +{ + if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT) + return item->GetHeight(); + else + return m_lineHeight; +} + +void wxTreeListMainWindow::PaintItem(wxTreeListItem *item, wxDC& dc) +{ + // TODO implement "state" icon on items + + wxTreeItemAttr *attr = item->GetAttributes(); + if ( attr && attr->HasFont() ) + dc.SetFont(attr->GetFont()); + else if (item->IsBold()) + dc.SetFont(m_boldFont); + + long text_w = 0, text_h = 0; + + dc.GetTextExtent( item->GetText(GetMainColumn()), &text_w, &text_h ); + + int total_h = GetLineHeight(item); + + if ( item->IsSelected() ) + { + dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush)); + } + else + { + wxColour colBg; + if ( attr && attr->HasBackgroundColour() ) + colBg = attr->GetBackgroundColour(); + else + colBg = m_backgroundColour; + dc.SetBrush(wxBrush(colBg, wxSOLID)); + } + + int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0; + + dc.DrawRectangle(0, item->GetY()+offset, + m_owner->GetHeaderWindow()->GetWidth(), + total_h-offset); + + dc.SetBackgroundMode(wxTRANSPARENT); + int extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0; + int extra_offset = 0; + for(size_t i = 0; i < GetColumnCount(); ++i) { + int coord_x = extra_offset, image_x = coord_x; + int clip_width = m_owner->GetHeaderWindow()->GetColumnWidth(i); + int image_h = 0, image_w = 0; //2; + int image = NO_IMAGE; + + if(i == GetMainColumn()) { + image = item->GetCurrentImage(); + coord_x = item->GetX(); + } + else { + image = item->GetImage(i); + } + + if(image != NO_IMAGE) { + if(m_imageListNormal) { + m_imageListNormal->GetSize( image, image_w, image_h ); + image_w += 4; + } + else { + image = NO_IMAGE; + } + } + + // honor text alignment + wxString text = item->GetText(i); + + switch(m_owner->GetHeaderWindow()->GetColumn(i).GetAlignment()) { + case wxTL_ALIGN_LEFT: + coord_x += image_w + 2; + image_x = coord_x - image_w; + break; + case wxTL_ALIGN_RIGHT: + dc.GetTextExtent(text, &text_w, NULL); + coord_x += clip_width - text_w - image_w - 2; + image_x = coord_x - image_w; + break; + case wxTL_ALIGN_CENTER: + dc.GetTextExtent(text, &text_w, NULL); + //coord_x += (clip_width - text_w)/2 + image_w; + image_x += (clip_width - text_w - image_w)/2 + 2; + coord_x = image_x + image_w; + } + + wxDCClipper clipper(dc, /*coord_x,*/ extra_offset, + item->GetY() + extraH, clip_width, + total_h); + + if(image != NO_IMAGE) { + m_imageListNormal->Draw( image, dc, image_x, + item->GetY() +((total_h > image_h)? + ((total_h-image_h)/2):0), + wxIMAGELIST_DRAW_TRANSPARENT ); + } + + dc.DrawText( text, + (wxCoord)(coord_x /*image_w + item->GetX()*/), + (wxCoord)(item->GetY() + extraH)); + extra_offset += m_owner->GetHeaderWindow()->GetColumnWidth(i); + } + + // restore normal font + dc.SetFont( m_normalFont ); +} + +// Now y stands for the top of the item, whereas it used to stand for middle ! +void wxTreeListMainWindow::PaintLevel( wxTreeListItem *item, wxDC &dc, + int level, int &y, int x_offset ) +{ + int x = level*m_indent + x_offset; + if (!HasFlag(wxTR_HIDE_ROOT)) + { + x += m_indent; + } + else if (level == 0) + { + // always expand hidden root + int origY = y; + wxArrayTreeListItems& children = item->GetChildren(); + int count = children.Count(); + if (count > 0) + { + int n = 0, oldY; + do { + oldY = y; + PaintLevel(children[n], dc, 1, y, x_offset); + } while (++n < count); + + if (!HasFlag(wxTR_NO_LINES) && HasFlag(wxTR_LINES_AT_ROOT) && + count > 0) + { + // draw line down to last child + origY += GetLineHeight(children[0])>>1; + oldY += GetLineHeight(children[n-1])>>1; + dc.DrawLine(3, origY, 3, oldY); + } + } + return; + } + + item->SetX(x+m_spacing); + item->SetY(y); + + int h = GetLineHeight(item); + int y_top = y; + int y_mid = y_top + (h>>1); + y += h; + + int exposed_x = dc.LogicalToDeviceX(0); + int exposed_y = dc.LogicalToDeviceY(y_top); + + if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much + { + wxPen *pen = +#ifndef __WXMAC__ + // don't draw rect outline if we already have the + // background color under Mac + (item->IsSelected() && m_hasFocus) ? wxBLACK_PEN : +#endif // !__WXMAC__ + wxTRANSPARENT_PEN; + + wxColour colText; + if ( item->IsSelected() ) + { + colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + } + else + { + wxTreeItemAttr *attr = item->GetAttributes(); + if (attr && attr->HasTextColour()) + colText = attr->GetTextColour(); + else + //colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT); + colText = GetForegroundColour(); + } + + // prepare to draw + dc.SetTextForeground(colText); + dc.SetPen(*pen); + + // draw + PaintItem(item, dc); + + if (HasFlag(wxTR_ROW_LINES)) + { + int total_width = m_owner->GetHeaderWindow()->GetWidth(); + // if the background colour is white, choose a + // contrasting color for the lines + dc.SetPen(*((GetBackgroundColour() == *wxWHITE) + ? wxMEDIUM_GREY_PEN : wxWHITE_PEN)); + dc.DrawLine(0, y_top, total_width, y_top); + dc.DrawLine(0, y, total_width, y); + } + + // restore DC objects + dc.SetBrush(*wxWHITE_BRUSH); + dc.SetPen(m_dottedPen); + dc.SetTextForeground(*wxBLACK); + + size_t clip_width = m_owner->GetHeaderWindow()->GetColumn( + m_main_column).GetWidth(); + //m_columns[m_main_column].GetWidth(); + if (item->HasPlus() && HasButtons()) // should the item show a button? + { + // clip to the column width + wxDCClipper clipper(dc, x_offset, y_top, clip_width, 10000); + + if (!HasFlag(wxTR_NO_LINES)) + { + if (x > (signed)m_indent) + dc.DrawLine(x - m_indent, y_mid, x - 5, y_mid); + else if (HasFlag(wxTR_LINES_AT_ROOT)) + dc.DrawLine(3, y_mid, x - 5, y_mid); + dc.DrawLine(x + 5, y_mid, x + m_spacing, y_mid); + } + + if (m_imageListButtons != NULL) + { + // draw the image button here + int image_h = 0, image_w = 0, image = wxTreeItemIcon_Normal; + if (item->IsExpanded()) image = wxTreeItemIcon_Expanded; + if (item->IsSelected()) + image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal; + m_imageListButtons->GetSize(image, image_w, image_h); + int xx = x - (image_w>>1); + int yy = y_mid - (image_h>>1); + dc.SetClippingRegion(xx, yy, image_w, image_h); + m_imageListButtons->Draw(image, dc, xx, yy, + wxIMAGELIST_DRAW_TRANSPARENT); + dc.DestroyClippingRegion(); + } + else if (HasFlag(wxTR_TWIST_BUTTONS)) + { + // draw the twisty button here + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*m_hilightBrush); + + wxPoint button[3]; + + if (item->IsExpanded()) + { + button[0].x = x-5; + button[0].y = y_mid-2; + button[1].x = x+5; + button[1].y = y_mid-2; + button[2].x = x; + button[2].y = y_mid+3; + } + else + { + button[0].y = y_mid-5; + button[0].x = x-2; + button[1].y = y_mid+5; + button[1].x = x-2; + button[2].y = y_mid; + button[2].x = x+3; + } + dc.DrawPolygon(3, button); + + dc.SetPen(m_dottedPen); + } + else // if (HasFlag(wxTR_HAS_BUTTONS)) + { + // draw the plus sign here + dc.SetPen(*wxGREY_PEN); + dc.SetBrush(*wxWHITE_BRUSH); + dc.DrawRectangle(x-5, y_mid-4, 11, 9); + dc.SetPen(*wxBLACK_PEN); + dc.DrawLine(x-2, y_mid, x+3, y_mid); + if (!item->IsExpanded()) + dc.DrawLine(x, y_mid-2, x, y_mid+3); + dc.SetPen(m_dottedPen); + } + } + else if (!HasFlag(wxTR_NO_LINES)) // no button; maybe a line? + { + // clip to the column width + wxDCClipper clipper(dc, x_offset, y_top, clip_width, 10000); + // draw the horizontal line here + int x_start = x; + if (x > (signed)m_indent) + x_start -= m_indent; + else if (HasFlag(wxTR_LINES_AT_ROOT)) + x_start = 3; + dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid); + } + } + + if (item->IsExpanded()) + { + wxArrayTreeListItems& children = item->GetChildren(); + int count = children.Count(); + if (count > 0) + { + int n = 0, oldY; + ++level; + do { + oldY = y; + PaintLevel(children[n], dc, level, y, x_offset); + } while (++n < count); + + if (!HasFlag(wxTR_NO_LINES) && count > 0) + { + size_t clip_width = m_owner->GetHeaderWindow()->GetColumn( + m_main_column).GetWidth(); + //m_columns[m_main_column].GetWidth(); + // clip to the column width + wxDCClipper clipper(dc, x_offset, y_top, clip_width, 10000); + // draw line down to last child + oldY += GetLineHeight(children[n-1])>>1; + if (HasButtons()) y_mid += 5; + dc.DrawLine(x, y_mid, x, oldY); + } + } + } +} + +void wxTreeListMainWindow::DrawDropEffect(wxTreeListItem *item) +{ + if ( item ) + { + if ( item->HasPlus() ) + { + // it's a folder, indicate it by a border + DrawBorder(item); + } + else + { + // draw a line under the drop target because the item will be + // dropped there + DrawLine(item, TRUE /* below */); + } + + SetCursor(wxCURSOR_BULLSEYE); + } + else + { + // can't drop here + SetCursor(wxCURSOR_NO_ENTRY); + } +} + +void wxTreeListMainWindow::DrawBorder(const wxTreeItemId &item) +{ + wxCHECK_RET( item.IsOk(), _T("invalid item in wxTreeListMainWindow::DrawLine") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + + wxClientDC dc(this); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + + int w = i->GetWidth() + 2; + int h = GetLineHeight(i) + 2; + + dc.DrawRectangle( i->GetX() - 1, i->GetY() - 1, w, h); +} + +void wxTreeListMainWindow::DrawLine(const wxTreeItemId &item, bool below) +{ + wxCHECK_RET( item.IsOk(), _T("invalid item in wxTreeListMainWindow::DrawLine") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + + wxClientDC dc(this); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + + int x = i->GetX(), + y = i->GetY(); + if ( below ) + { + y += GetLineHeight(i) - 1; + } + + dc.DrawLine( x, y, x + i->GetWidth(), y); +} + +// ---------------------------------------------------------------------------- +// wxWindows callbacks +// ---------------------------------------------------------------------------- + +void wxTreeListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) +{ + wxPaintDC dc(this); + + PrepareDC( dc ); + + if(!GetColumnCount()) return; // ALB + + if ( !m_anchor) + return; + + dc.SetFont( m_normalFont ); + dc.SetPen( m_dottedPen ); + + // this is now done dynamically + //if(GetImageList() == NULL) + // m_lineHeight = (int)(dc.GetCharHeight() + 4); + + int y = 0; //HEADER_HEIGHT; //2; + int x_offset = 0; + for(size_t i = 0; i < GetMainColumn(); ++i) { + x_offset += m_owner->GetHeaderWindow()->GetColumnWidth(i); + } + PaintLevel( m_anchor, dc, 0, y, x_offset ); +} + +void wxTreeListMainWindow::OnSetFocus( wxFocusEvent &event ) +{ + m_hasFocus = TRUE; + + RefreshSelected(); + + event.Skip(); +} + +void wxTreeListMainWindow::OnKillFocus( wxFocusEvent &event ) +{ + m_hasFocus = FALSE; + + RefreshSelected(); + + event.Skip(); +} + +void wxTreeListMainWindow::OnChar( wxKeyEvent &event ) +{ + wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, m_owner->GetId() ); + te.SetKeyEvent( event ); + te.SetEventObject( /*this*/m_owner ); + if ( m_owner->GetEventHandler()->ProcessEvent( te ) ) + { + // intercepted by the user code + return; + } + + if ( (m_current == 0) || (m_key_current == 0) ) + { + event.Skip(); + return; + } + + // how should the selection work for this event? + bool is_multiple, extended_select, unselect_others; + EventFlagsToSelType(GetWindowStyleFlag(), + event.ShiftDown(), + event.ControlDown(), + is_multiple, extended_select, unselect_others); + + // + : Expand + // - : Collaspe + // * : Expand all/Collapse all + // ' ' | return : activate + // up : go up (not last children!) + // down : go down + // left : go to parent + // right : open if parent and go next + // home : go to root + // end : go to last item without opening parents + switch (event.KeyCode()) + { + case '+': + case WXK_ADD: + if (m_current->HasPlus() && !IsExpanded(m_current)) + { + Expand(m_current); + } + break; + + case '*': + case WXK_MULTIPLY: + if ( !IsExpanded(m_current) ) + { + // expand all + ExpandAll(m_current); + break; + } + //else: fall through to Collapse() it + + case '-': + case WXK_SUBTRACT: + if (IsExpanded(m_current)) + { + Collapse(m_current); + } + break; + + case ' ': + case WXK_RETURN: + { + wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, + m_owner->GetId() ); + event.SetItem( (long) m_current); + event.SetEventObject( /*this*/m_owner ); + m_owner->GetEventHandler()->ProcessEvent( event ); + } + break; + + // up goes to the previous sibling or to the last + // of its children if it's expanded + case WXK_UP: + { + wxTreeItemId prev = GetPrevSibling( m_key_current ); + if (!prev) + { + prev = GetParent( m_key_current ); + if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) + { + break; // don't go to root if it is hidden + } + if (prev) + { + long cookie = 0; + wxTreeItemId current = m_key_current; + // TODO: Huh? If we get here, we'd better be the first child of our parent. How else could it be? + if (current == GetFirstChild( prev, cookie )) + { + // otherwise we return to where we came from + SelectItem( prev, unselect_others, extended_select ); + m_key_current= (wxTreeListItem*) prev.m_pItem; + EnsureVisible( prev ); + break; + } + } + } + if (prev) + { + while ( IsExpanded(prev) && HasChildren(prev) ) + { + wxTreeItemId child = GetLastChild(prev); + if ( child ) + { + prev = child; + } + } + + SelectItem( prev, unselect_others, extended_select ); + m_key_current=(wxTreeListItem*) prev.m_pItem; + EnsureVisible( prev ); + } + } + break; + + // left arrow goes to the parent + case WXK_LEFT: + { + wxTreeItemId prev = GetParent( m_current ); + if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) + { + // don't go to root if it is hidden + prev = GetPrevSibling( m_current ); + } + if (prev) + { + EnsureVisible( prev ); + SelectItem( prev, unselect_others, extended_select ); + } + } + break; + + case WXK_RIGHT: + // this works the same as the down arrow except that we + // also expand the item if it wasn't expanded yet + Expand(m_current); + // fall through + + case WXK_DOWN: + { + if (IsExpanded(m_key_current) && HasChildren(m_key_current)) + { + long cookie = 0; + wxTreeItemId child = GetFirstChild( m_key_current, cookie ); + SelectItem( child, unselect_others, extended_select ); + m_key_current=(wxTreeListItem*) child.m_pItem; + EnsureVisible( child ); + } + else + { + wxTreeItemId next = GetNextSibling( m_key_current ); + if (!next) + { + wxTreeItemId current = m_key_current; + while (current && !next) + { + current = GetParent( current ); + if (current) next = GetNextSibling( current ); + } + } + if (next) + { + SelectItem( next, unselect_others, extended_select ); + m_key_current=(wxTreeListItem*) next.m_pItem; + EnsureVisible( next ); + } + } + } + break; + + // selects the last visible tree item + case WXK_END: + { + wxTreeItemId last = GetRootItem(); + + while ( last.IsOk() && IsExpanded(last) ) + { + wxTreeItemId lastChild = GetLastChild(last); + + // it may happen if the item was expanded but then all of + // its children have been deleted - so IsExpanded() returned + // TRUE, but GetLastChild() returned invalid item + if ( !lastChild ) + break; + + last = lastChild; + } + + if ( last.IsOk() ) + { + EnsureVisible( last ); + SelectItem( last, unselect_others, extended_select ); + } + } + break; + + // selects the root item + case WXK_HOME: + { + wxTreeItemId prev = GetRootItem(); + if (!prev) break; + if (HasFlag(wxTR_HIDE_ROOT)) + { + long dummy; + prev = GetFirstChild(prev, dummy); + if (!prev) break; + } + EnsureVisible( prev ); + SelectItem( prev, unselect_others, extended_select ); + } + break; + + default: + event.Skip(); + } +} + +wxTreeItemId wxTreeListMainWindow::HitTest(const wxPoint& point, int& flags, + int& column) +{ + // JACS: removed wxYieldIfNeeded() because it can cause the window + // to be deleted from under us if a close window event is pending + + int w, h; + GetSize(&w, &h); + flags=0; + if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT; + if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT; + if (point.y<0) flags |= wxTREE_HITTEST_ABOVE; + if (point.y>h) flags |= wxTREE_HITTEST_BELOW; + if (flags) return wxTreeItemId(); + + if (m_anchor == NULL) + { + flags = wxTREE_HITTEST_NOWHERE; + return wxTreeItemId(); + } + + wxClientDC dc(this); + PrepareDC(dc); + wxCoord x = dc.DeviceToLogicalX( point.x ); + wxCoord y = dc.DeviceToLogicalY( point.y ); + wxTreeListItem *hit = m_anchor->HitTest(wxPoint(x, y), this, flags, + column, 0); + if (hit == NULL) + { + flags = wxTREE_HITTEST_NOWHERE; + return wxTreeItemId(); + } + return hit; +} + +// get the bounding rectangle of the item (or of its label only) +bool wxTreeListMainWindow::GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool WXUNUSED(textOnly)) const +{ + wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid item in wxTreeListMainWindow::GetBoundingRect") ); + + wxTreeListItem *i = (wxTreeListItem*) item.m_pItem; + + int startX, startY; + GetViewStart(& startX, & startY); + + rect.x = i->GetX() - startX*PIXELS_PER_UNIT; + rect.y = i->GetY() - startY*PIXELS_PER_UNIT; + rect.width = i->GetWidth(); + //rect.height = i->GetHeight(); + rect.height = GetLineHeight(i); + + return TRUE; +} + +/* **** */ + +void wxTreeListMainWindow::Edit( const wxTreeItemId& item ) +{ + if (!item.IsOk()) return; + + m_currentEdit = (wxTreeListItem*) item.m_pItem; + + wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, m_owner->GetId() ); + te.SetItem( (long) m_currentEdit); + te.SetEventObject( /*this*/m_owner ); + m_owner->GetEventHandler()->ProcessEvent( te ); + + if (!te.IsAllowed()) return; + + // We have to call this here because the label in + // question might just have been added and no screen + // update taken place. + if (m_dirty) wxYieldIfNeeded(); + + wxString s = m_currentEdit->GetText(/*ALB*/m_main_column); + int x = m_currentEdit->GetX(); + int y = m_currentEdit->GetY(); + int w = m_currentEdit->GetWidth(); + int h = m_currentEdit->GetHeight(); + + int image_h = 0; + int image_w = 0; + + int image = m_currentEdit->GetCurrentImage(); + if ( image != NO_IMAGE ) + { + if ( m_imageListNormal ) + { + m_imageListNormal->GetSize( image, image_w, image_h ); + image_w += 4; + } + else + { + wxFAIL_MSG(_T("you must create an image list to use images!")); + } + } + x += image_w; + w -= image_w + 4; // I don't know why +4 is needed + + wxClientDC dc(this); + PrepareDC( dc ); + x = dc.LogicalToDeviceX( x ); + y = dc.LogicalToDeviceY( y ); + + wxTreeListTextCtrl *text = new wxTreeListTextCtrl(this, -1, + &m_renameAccept, + &m_renameRes, + this, + s, + wxPoint(x-4,y-4), + wxSize(w+11,h+8)); + text->SetFocus(); +} + +void wxTreeListMainWindow::OnRenameTimer() +{ + Edit( m_current ); +} + +void wxTreeListMainWindow::OnRenameAccept() +{ + // TODO if the validator fails this causes a crash + wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, m_owner->GetId() ); + le.SetItem( (long) m_currentEdit ); + le.SetEventObject( /*this*/m_owner ); + le.SetLabel( m_renameRes ); + m_owner->GetEventHandler()->ProcessEvent( le ); + + if (!le.IsAllowed()) return; + + SetItemText( m_currentEdit, m_renameRes ); +} + +void wxTreeListMainWindow::OnMouse( wxMouseEvent &event ) +{ + if ( !m_anchor ) return; + + // we process left mouse up event (enables in-place edit), right down + // (pass to the user code), left dbl click (activate item) and + // dragging/moving events for items drag-and-drop + if ( !(event.LeftDown() || + event.LeftUp() || + event.RightDown() || + event.LeftDClick() || + event.Dragging() || + ((event.Moving() || event.RightUp()) && m_isDragging)) ) + { + event.Skip(); + + return; + } + + wxClientDC dc(this); + PrepareDC(dc); + wxCoord x = dc.DeviceToLogicalX( event.GetX() ); + wxCoord y = dc.DeviceToLogicalY( event.GetY() ); + + int flags = 0; + wxTreeListItem *item = m_anchor->HitTest(wxPoint(x,y), this, flags, 0); + + if ( event.Dragging() && !m_isDragging ) + { + if (m_dragCount == 0) + m_dragStart = wxPoint(x,y); + + m_dragCount++; + + if (m_dragCount != 3) + { + // wait until user drags a bit further... + return; + } + + wxEventType command = event.RightIsDown() + ? wxEVT_COMMAND_TREE_BEGIN_RDRAG + : wxEVT_COMMAND_TREE_BEGIN_DRAG; + + wxTreeEvent nevent( command,/*ALB*/ m_owner->GetId() ); + nevent.SetItem( (long) m_current); + nevent.SetEventObject(/*this*/m_owner); // ALB + + // by default the dragging is not supported, the user code must + // explicitly allow the event for it to take place + nevent.Veto(); + + if ( m_owner->GetEventHandler()->ProcessEvent(nevent) && + nevent.IsAllowed() ) + { + // we're going to drag this item + m_isDragging = TRUE; + + // remember the old cursor because we will change it while + // dragging + m_oldCursor = m_cursor; + + // in a single selection control, hide the selection temporarily + if ( !(GetWindowStyleFlag() & wxTR_MULTIPLE) ) + { + m_oldSelection = (wxTreeListItem*) GetSelection().m_pItem; + + if ( m_oldSelection ) + { + m_oldSelection->SetHilight(FALSE); + RefreshLine(m_oldSelection); + } + } + + CaptureMouse(); + } + } + else if ( event.Moving() ) + { + if ( item != m_dropTarget ) + { + // unhighlight the previous drop target + DrawDropEffect(m_dropTarget); + + m_dropTarget = item; + + // highlight the current drop target if any + DrawDropEffect(m_dropTarget); + + wxYieldIfNeeded(); + } + } + else if ( (event.LeftUp() || event.RightUp()) && m_isDragging ) + { + // erase the highlighting + DrawDropEffect(m_dropTarget); + + if ( m_oldSelection ) + { + m_oldSelection->SetHilight(TRUE); + RefreshLine(m_oldSelection); + m_oldSelection = (wxTreeListItem *)NULL; + } + + // generate the drag end event + wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG,/*ALB*/m_owner->GetId()); + + event.SetItem( (long) item ); + event.SetPoint( wxPoint(x, y) ); + event.SetEventObject(/*this*/m_owner); + + (void)m_owner->GetEventHandler()->ProcessEvent(event); + + m_isDragging = FALSE; + m_dropTarget = (wxTreeListItem *)NULL; + + ReleaseMouse(); + + SetCursor(m_oldCursor); + + wxYieldIfNeeded(); + } + else + { + // here we process only the messages which happen on tree items + + m_dragCount = 0; + + if (item == NULL) return; /* we hit the blank area */ + + if ( event.RightDown() ) + { + SetFocus(); + wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, + m_owner->GetId()); + nevent.SetItem( (long) item ); + int nx, ny; + CalcScrolledPosition(x, y, &nx, &ny); + nevent.SetPoint( wxPoint(nx, ny)); + nevent.SetEventObject(/*this*/m_owner); + m_owner->GetEventHandler()->ProcessEvent(nevent); + } + else if ( event.LeftUp() ) + { + if ( m_lastOnSame ) + { + if ( (item == m_current) && + (flags & wxTREE_HITTEST_ONITEMLABEL) && + HasFlag(wxTR_EDIT_LABELS) ) + { + if ( m_renameTimer->IsRunning() ) + m_renameTimer->Stop(); + + m_renameTimer->Start( 100, TRUE ); + } + + m_lastOnSame = FALSE; + } + } + else // !RightDown() && !LeftUp() ==> LeftDown() || LeftDClick() + { + if ( event.LeftDown() ) + { + SetFocus(); + m_lastOnSame = item == m_current; + } + + if ( flags & wxTREE_HITTEST_ONITEMBUTTON ) + { + // only toggle the item for a single click, double click on + // the button doesn't do anything (it toggles the item twice) + if ( event.LeftDown() ) + { + Toggle( item ); + } + + // don't select the item if the button was clicked + return; + } + + // how should the selection work for this event? + bool is_multiple, extended_select, unselect_others; + EventFlagsToSelType(GetWindowStyleFlag(), + event.ShiftDown(), + event.ControlDown(), + is_multiple, extended_select, unselect_others); + + SelectItem(item, unselect_others, extended_select); + + // For some reason, Windows isn't recognizing a left double-click, + // so we need to simulate it here. Allow 200 milliseconds for now. + if ( event.LeftDClick() ) + { + // double clicking should not start editing the item label + m_renameTimer->Stop(); + m_lastOnSame = FALSE; + + // send activate event first + wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, + m_owner->GetId() ); + nevent.SetItem( (long) item ); + int nx, ny; + CalcScrolledPosition(x, y, &nx, &ny); + nevent.SetPoint( wxPoint(nx, ny) ); + nevent.SetEventObject( /*this*/m_owner ); + if ( !m_owner->GetEventHandler()->ProcessEvent( nevent ) ) + { + // if the user code didn't process the activate event, + // handle it ourselves by toggling the item when it is + // double clicked + if ( item->HasPlus() ) + { + Toggle(item); + } + } + } + } + } +} + +void wxTreeListMainWindow::OnIdle( wxIdleEvent &WXUNUSED(event) ) +{ + /* after all changes have been done to the tree control, + * we actually redraw the tree when everything is over */ + + if (!m_dirty) return; + + m_dirty = FALSE; + + CalculatePositions(); + Refresh(); + AdjustMyScrollbars(); +} + +void wxTreeListMainWindow::OnSize(wxSizeEvent& WXUNUSED(event)) +{ +// int w, h; +// GetClientSize(&w, &h); +// m_header_win->SetSize(0, 0, w, HEADER_HEIGHT); +} + +void wxTreeListMainWindow::OnScroll(wxScrollWinEvent& event) +{ + // FIXME +#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__) + wxScrolledWindow::OnScroll(event); +#else + HandleOnScroll( event ); +#endif + + if(event.GetOrientation() == wxHORIZONTAL) + { + m_owner->GetHeaderWindow()->Refresh(); +#ifdef __WXMAC__ + m_owner->GetHeaderWindow()->MacUpdateImmediately(); +#endif + } +} + + +void wxTreeListMainWindow::CalculateSize( wxTreeListItem *item, wxDC &dc ) +{ + wxCoord text_w = 0; + wxCoord text_h = 0; + + if (item->IsBold()) + dc.SetFont(m_boldFont); + + dc.GetTextExtent( item->GetText(/*ALB*/m_main_column), &text_w, &text_h ); + text_h+=2; + + // restore normal font + dc.SetFont( m_normalFont ); + + int image_h = 0; + int image_w = 0; + int image = item->GetCurrentImage(); + if ( image != NO_IMAGE ) + { + if ( m_imageListNormal ) + { + m_imageListNormal->GetSize( image, image_w, image_h ); + image_w += 4; + image_h += 2; + } + } + + int total_h = (image_h > text_h) ? image_h : text_h; + +// if (total_h < 30) +// total_h += 2; // at least 2 pixels +// else +// total_h += total_h/10; // otherwise 10% extra spacing + + item->SetHeight(total_h); + if (total_h>m_lineHeight) + m_lineHeight=total_h; + + item->SetWidth(image_w+text_w+2); +} + +// ----------------------------------------------------------------------------- +// for developper : y is now the top of the level +// not the middle of it ! +void wxTreeListMainWindow::CalculateLevel( wxTreeListItem *item, wxDC &dc, + int level, int &y, int x_offset ) +{ + int x = level*m_indent + x_offset; + if (!HasFlag(wxTR_HIDE_ROOT)) + { + x += m_indent; + } + else if (level == 0) + { + // a hidden root is not evaluated, but its + // children are always calculated + goto Recurse; + } + + CalculateSize( item, dc ); + + // set its position + item->SetX( x+m_spacing ); + item->SetY( y ); + y += GetLineHeight(item); + + if ( !item->IsExpanded() ) + { + // we don't need to calculate collapsed branches + return; + } + + Recurse: + wxArrayTreeListItems& children = item->GetChildren(); + size_t n, count = children.Count(); + ++level; + for (n = 0; n < count; ++n ) + CalculateLevel( children[n], dc, level, y, x_offset ); // recurse +} + +void wxTreeListMainWindow::CalculatePositions() +{ + if ( !m_anchor ) return; + + wxClientDC dc(this); + PrepareDC( dc ); + + dc.SetFont( m_normalFont ); + + dc.SetPen( m_dottedPen ); + //if(GetImageList() == NULL) + // m_lineHeight = (int)(dc.GetCharHeight() + 4); + + int y = 2; + int x_offset = 0; + for(size_t i = 0; i < GetMainColumn(); ++i) { + x_offset += m_owner->GetHeaderWindow()->GetColumnWidth(i); + } + CalculateLevel( m_anchor, dc, 0, y, x_offset ); // start recursion +} + +void wxTreeListMainWindow::RefreshSubtree(wxTreeListItem *item) +{ + if (m_dirty) return; + + wxClientDC dc(this); + PrepareDC(dc); + + int cw = 0; + int ch = 0; + GetClientSize( &cw, &ch ); + + wxRect rect; + rect.x = dc.LogicalToDeviceX( 0 ); + rect.width = cw; + rect.y = dc.LogicalToDeviceY( item->GetY() - 2 ); + rect.height = ch; + + Refresh( TRUE, &rect ); + + AdjustMyScrollbars(); +} + +void wxTreeListMainWindow::RefreshLine( wxTreeListItem *item ) +{ + if (m_dirty) return; + + wxClientDC dc(this); + PrepareDC( dc ); + + int cw = 0; + int ch = 0; + GetClientSize( &cw, &ch ); + + wxRect rect; + rect.x = dc.LogicalToDeviceX( 0 ); + rect.y = dc.LogicalToDeviceY( item->GetY() ); + rect.width = cw; + rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6; + + Refresh( TRUE, &rect ); +} + +void wxTreeListMainWindow::RefreshSelected() +{ + // TODO: this is awfully inefficient, we should keep the list of all + // selected items internally, should be much faster + if ( m_anchor ) + RefreshSelectedUnder(m_anchor); +} + +void wxTreeListMainWindow::RefreshSelectedUnder(wxTreeListItem *item) +{ + if ( item->IsSelected() ) + RefreshLine(item); + + const wxArrayTreeListItems& children = item->GetChildren(); + size_t count = children.GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + RefreshSelectedUnder(children[n]); + } +} + +// ---------------------------------------------------------------------------- +// changing colours: we need to refresh the tree control +// ---------------------------------------------------------------------------- + +bool wxTreeListMainWindow::SetBackgroundColour(const wxColour& colour) +{ + if ( !wxWindow::SetBackgroundColour(colour) ) + return FALSE; + + Refresh(); + + return TRUE; +} + +bool wxTreeListMainWindow::SetForegroundColour(const wxColour& colour) +{ + if ( !wxWindow::SetForegroundColour(colour) ) + return FALSE; + + Refresh(); + + return TRUE; +} + +//----------- ALB ------------- +inline +void wxTreeListMainWindow::SetItemText(const wxTreeItemId& item, size_t column, + const wxString& text) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + wxClientDC dc(this); + wxTreeListItem *pItem = (wxTreeListItem*) item.m_pItem; + pItem->SetText(column, text); + CalculateSize(pItem, dc); + RefreshLine(pItem); +} + +inline +wxString wxTreeListMainWindow::GetItemText(const wxTreeItemId& item, + size_t column) const +{ + wxCHECK_MSG( item.IsOk(), wxT(""), wxT("invalid tree item") ); + + return ((wxTreeListItem*) item.m_pItem)->GetText(column); +} + +//----------------------------- + +//----------------------------------------------------------------------------- +// wxTreeListCtrl +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTreeListCtrl, wxControl); + +BEGIN_EVENT_TABLE(wxTreeListCtrl, wxControl) + EVT_SIZE(wxTreeListCtrl::OnSize) +END_EVENT_TABLE(); + +bool wxTreeListCtrl::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, const wxValidator &validator, + const wxString& name) +{ + long main_style = style & ~(wxRAISED_BORDER|wxSUNKEN_BORDER + |wxSIMPLE_BORDER|wxNO_BORDER|wxDOUBLE_BORDER + |wxSTATIC_BORDER); + if(!wxControl::Create(parent, id, pos, size, style, validator, name)) + return false; + + m_main_win = new wxTreeListMainWindow(this, -1, wxPoint(0, 0), size, + main_style, validator); + m_header_win = new wxTreeListHeaderWindow(this, -1, m_main_win, + wxPoint(0, 0), wxDefaultSize, + wxTAB_TRAVERSAL); + return TRUE; +} + +void wxTreeListCtrl::OnSize(wxSizeEvent& event) +{ + int w, h; + GetClientSize(&w, &h); + if(m_header_win) + m_header_win->SetSize(0, 0, w, HEADER_HEIGHT); + if(m_main_win) + m_main_win->SetSize(0, HEADER_HEIGHT + 1, w, h - HEADER_HEIGHT - 1); +} + +size_t wxTreeListCtrl::GetCount() const { return m_main_win->GetCount(); } + +unsigned int wxTreeListCtrl::GetIndent() const +{ return m_main_win->GetIndent(); } + +void wxTreeListCtrl::SetIndent(unsigned int indent) +{ m_main_win->SetIndent(indent); } + +unsigned int wxTreeListCtrl::GetSpacing() const +{ return m_main_win->GetSpacing(); } + +void wxTreeListCtrl::SetSpacing(unsigned int spacing) +{ m_main_win->SetSpacing(spacing); } + +wxImageList* wxTreeListCtrl::GetImageList() const +{ return m_main_win->GetImageList(); } + +wxImageList* wxTreeListCtrl::GetStateImageList() const +{ return m_main_win->GetStateImageList(); } + +wxImageList* wxTreeListCtrl::GetButtonsImageList() const +{ return m_main_win->GetButtonsImageList(); } + +void wxTreeListCtrl::SetImageList(wxImageList* imageList) +{ m_main_win->SetImageList(imageList); } + +void wxTreeListCtrl::SetStateImageList(wxImageList* imageList) +{ m_main_win->SetStateImageList(imageList); } + +void wxTreeListCtrl::SetButtonsImageList(wxImageList* imageList) +{ m_main_win->SetButtonsImageList(imageList); } + +void wxTreeListCtrl::AssignImageList(wxImageList* imageList) +{ m_main_win->AssignImageList(imageList); } + +void wxTreeListCtrl::AssignStateImageList(wxImageList* imageList) +{ m_main_win->AssignStateImageList(imageList); } + +void wxTreeListCtrl::AssignButtonsImageList(wxImageList* imageList) +{ m_main_win->AssignButtonsImageList(imageList); } + +wxString wxTreeListCtrl::GetItemText(const wxTreeItemId& item, size_t column) + const +{ return m_main_win->GetItemText(item, column); } + +int wxTreeListCtrl::GetItemImage(const wxTreeItemId& item, size_t column, + wxTreeItemIcon which) const +{ return m_main_win->GetItemImage(item, column, which); } + +wxTreeItemData* wxTreeListCtrl::GetItemData(const wxTreeItemId& item) const +{ return m_main_win->GetItemData(item); } + +void wxTreeListCtrl::SetItemText(const wxTreeItemId& item, size_t column, + const wxString& text) +{ m_main_win->SetItemText(item, column, text); } + +void wxTreeListCtrl::SetItemImage(const wxTreeItemId& item, + size_t column, + int image, + wxTreeItemIcon which) +{ m_main_win->SetItemImage(item, column, image, which); } + +void wxTreeListCtrl::SetItemData(const wxTreeItemId& item, + wxTreeItemData* data) +{ m_main_win->SetItemData(item, data); } + +void wxTreeListCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) +{ m_main_win->SetItemHasChildren(item, has); } + +void wxTreeListCtrl::SetItemBold(const wxTreeItemId& item, bool bold) +{ m_main_win->SetItemBold(item, bold); } + +void wxTreeListCtrl::SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) +{ m_main_win->SetItemTextColour(item, col); } + +void wxTreeListCtrl::SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) +{ m_main_win->SetItemBackgroundColour(item, col); } + +void wxTreeListCtrl::SetItemFont(const wxTreeItemId& item, + const wxFont& font) +{ m_main_win->SetItemFont(item, font); } + +bool wxTreeListCtrl::SetFont(const wxFont& font) +{ + if(m_header_win) m_header_win->SetFont(font); + if(m_main_win) + return m_main_win->SetFont(font); + else return FALSE; +} + +void wxTreeListCtrl::SetWindowStyle(const long style) +{ + if(m_main_win) + m_main_win->SetWindowStyle(style); + // TODO: provide something like wxTL_NO_HEADERS to hide m_header_win +} + +long wxTreeListCtrl::GetWindowStyle() const +{ + long style = m_windowStyle; + if(m_main_win) + style |= m_main_win->GetWindowStyle(); + return style; +} + +bool wxTreeListCtrl::IsVisible(const wxTreeItemId& item) const +{ return m_main_win->IsVisible(item); } + +bool wxTreeListCtrl::ItemHasChildren(const wxTreeItemId& item) const +{ return m_main_win->ItemHasChildren(item); } + +bool wxTreeListCtrl::IsExpanded(const wxTreeItemId& item) const +{ return m_main_win->IsExpanded(item); } + +bool wxTreeListCtrl::IsSelected(const wxTreeItemId& item) const +{ return m_main_win->IsSelected(item); } + +bool wxTreeListCtrl::IsBold(const wxTreeItemId& item) const +{ return m_main_win->IsBold(item); } + +size_t wxTreeListCtrl::GetChildrenCount(const wxTreeItemId& item, bool rec) +{ return m_main_win->GetChildrenCount(item, rec); } + +wxTreeItemId wxTreeListCtrl::GetRootItem() const +{ return m_main_win->GetRootItem(); } + +wxTreeItemId wxTreeListCtrl::GetSelection() const +{ return m_main_win->GetSelection(); } + +size_t wxTreeListCtrl::GetSelections(wxArrayTreeItemIds& arr) const +{ return m_main_win->GetSelections(arr); } + +wxTreeItemId wxTreeListCtrl::GetParent(const wxTreeItemId& item) const +{ return m_main_win->GetParent(item); } + +wxTreeItemId wxTreeListCtrl::GetFirstChild(const wxTreeItemId& item, + long& cookie) const +{ return m_main_win->GetFirstChild(item, cookie); } + +wxTreeItemId wxTreeListCtrl::GetNextChild(const wxTreeItemId& item, + long& cookie) const +{ return m_main_win->GetNextChild(item, cookie); } + +wxTreeItemId wxTreeListCtrl::GetLastChild(const wxTreeItemId& item) const +{ return m_main_win->GetLastChild(item); } + +wxTreeItemId wxTreeListCtrl::GetNextSibling(const wxTreeItemId& item) const +{ return m_main_win->GetNextSibling(item); } + +wxTreeItemId wxTreeListCtrl::GetPrevSibling(const wxTreeItemId& item) const +{ return m_main_win->GetPrevSibling(item); } + +wxTreeItemId wxTreeListCtrl::GetFirstVisibleItem() const +{ return m_main_win->GetFirstVisibleItem(); } + +wxTreeItemId wxTreeListCtrl::GetNextVisible(const wxTreeItemId& item) const +{ return m_main_win->GetNextVisible(item); } + +wxTreeItemId wxTreeListCtrl::GetPrevVisible(const wxTreeItemId& item) const +{ return m_main_win->GetPrevVisible(item); } + +wxTreeItemId wxTreeListCtrl::GetNext(const wxTreeItemId& item) const +{ return m_main_win->GetNext(item); } + +wxTreeItemId wxTreeListCtrl::AddRoot(const wxString& text, int image, + int selectedImage, wxTreeItemData* data) +{ return m_main_win->AddRoot(text, image, selectedImage, data); } + +wxTreeItemId wxTreeListCtrl::PrependItem(const wxTreeItemId& parent, + const wxString& text, int image, + int selectedImage, + wxTreeItemData* data) +{ return m_main_win->PrependItem(parent, text, image, selectedImage, data); } + +wxTreeItemId wxTreeListCtrl::InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& previous, + const wxString& text, int image, + int selectedImage, + wxTreeItemData* data) +{ + return m_main_win->InsertItem(parent, previous, text, image, + selectedImage, data); +} + +wxTreeItemId wxTreeListCtrl::InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, int image, + int selectedImage, + wxTreeItemData* data) +{ + return m_main_win->InsertItem(parent, index, text, image, + selectedImage, data); +} + +wxTreeItemId wxTreeListCtrl::AppendItem(const wxTreeItemId& parent, + const wxString& text, int image, + int selectedImage, + wxTreeItemData* data) +{ return m_main_win->AppendItem(parent, text, image, selectedImage, data); } + +void wxTreeListCtrl::Delete(const wxTreeItemId& item) +{ m_main_win->Delete(item); } + +void wxTreeListCtrl::DeleteChildren(const wxTreeItemId& item) +{ m_main_win->DeleteChildren(item); } + +void wxTreeListCtrl::DeleteAllItems() +{ m_main_win->DeleteAllItems(); } + +void wxTreeListCtrl::Expand(const wxTreeItemId& item) +{ m_main_win->Expand(item); } + +void wxTreeListCtrl::ExpandAll(const wxTreeItemId& item) +{ m_main_win->ExpandAll(item); } + +void wxTreeListCtrl::Collapse(const wxTreeItemId& item) +{ m_main_win->Collapse(item); } + +void wxTreeListCtrl::CollapseAndReset(const wxTreeItemId& item) +{ m_main_win->CollapseAndReset(item); } + +void wxTreeListCtrl::Toggle(const wxTreeItemId& item) +{ m_main_win->Toggle(item); } + +void wxTreeListCtrl::Unselect() +{ m_main_win->Unselect(); } + +void wxTreeListCtrl::UnselectAll() +{ m_main_win->UnselectAll(); } + +void wxTreeListCtrl::SelectItem(const wxTreeItemId& item, bool unselect_others, + bool extended_select) +{ m_main_win->SelectItem(item, unselect_others, extended_select); } + +void wxTreeListCtrl::EnsureVisible(const wxTreeItemId& item) +{ m_main_win->EnsureVisible(item); } + +void wxTreeListCtrl::ScrollTo(const wxTreeItemId& item) +{ m_main_win->ScrollTo(item); } + +wxTreeItemId wxTreeListCtrl::HitTest(const wxPoint& pos, int& flags, + int& column) +{ + return m_main_win->HitTest(m_main_win->ScreenToClient(ClientToScreen(pos)), + flags, column); +} + +bool wxTreeListCtrl::GetBoundingRect(const wxTreeItemId& item, wxRect& rect, + bool textOnly) const +{ return m_main_win->GetBoundingRect(item, rect, textOnly); } + +void wxTreeListCtrl::Edit(const wxTreeItemId& item) +{ m_main_win->Edit(item); } + +int wxTreeListCtrl::OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) +{ return m_main_win->OnCompareItems(item1, item2); } + +void wxTreeListCtrl::SortChildren(const wxTreeItemId& item) +{ m_main_win->SortChildren(item); } + +bool wxTreeListCtrl::SetBackgroundColour(const wxColour& colour) +{ return m_main_win->SetBackgroundColour(colour); } + +bool wxTreeListCtrl::SetForegroundColour(const wxColour& colour) +{ return m_main_win->SetForegroundColour(colour); } + +size_t wxTreeListCtrl::GetColumnCount() const +{ return m_main_win->GetColumnCount(); } + +void wxTreeListCtrl::SetColumnWidth(size_t column, size_t width) +{ m_header_win->SetColumnWidth(column, width); } + +int wxTreeListCtrl::GetColumnWidth(size_t column) const +{ return m_header_win->GetColumnWidth(column); } + +void wxTreeListCtrl::SetMainColumn(size_t column) +{ m_main_win->SetMainColumn(column); } + +size_t wxTreeListCtrl::GetMainColumn() const +{ return m_main_win->GetMainColumn(); } + +void wxTreeListCtrl::SetColumnText(size_t column, const wxString& text) +{ + m_header_win->SetColumnText(column, text); + m_header_win->Refresh(); +} + +wxString wxTreeListCtrl::GetColumnText(size_t column) const +{ return m_header_win->GetColumnText(column); } + +void wxTreeListCtrl::AddColumn(const wxTreeListColumnInfo& col) +{ m_header_win->AddColumn(col); } + +void wxTreeListCtrl::InsertColumn(size_t before, + const wxTreeListColumnInfo& col) +{ m_header_win->InsertColumn(before, col); } + +void wxTreeListCtrl::RemoveColumn(size_t column) +{ m_header_win->RemoveColumn(column); } + +void wxTreeListCtrl::SetColumn(size_t column, const wxTreeListColumnInfo& col) +{ m_header_win->SetColumn(column, col); } + +const wxTreeListColumnInfo& wxTreeListCtrl::GetColumn(size_t column) const +{ return m_header_win->GetColumn(column); } + +wxTreeListColumnInfo& wxTreeListCtrl::GetColumn(size_t column) +{ return m_header_win->GetColumn(column); } + +void wxTreeListCtrl::Refresh(bool erase, const wxRect* rect) +{ + m_main_win->Refresh(erase, rect); + m_header_win->Refresh(erase, rect); +} + +void wxTreeListCtrl::SetFocus() +{ m_main_win->SetFocus(); } diff --git a/wxPython/contrib/gizmos/treelistctrl.h b/wxPython/contrib/gizmos/treelistctrl.h new file mode 100644 index 0000000000..27b3552240 --- /dev/null +++ b/wxPython/contrib/gizmos/treelistctrl.h @@ -0,0 +1,482 @@ +// -*- C++ -*- ////////////////////////////////////////////////////////////// +// Name: treelistctrl.h (derived by wx/treectrlg.h) +// Purpose: wxTreeListCtrl class +// Author: Robert Roebling +// Modified by: Alberto Griggio, 2002 +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1997,1998 Robert Roebling +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + + +#ifndef TREELISRCTRL_H +#define TREELISTCTRL_H + +#ifdef __GNUG__ + #pragma interface "treelistctrl.h" +#endif + +#include +#include +#include +#include // for wxListEvent + +#ifdef GIZMOISDLL +#define GIZMODLLEXPORT WXDLLEXPORT +#else +#define GIZMODLLEXPORT +#endif + + +class GIZMODLLEXPORT wxTreeListItem; +class GIZMODLLEXPORT wxTreeListHeaderWindow; +class GIZMODLLEXPORT wxTreeListMainWindow; + +//----------------------------------------------------------------------------- +// wxTreeListColumnAttrs +//----------------------------------------------------------------------------- + +enum wxTreeListColumnAlign { + wxTL_ALIGN_LEFT, + wxTL_ALIGN_RIGHT, + wxTL_ALIGN_CENTER +}; + + +class GIZMODLLEXPORT wxTreeListColumnInfo: public wxObject { +public: + static const size_t DEFAULT_COL_WIDTH = 100; + + wxTreeListColumnInfo(const wxChar* text = wxT(""), + int image = -1, + size_t width = DEFAULT_COL_WIDTH, + wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT) + { + m_image = image; + m_selected_image = -1; + m_text = text; + m_width = width; + m_alignment = alignment; + } + + // getters + wxTreeListColumnAlign GetAlignment() const { return m_alignment; } + wxString GetText() const { return m_text; } + int GetImage() const { return m_image; } + int GetSelectedImage() const { return m_selected_image; } + size_t GetWidth() const { return m_width; } + + // setters + wxTreeListColumnInfo& SetAlignment(wxTreeListColumnAlign alignment) + { m_alignment = alignment; return *this; } + + wxTreeListColumnInfo& SetText(const wxString& text) + { m_text = text; return *this; } + + wxTreeListColumnInfo& SetImage(int image) + { m_image = image; return *this; } + + wxTreeListColumnInfo& SetSelectedImage(int image) + { m_selected_image = image; return *this; } + + wxTreeListColumnInfo& SetWidth(size_t with) + { m_width = with; return *this; } + +private: + wxTreeListColumnAlign m_alignment; + wxString m_text; + int m_image; + int m_selected_image; + size_t m_width; +}; + +//---------------------------------------------------------------------------- +// wxTreeListCtrl - the multicolumn tree control +//---------------------------------------------------------------------------- + +// additional flag for HitTest +const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000; +extern GIZMODLLEXPORT const wxChar* wxTreeListCtrlNameStr; + + +class GIZMODLLEXPORT wxTreeListCtrl : public wxControl +{ +public: + // creation + // -------- + wxTreeListCtrl() {} + + wxTreeListCtrl(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeListCtrlNameStr ) + { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeListCtrl() {} + + bool Create(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeListCtrlNameStr ); + + void Refresh(bool erase=TRUE, const wxRect* rect=NULL); + void SetFocus(); + // accessors + // --------- + + // get the total number of items in the control + size_t GetCount() const; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + unsigned int GetIndent() const; + void SetIndent(unsigned int indent); + + // spacing is the number of pixels between the start and the Text + unsigned int GetSpacing() const; + void SetSpacing(unsigned int spacing); + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that when assigned with + // SetImageList, the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. If you use + // AssignImageList, the control _does_ delete the image list. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const; + wxImageList *GetStateImageList() const; + wxImageList *GetButtonsImageList() const; + + void SetImageList(wxImageList *imageList); + void SetStateImageList(wxImageList *imageList); + void SetButtonsImageList(wxImageList *imageList); + void AssignImageList(wxImageList *imageList); + void AssignStateImageList(wxImageList *imageList); + void AssignButtonsImageList(wxImageList *imageList); + + + // Functions to work with tree list ctrl columns + + // adds a column + void AddColumn(const wxString& text) + { AddColumn(wxTreeListColumnInfo().SetText(text)); } + void AddColumn(const wxTreeListColumnInfo& col); + + // inserts a column before the given one + void InsertColumn(size_t before, const wxString& text) + { InsertColumn(before, wxTreeListColumnInfo().SetText(text)); } + void InsertColumn(size_t before, const wxTreeListColumnInfo& col); + + // deletes the given column - does not delete the corresponding column + // of each item + void RemoveColumn(size_t column); + + // returns the number of columns in the ctrl + size_t GetColumnCount() const; + + void SetColumnWidth(size_t column, size_t width); + int GetColumnWidth(size_t column) const; + + // tells which column is the "main" one, i.e. the "threaded" one + void SetMainColumn(size_t column); + size_t GetMainColumn() const; + + void SetColumnText(size_t column, const wxString& text); + wxString GetColumnText(size_t column) const; + + void SetColumn(size_t column, const wxTreeListColumnInfo& info); + wxTreeListColumnInfo& GetColumn(size_t column); + const wxTreeListColumnInfo& GetColumn(size_t column) const; + + + // Functions to work with tree list ctrl items. + + // accessors + // --------- + + // retrieve item's label (of the main column) + wxString GetItemText(const wxTreeItemId& item) const + { return GetItemText(item, GetMainColumn()); } + // retrieves item's label of the given column + wxString GetItemText(const wxTreeItemId& item, size_t column) const; + + // get one of the images associated with the item (normal by default) + int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const + { return GetItemImage(item, GetMainColumn(), which); } + int GetItemImage(const wxTreeItemId& item, size_t column, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const; + + // get the data associated with the item + wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + + // modifiers + // --------- + + // set item's label + void SetItemText(const wxTreeItemId& item, const wxString& text) + { SetItemText(item, GetMainColumn(), text); } + void SetItemText(const wxTreeItemId& item, size_t column, + const wxString& text); + + // get one of the images associated with the item (normal by default) + void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) + { SetItemImage(item, GetMainColumn(), image, which); } + // the which parameter is ignored for all columns but the main one + void SetItemImage(const wxTreeItemId& item, size_t column, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); + + // associate some data with the item + void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); + + // the item will be shown in bold + void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + + // set the item's text colour + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + + // set the item's background colour + void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col); + + // set the item's font (should be of the same height for all items) + void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + // set the window font + virtual bool SetFont( const wxFont &font ); + + // set the styles. + void SetWindowStyle(const long styles); + long GetWindowStyle() const; + long GetWindowStyleFlag() const { return GetWindowStyle(); } + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + bool IsVisible(const wxTreeItemId& item) const; + // does the item has any children? + bool HasChildren(const wxTreeItemId& item) const + { return ItemHasChildren(item); } + bool ItemHasChildren(const wxTreeItemId& item) const; + // is the item expanded (only makes sense if HasChildren())? + bool IsExpanded(const wxTreeItemId& item) const; + // is this item currently selected (the same as has focus)? + bool IsSelected(const wxTreeItemId& item) const; + // is item text in bold font? + bool IsBold(const wxTreeItemId& item) const; + // does the layout include space for a button? + + // number of children + // ------------------ + + // if 'recursively' is FALSE, only immediate children count, otherwise + // the returned number is the number of all items in this branch + size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return FALSE if there is no such item + + // get the root tree item + wxTreeItemId GetRootItem() const; + + // get the item currently selected (may return NULL if no selection) + wxTreeItemId GetSelection() const; + + // get the items currently selected, return the number of such item + size_t GetSelections(wxArrayTreeItemIds&) const; + + // get the parent of this item (may return NULL if root) + wxTreeItemId GetParent(const wxTreeItemId& item) const; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const; + // get the next child + wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const; + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + // get the next sibling of this item + wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + // get the previous sibling + wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + // get first visible item + wxTreeItemId GetFirstVisibleItem() const; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + // get the previous visible item: item must be visible itself! + wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // Only for internal use right now, but should probably be public + wxTreeItemId GetNext(const wxTreeItemId& item) const; + + // operations + // ---------- + + // add the root node to the tree + wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item before the one with the given index + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // delete this item and associated data if any + void Delete(const wxTreeItemId& item); + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteChildren(const wxTreeItemId& item); + // delete all items from the tree + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteAllItems(); + + // expand this item + void Expand(const wxTreeItemId& item); + // expand this item and all subitems recursively + void ExpandAll(const wxTreeItemId& item); + // collapse the item without removing its children + void Collapse(const wxTreeItemId& item); + // collapse the item and remove all children + void CollapseAndReset(const wxTreeItemId& item); + // toggles the current state + void Toggle(const wxTreeItemId& item); + + // remove the selection from currently selected item (if any) + void Unselect(); + void UnselectAll(); + // select this item + void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, + bool extended_select=FALSE); + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + void EnsureVisible(const wxTreeItemId& item); + // scroll to this item (but don't expand its parent) + void ScrollTo(const wxTreeItemId& item); + //void AdjustMyScrollbars(); + + // The first function is more portable (because easier to implement + // on other platforms), but the second one returns some extra info. + wxTreeItemId HitTest(const wxPoint& point) + { int dummy; return HitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags) + { int col; return HitTest(point, flags, col); } + wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column); + + // get the bounding rectangle of the item (or of its label only) + bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = FALSE) const; + + // Start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. + void EditLabel( const wxTreeItemId& item ) { Edit( item ); } + void Edit( const wxTreeItemId& item ); + + // sorting + // this function is called to compare 2 items and should return -1, 0 + // or +1 if the first item is less than, equal to or greater than the + // second one. The base class version performs alphabetic comparaison + // of item labels (GetText) + virtual int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2); + // sort the children of this item using OnCompareItems + // + // NB: this function is not reentrant and not MT-safe (FIXME)! + void SortChildren(const wxTreeItemId& item); + + // deprecated functions: use Set/GetItemImage directly + // get the selected item image + int GetItemSelectedImage(const wxTreeItemId& item) const + { return GetItemImage(item, wxTreeItemIcon_Selected); } + // set the selected item image + void SetItemSelectedImage(const wxTreeItemId& item, int image) + { SetItemImage(item, image, wxTreeItemIcon_Selected); } + + // implementation only from now on + + // overridden base class virtuals + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); + + + wxTreeListHeaderWindow* GetHeaderWindow() const + { return m_header_win; } + + wxTreeListMainWindow* GetMainWindow() const + { return m_main_win; } + + +protected: + // header window, responsible for column visualization and manipulation + wxTreeListHeaderWindow* m_header_win; + // main window, the "true" tree ctrl + wxTreeListMainWindow* m_main_win; + + // the common part of all ctors + void Init(); + + void OnSize(wxSizeEvent& event); + + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxTreeListCtrl) +}; + +#endif // TREELISTCTRL_H + diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index 941b18093a..4dd8d262a6 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -32,6 +32,7 @@ _treeList = [ 'PopupMenu', 'AnalogClockWindow', 'MaskedEditControls', + 'wxTreeListCtrl', ]), # managed windows == things with a (optional) caption you can close @@ -134,6 +135,7 @@ _treeList = [ 'wxStyledTextCtrl_1', 'wxStyledTextCtrl_2', 'wxTimeCtrl', + 'wxTreeListCtrl', ]), # How to lay out the controls in a frame/dialog diff --git a/wxPython/demo/wxTreeListCtrl.py b/wxPython/demo/wxTreeListCtrl.py new file mode 100644 index 0000000000..b3da5ea405 --- /dev/null +++ b/wxPython/demo/wxTreeListCtrl.py @@ -0,0 +1,102 @@ + +from wxPython.wx import * +from wxPython.gizmos import wxTreeListCtrl + +import images + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent, log): + self.log = log + wxPanel.__init__(self, parent, -1) + EVT_SIZE(self, self.OnSize) + + self.tree = wxTreeListCtrl(self, -1, style = wxTR_DEFAULT_STYLE + #wxTR_TWIST_BUTTONS + ) + isz = (16,16) + il = wxImageList(isz[0], isz[1]) + fldridx = il.Add(wxArtProvider_GetBitmap(wxART_FOLDER, wxART_OTHER, isz)) + fldropenidx = il.Add(wxArtProvider_GetBitmap(wxART_FILE_OPEN, wxART_OTHER, isz)) + fileidx = il.Add(wxArtProvider_GetBitmap(wxART_REPORT_VIEW, wxART_OTHER, isz)) + smileidx = il.Add(images.getSmilesBitmap()) + + self.tree.SetImageList(il) + self.il = il + + # create some columns + self.tree.AddColumn("Main column") + self.tree.AddColumn("Column 1") + self.tree.AddColumn("Column 2") + self.tree.SetMainColumn(0) # the one with the tree in it... + self.tree.SetColumnWidth(0, 175) + + + self.root = self.tree.AddRoot("The Root Item") + self.tree.SetItemText(self.root, "col 1 root", 1) + self.tree.SetItemText(self.root, "col 2 root", 2) + self.tree.SetItemImage(self.root, fldridx, which = wxTreeItemIcon_Normal) + self.tree.SetItemImage(self.root, fldropenidx, which = wxTreeItemIcon_Expanded) + + + for x in range(15): + txt = "Item %d" % x + child = self.tree.AppendItem(self.root, txt) + self.tree.SetItemText(child, txt + "(c1)", 1) + self.tree.SetItemText(child, txt + "(c2)", 2) + self.tree.SetItemImage(child, fldridx, which = wxTreeItemIcon_Normal) + self.tree.SetItemImage(child, fldropenidx, which = wxTreeItemIcon_Expanded) + + for y in range(5): + txt = "item %d-%s" % (x, chr(ord("a")+y)) + last = self.tree.AppendItem(child, txt) + self.tree.SetItemText(last, txt + "(c1)", 1) + self.tree.SetItemText(last, txt + "(c2)", 2) + self.tree.SetItemImage(last, fldridx, which = wxTreeItemIcon_Normal) + self.tree.SetItemImage(last, fldropenidx, which = wxTreeItemIcon_Expanded) + + for z in range(5): + txt = "item %d-%s-%d" % (x, chr(ord("a")+y), z) + item = self.tree.AppendItem(last, txt) + self.tree.SetItemText(item, txt + "(c1)", 1) + self.tree.SetItemText(item, txt + "(c2)", 2) + self.tree.SetItemImage(item, fileidx, which = wxTreeItemIcon_Normal) + self.tree.SetItemImage(item, smileidx, which = wxTreeItemIcon_Selected) + + + self.tree.Expand(self.root) + + + def OnSize(self, evt): + self.tree.SetSize(self.GetSize()) + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestPanel(nb, log) + return win + +#---------------------------------------------------------------------- + + + +overview = """ +

wxTreeListCtrl

+ +The wxTreeListCtrl is essentially a wxTreeCtrl with extra columns, +such that the look is similar to a wxListCtrl. + + +""" + + + + +if __name__ == '__main__': + #raw_input("Press enter...") + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) + diff --git a/wxPython/setup.py b/wxPython/setup.py index 3cac20573c..0254afd444 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -983,11 +983,14 @@ if BUILD_GIZMOS: contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC) ext = Extension('gizmosc', [ - '%s/dynamicsash.cpp' % GIZMOLOC, - '%s/editlbox.cpp' % GIZMOLOC, - #'%s/multicell.cpp' % GIZMOLOC, - '%s/splittree.cpp' % GIZMOLOC, - '%s/ledctrl.cpp' % GIZMOLOC, + '%s/dynamicsash.cpp' % GIZMOLOC, + '%s/editlbox.cpp' % GIZMOLOC, + '%s/splittree.cpp' % GIZMOLOC, + '%s/ledctrl.cpp' % GIZMOLOC, + #'%s/multicell.cpp' % GIZMOLOC, + + '%s/treelistctrl.cpp' % location, + ] + swig_sources, include_dirs = gizmos_includes, diff --git a/wxPython/src/pytree.h b/wxPython/src/pytree.h new file mode 100644 index 0000000000..dc178a7278 --- /dev/null +++ b/wxPython/src/pytree.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pytree.h +// Purpose: Common declarations of tree stuff for wxTreeCtrl in the core +// and wxTreeListCtrl in gizmos +// +// Author: Robin Dunn +// +// Created: 30-April-2003 +// RCS-ID: $Id$ +// Copyright: (c) 2003 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + + + + +class wxPyTreeItemData : public wxTreeItemData { +public: + wxPyTreeItemData(PyObject* obj = NULL) { + if (obj == NULL) + obj = Py_None; + Py_INCREF(obj); + m_obj = obj; + } + + ~wxPyTreeItemData() { + wxPyBeginBlockThreads(); + Py_DECREF(m_obj); + wxPyEndBlockThreads(); + } + + PyObject* GetData() { + Py_INCREF(m_obj); + return m_obj; + } + + void SetData(PyObject* obj) { + wxPyBeginBlockThreads(); + Py_DECREF(m_obj); + wxPyEndBlockThreads(); + m_obj = obj; + Py_INCREF(obj); + } + + PyObject* m_obj; +}; +