Switch to the TreeListCtrl from the wxCode project.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-05-25 04:59:23 +00:00
parent 99b1023fd8
commit 28eab81fdc
9 changed files with 1346 additions and 985 deletions

View File

@@ -25,6 +25,11 @@
%rename(TL_ALIGN_RIGHT) wxTL_ALIGN_RIGHT; %rename(TL_ALIGN_RIGHT) wxTL_ALIGN_RIGHT;
%rename(TL_ALIGN_CENTER) wxTL_ALIGN_CENTER; %rename(TL_ALIGN_CENTER) wxTL_ALIGN_CENTER;
%rename(TREE_HITTEST_ONITEMCOLUMN) wxTREE_HITTEST_ONITEMCOLUMN; %rename(TREE_HITTEST_ONITEMCOLUMN) wxTREE_HITTEST_ONITEMCOLUMN;
%rename(TL_SEARCH_VISIBLE) wxTL_SEARCH_VISIBLE;
%rename(TL_SEARCH_LEVEL) wxTL_SEARCH_LEVEL;
%rename(TL_SEARCH_FULL) wxTL_SEARCH_FULL;
%rename(TL_SEARCH_PARTIAL) wxTL_SEARCH_PARTIAL;
%rename(TL_SEARCH_NOCASE) wxTL_SEARCH_NOCASE;
%rename(TreeListColumnInfo) wxTreeListColumnInfo; %rename(TreeListColumnInfo) wxTreeListColumnInfo;
#endif #endif

View File

@@ -31,7 +31,7 @@
#include <wx/treectrl.h> #include <wx/treectrl.h>
#include <wx/imaglist.h> #include <wx/imaglist.h>
#include "treelistctrl.h" #include "wx/treelistctrl.h"
#include "wx/wxPython/pytree.h" #include "wx/wxPython/pytree.h"
%} %}
@@ -421,6 +421,15 @@ enum {
}; };
enum {
// flags for FindItem
wxTL_SEARCH_VISIBLE,
wxTL_SEARCH_LEVEL,
wxTL_SEARCH_FULL,
wxTL_SEARCH_PARTIAL,
wxTL_SEARCH_NOCASE
};
class wxTreeListColumnInfo: public wxObject { class wxTreeListColumnInfo: public wxObject {
@@ -428,14 +437,18 @@ public:
wxTreeListColumnInfo(const wxString& text = wxPyEmptyString, wxTreeListColumnInfo(const wxString& text = wxPyEmptyString,
int image = -1, int image = -1,
size_t width = 100, size_t width = 100,
bool shown = True,
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT); wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT);
bool GetShown() const;
wxTreeListColumnAlign GetAlignment() const; wxTreeListColumnAlign GetAlignment() const;
wxString GetText() const; wxString GetText() const;
int GetImage() const; int GetImage() const;
int GetSelectedImage() const; int GetSelectedImage() const;
size_t GetWidth() const; size_t GetWidth() const;
// TODO: These all actually return wxTreeListColumnInfo&, any problem with doing it for Python too?
void SetShown(bool shown);
void SetAlignment(wxTreeListColumnAlign alignment); void SetAlignment(wxTreeListColumnAlign alignment);
void SetText(const wxString& text); void SetText(const wxString& text);
void SetImage(int image); void SetImage(int image);
@@ -521,10 +534,6 @@ public:
unsigned int GetIndent() const; unsigned int GetIndent() const;
void SetIndent(unsigned int indent); 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);
// line spacing is the space above and below the text on each line // line spacing is the space above and below the text on each line
unsigned int GetLineSpacing() const; unsigned int GetLineSpacing() const;
void SetLineSpacing(unsigned int spacing); void SetLineSpacing(unsigned int spacing);
@@ -558,6 +567,9 @@ public:
// adds a column // adds a column
void AddColumn(const wxString& text); void AddColumn(const wxString& text);
// void AddColumn(const wxString& text,
// size_t width,
// wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT);
%name(AddColumnInfo) void AddColumn(const wxTreeListColumnInfo& col); %name(AddColumnInfo) void AddColumn(const wxTreeListColumnInfo& col);
// inserts a column before the given one // inserts a column before the given one
@@ -591,6 +603,8 @@ public:
void SetColumnImage(size_t column, int image); void SetColumnImage(size_t column, int image);
int GetColumnImage(size_t column) const; int GetColumnImage(size_t column) const;
void ShowColumn(size_t column, bool shown);
bool IsColumnShown(size_t column) const;
%extend { %extend {
// retrieves item's label of the given column (main column by default) // retrieves item's label of the given column (main column by default)
@@ -674,11 +688,11 @@ public:
void SetItemBold(const wxTreeItemId& item, bool bold = True); void SetItemBold(const wxTreeItemId& item, bool bold = True);
// set the item's text colour // set the item's text colour
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour);
// set the item's background colour // set the item's background colour
void SetItemBackgroundColour(const wxTreeItemId& item, void SetItemBackgroundColour(const wxTreeItemId& item,
const wxColour& col); const wxColour& colour);
// set the item's font (should be of the same height for all items) // set the item's font (should be of the same height for all items)
void SetItemFont(const wxTreeItemId& item, const wxFont& font); void SetItemFont(const wxTreeItemId& item, const wxFont& font);
@@ -738,7 +752,7 @@ public:
// get the parent of this item (may return NULL if root) // get the parent of this item (may return NULL if root)
%name(GetItemParent)wxTreeItemId GetParent(const wxTreeItemId& item) const; wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
// for this enumeration function you must pass in a "cookie" parameter // for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library // which is opaque for the application but is necessary for the library
@@ -748,17 +762,19 @@ public:
// the same! // the same!
// NOTE: These are a copy of the same methods in _treectrl.i, be sure to
// update both at the same time. (Or find a good way to refactor!)
%extend { %extend {
// Get the first child of this item. Returns a wxTreeItemId and an // Get the first child of this item. Returns a wxTreeItemId and an
// opaque "cookie" value that should be passed to GetNextChild in // opaque "cookie" value that should be passed to GetNextChild in
// order to continue the search. // order to continue the search.
PyObject* GetFirstChild(const wxTreeItemId& item) { PyObject* GetFirstChild(const wxTreeItemId& item) {
long cookie = 0; void* cookie = 0;
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2); PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked); wxPyEndBlockThreads(blocked);
return tup; return tup;
} }
@@ -768,15 +784,19 @@ public:
// value returned from GetFirstChild or the previous GetNextChild. // value returned from GetFirstChild or the previous GetNextChild.
// Returns a wxTreeItemId and an opaque "cookie" value that should be // Returns a wxTreeItemId and an opaque "cookie" value that should be
// passed to GetNextChild in order to continue the search. // passed to GetNextChild in order to continue the search.
PyObject* GetNextChild(const wxTreeItemId& item, long cookie) { PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) {
wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie));
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2); PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked); wxPyEndBlockThreads(blocked);
return tup; return tup;
} }
// TODO: GetPrevChild
} }
// get the last child of this item - this method doesn't use cookies // get the last child of this item - this method doesn't use cookies
@@ -868,6 +888,8 @@ public:
void SelectItem(const wxTreeItemId& item, bool unselect_others=True, void SelectItem(const wxTreeItemId& item, bool unselect_others=True,
bool extended_select=False); bool extended_select=False);
void SelectAll(bool extended_select=False);
// make sure this item is visible (expanding the parent item and/or // make sure this item is visible (expanding the parent item and/or
// scrolling to this item if necessary) // scrolling to this item if necessary)
void EnsureVisible(const wxTreeItemId& item); void EnsureVisible(const wxTreeItemId& item);
@@ -905,12 +927,8 @@ public:
// sort the children of this item using OnCompareItems // sort the children of this item using OnCompareItems
void SortChildren(const wxTreeItemId& item); void SortChildren(const wxTreeItemId& item);
// get the selected item image // searching
int GetItemSelectedImage(const wxTreeItemId& item) const; wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
// set the selected item image
void SetItemSelectedImage(const wxTreeItemId& item, int image);
wxWindow* GetHeaderWindow() const; wxWindow* GetHeaderWindow() const;
wxWindow* GetMainWindow() const; wxWindow* GetMainWindow() const;
@@ -935,8 +953,3 @@ public:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@@ -353,18 +353,27 @@ TL_ALIGN_LEFT = _gizmos.TL_ALIGN_LEFT
TL_ALIGN_RIGHT = _gizmos.TL_ALIGN_RIGHT TL_ALIGN_RIGHT = _gizmos.TL_ALIGN_RIGHT
TL_ALIGN_CENTER = _gizmos.TL_ALIGN_CENTER TL_ALIGN_CENTER = _gizmos.TL_ALIGN_CENTER
TREE_HITTEST_ONITEMCOLUMN = _gizmos.TREE_HITTEST_ONITEMCOLUMN TREE_HITTEST_ONITEMCOLUMN = _gizmos.TREE_HITTEST_ONITEMCOLUMN
TL_SEARCH_VISIBLE = _gizmos.TL_SEARCH_VISIBLE
TL_SEARCH_LEVEL = _gizmos.TL_SEARCH_LEVEL
TL_SEARCH_FULL = _gizmos.TL_SEARCH_FULL
TL_SEARCH_PARTIAL = _gizmos.TL_SEARCH_PARTIAL
TL_SEARCH_NOCASE = _gizmos.TL_SEARCH_NOCASE
class TreeListColumnInfo(_core.Object): class TreeListColumnInfo(_core.Object):
def __repr__(self): def __repr__(self):
return "<%s.%s; proxy of C++ wxTreeListColumnInfo instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) return "<%s.%s; proxy of C++ wxTreeListColumnInfo instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
""" """
__init__(self, String text=EmptyString, int image=-1, size_t width=100, __init__(self, String text=EmptyString, int image=-1, size_t width=100,
int alignment=TL_ALIGN_LEFT) -> TreeListColumnInfo bool shown=True, int alignment=TL_ALIGN_LEFT) -> TreeListColumnInfo
""" """
newobj = _gizmos.new_TreeListColumnInfo(*args, **kwargs) newobj = _gizmos.new_TreeListColumnInfo(*args, **kwargs)
self.this = newobj.this self.this = newobj.this
self.thisown = 1 self.thisown = 1
del newobj.thisown del newobj.thisown
def GetShown(*args, **kwargs):
"""GetShown(self) -> bool"""
return _gizmos.TreeListColumnInfo_GetShown(*args, **kwargs)
def GetAlignment(*args, **kwargs): def GetAlignment(*args, **kwargs):
"""GetAlignment(self) -> int""" """GetAlignment(self) -> int"""
return _gizmos.TreeListColumnInfo_GetAlignment(*args, **kwargs) return _gizmos.TreeListColumnInfo_GetAlignment(*args, **kwargs)
@@ -385,6 +394,10 @@ class TreeListColumnInfo(_core.Object):
"""GetWidth(self) -> size_t""" """GetWidth(self) -> size_t"""
return _gizmos.TreeListColumnInfo_GetWidth(*args, **kwargs) return _gizmos.TreeListColumnInfo_GetWidth(*args, **kwargs)
def SetShown(*args, **kwargs):
"""SetShown(self, bool shown)"""
return _gizmos.TreeListColumnInfo_SetShown(*args, **kwargs)
def SetAlignment(*args, **kwargs): def SetAlignment(*args, **kwargs):
"""SetAlignment(self, int alignment)""" """SetAlignment(self, int alignment)"""
return _gizmos.TreeListColumnInfo_SetAlignment(*args, **kwargs) return _gizmos.TreeListColumnInfo_SetAlignment(*args, **kwargs)
@@ -456,14 +469,6 @@ class TreeListCtrl(_core.Control):
"""SetIndent(self, unsigned int indent)""" """SetIndent(self, unsigned int indent)"""
return _gizmos.TreeListCtrl_SetIndent(*args, **kwargs) return _gizmos.TreeListCtrl_SetIndent(*args, **kwargs)
def GetSpacing(*args, **kwargs):
"""GetSpacing(self) -> unsigned int"""
return _gizmos.TreeListCtrl_GetSpacing(*args, **kwargs)
def SetSpacing(*args, **kwargs):
"""SetSpacing(self, unsigned int spacing)"""
return _gizmos.TreeListCtrl_SetSpacing(*args, **kwargs)
def GetLineSpacing(*args, **kwargs): def GetLineSpacing(*args, **kwargs):
"""GetLineSpacing(self) -> unsigned int""" """GetLineSpacing(self) -> unsigned int"""
return _gizmos.TreeListCtrl_GetLineSpacing(*args, **kwargs) return _gizmos.TreeListCtrl_GetLineSpacing(*args, **kwargs)
@@ -580,6 +585,14 @@ class TreeListCtrl(_core.Control):
"""GetColumnImage(self, size_t column) -> int""" """GetColumnImage(self, size_t column) -> int"""
return _gizmos.TreeListCtrl_GetColumnImage(*args, **kwargs) return _gizmos.TreeListCtrl_GetColumnImage(*args, **kwargs)
def ShowColumn(*args, **kwargs):
"""ShowColumn(self, size_t column, bool shown)"""
return _gizmos.TreeListCtrl_ShowColumn(*args, **kwargs)
def IsColumnShown(*args, **kwargs):
"""IsColumnShown(self, size_t column) -> bool"""
return _gizmos.TreeListCtrl_IsColumnShown(*args, **kwargs)
def GetItemText(*args, **kwargs): def GetItemText(*args, **kwargs):
"""GetItemText(self, TreeItemId item, int column=-1) -> String""" """GetItemText(self, TreeItemId item, int column=-1) -> String"""
return _gizmos.TreeListCtrl_GetItemText(*args, **kwargs) return _gizmos.TreeListCtrl_GetItemText(*args, **kwargs)
@@ -623,11 +636,11 @@ class TreeListCtrl(_core.Control):
return _gizmos.TreeListCtrl_SetItemBold(*args, **kwargs) return _gizmos.TreeListCtrl_SetItemBold(*args, **kwargs)
def SetItemTextColour(*args, **kwargs): def SetItemTextColour(*args, **kwargs):
"""SetItemTextColour(self, TreeItemId item, Colour col)""" """SetItemTextColour(self, TreeItemId item, Colour colour)"""
return _gizmos.TreeListCtrl_SetItemTextColour(*args, **kwargs) return _gizmos.TreeListCtrl_SetItemTextColour(*args, **kwargs)
def SetItemBackgroundColour(*args, **kwargs): def SetItemBackgroundColour(*args, **kwargs):
"""SetItemBackgroundColour(self, TreeItemId item, Colour col)""" """SetItemBackgroundColour(self, TreeItemId item, Colour colour)"""
return _gizmos.TreeListCtrl_SetItemBackgroundColour(*args, **kwargs) return _gizmos.TreeListCtrl_SetItemBackgroundColour(*args, **kwargs)
def SetItemFont(*args, **kwargs): def SetItemFont(*args, **kwargs):
@@ -695,7 +708,7 @@ class TreeListCtrl(_core.Control):
return _gizmos.TreeListCtrl_GetFirstChild(*args, **kwargs) return _gizmos.TreeListCtrl_GetFirstChild(*args, **kwargs)
def GetNextChild(*args, **kwargs): def GetNextChild(*args, **kwargs):
"""GetNextChild(self, TreeItemId item, long cookie) -> PyObject""" """GetNextChild(self, TreeItemId item, void cookie) -> PyObject"""
return _gizmos.TreeListCtrl_GetNextChild(*args, **kwargs) return _gizmos.TreeListCtrl_GetNextChild(*args, **kwargs)
def GetLastChild(*args, **kwargs): def GetLastChild(*args, **kwargs):
@@ -802,6 +815,10 @@ class TreeListCtrl(_core.Control):
"""SelectItem(self, TreeItemId item, bool unselect_others=True, bool extended_select=False)""" """SelectItem(self, TreeItemId item, bool unselect_others=True, bool extended_select=False)"""
return _gizmos.TreeListCtrl_SelectItem(*args, **kwargs) return _gizmos.TreeListCtrl_SelectItem(*args, **kwargs)
def SelectAll(*args, **kwargs):
"""SelectAll(self, bool extended_select=False)"""
return _gizmos.TreeListCtrl_SelectAll(*args, **kwargs)
def EnsureVisible(*args, **kwargs): def EnsureVisible(*args, **kwargs):
"""EnsureVisible(self, TreeItemId item)""" """EnsureVisible(self, TreeItemId item)"""
return _gizmos.TreeListCtrl_EnsureVisible(*args, **kwargs) return _gizmos.TreeListCtrl_EnsureVisible(*args, **kwargs)
@@ -830,13 +847,9 @@ class TreeListCtrl(_core.Control):
"""SortChildren(self, TreeItemId item)""" """SortChildren(self, TreeItemId item)"""
return _gizmos.TreeListCtrl_SortChildren(*args, **kwargs) return _gizmos.TreeListCtrl_SortChildren(*args, **kwargs)
def GetItemSelectedImage(*args, **kwargs): def FindItem(*args, **kwargs):
"""GetItemSelectedImage(self, TreeItemId item) -> int""" """FindItem(self, TreeItemId item, String str, int flags=0) -> TreeItemId"""
return _gizmos.TreeListCtrl_GetItemSelectedImage(*args, **kwargs) return _gizmos.TreeListCtrl_FindItem(*args, **kwargs)
def SetItemSelectedImage(*args, **kwargs):
"""SetItemSelectedImage(self, TreeItemId item, int image)"""
return _gizmos.TreeListCtrl_SetItemSelectedImage(*args, **kwargs)
def GetHeaderWindow(*args, **kwargs): def GetHeaderWindow(*args, **kwargs):
"""GetHeaderWindow(self) -> Window""" """GetHeaderWindow(self) -> Window"""

View File

@@ -304,7 +304,7 @@ static swig_type_info *swig_types[32];
#include <wx/treectrl.h> #include <wx/treectrl.h>
#include <wx/imaglist.h> #include <wx/imaglist.h>
#include "treelistctrl.h" #include "wx/treelistctrl.h"
#include "wx/wxPython/pytree.h" #include "wx/wxPython/pytree.h"
@@ -637,21 +637,21 @@ PyObject *wxPyTreeListCtrl_GetSelections(wxPyTreeListCtrl *self){
return rval; return rval;
} }
PyObject *wxPyTreeListCtrl_GetFirstChild(wxPyTreeListCtrl *self,wxTreeItemId const &item){ PyObject *wxPyTreeListCtrl_GetFirstChild(wxPyTreeListCtrl *self,wxTreeItemId const &item){
long cookie = 0; void* cookie = 0;
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2); PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked); wxPyEndBlockThreads(blocked);
return tup; return tup;
} }
PyObject *wxPyTreeListCtrl_GetNextChild(wxPyTreeListCtrl *self,wxTreeItemId const &item,long cookie){ PyObject *wxPyTreeListCtrl_GetNextChild(wxPyTreeListCtrl *self,wxTreeItemId const &item,void *cookie){
wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie));
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2); PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked); wxPyEndBlockThreads(blocked);
return tup; return tup;
} }
@@ -2289,18 +2289,20 @@ static PyObject *_wrap_new_TreeListColumnInfo(PyObject *self, PyObject *args, Py
wxString *arg1 = (wxString *) &arg1_defvalue ; wxString *arg1 = (wxString *) &arg1_defvalue ;
int arg2 = (int) -1 ; int arg2 = (int) -1 ;
size_t arg3 = (size_t) 100 ; size_t arg3 = (size_t) 100 ;
int arg4 = (int) wxTL_ALIGN_LEFT ; bool arg4 = (bool) True ;
int arg5 = (int) wxTL_ALIGN_LEFT ;
wxTreeListColumnInfo *result; wxTreeListColumnInfo *result;
bool temp1 = False ; bool temp1 = False ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ; PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ; PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
char *kwnames[] = { char *kwnames[] = {
(char *) "text",(char *) "image",(char *) "width",(char *) "alignment", NULL (char *) "text",(char *) "image",(char *) "width",(char *) "shown",(char *) "alignment", NULL
}; };
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:new_TreeListColumnInfo",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOOO:new_TreeListColumnInfo",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) goto fail;
if (obj0) { if (obj0) {
{ {
arg1 = wxString_in_helper(obj0); arg1 = wxString_in_helper(obj0);
@@ -2317,12 +2319,16 @@ static PyObject *_wrap_new_TreeListColumnInfo(PyObject *self, PyObject *args, Py
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
} }
if (obj3) { if (obj3) {
arg4 = (wxTreeListColumnAlign) SWIG_AsInt(obj3); arg4 = (bool) SWIG_AsBool(obj3);
if (PyErr_Occurred()) SWIG_fail;
}
if (obj4) {
arg5 = (wxTreeListColumnAlign) SWIG_AsInt(obj4);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (wxTreeListColumnInfo *)new wxTreeListColumnInfo((wxString const &)*arg1,arg2,arg3,(wxTreeListColumnAlign )arg4); result = (wxTreeListColumnInfo *)new wxTreeListColumnInfo((wxString const &)*arg1,arg2,arg3,arg4,(wxTreeListColumnAlign )arg5);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
@@ -2342,6 +2348,34 @@ static PyObject *_wrap_new_TreeListColumnInfo(PyObject *self, PyObject *args, Py
} }
static PyObject *_wrap_TreeListColumnInfo_GetShown(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ;
bool result;
PyObject * obj0 = 0 ;
char *kwnames[] = {
(char *) "self", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:TreeListColumnInfo_GetShown",kwnames,&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxTreeListColumnInfo,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (bool)((wxTreeListColumnInfo const *)arg1)->GetShown();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
{
resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj);
}
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListColumnInfo_GetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListColumnInfo_GetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ; wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ;
@@ -2478,6 +2512,35 @@ static PyObject *_wrap_TreeListColumnInfo_GetWidth(PyObject *self, PyObject *arg
} }
static PyObject *_wrap_TreeListColumnInfo_SetShown(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ;
bool arg2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "shown", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:TreeListColumnInfo_SetShown",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxTreeListColumnInfo,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
arg2 = (bool) SWIG_AsBool(obj1);
if (PyErr_Occurred()) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->SetShown(arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListColumnInfo_SetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListColumnInfo_SetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ; wxTreeListColumnInfo *arg1 = (wxTreeListColumnInfo *) 0 ;
@@ -2960,61 +3023,6 @@ static PyObject *_wrap_TreeListCtrl_SetIndent(PyObject *self, PyObject *args, Py
} }
static PyObject *_wrap_TreeListCtrl_GetSpacing(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
unsigned int result;
PyObject * obj0 = 0 ;
char *kwnames[] = {
(char *) "self", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:TreeListCtrl_GetSpacing",kwnames,&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (unsigned int)((wxPyTreeListCtrl const *)arg1)->GetSpacing();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
resultobj = SWIG_FromUnsignedInt((unsigned int)result);
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_SetSpacing(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
unsigned int arg2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "spacing", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:TreeListCtrl_SetSpacing",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
arg2 = (unsigned int) SWIG_AsUnsignedInt(obj1);
if (PyErr_Occurred()) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->SetSpacing(arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_GetLineSpacing(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListCtrl_GetLineSpacing(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ; wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
@@ -3937,6 +3945,71 @@ static PyObject *_wrap_TreeListCtrl_GetColumnImage(PyObject *self, PyObject *arg
} }
static PyObject *_wrap_TreeListCtrl_ShowColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
size_t arg2 ;
bool arg3 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "column",(char *) "shown", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_ShowColumn",kwnames,&obj0,&obj1,&obj2)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
arg2 = (size_t) SWIG_AsUnsignedLong(obj1);
if (PyErr_Occurred()) SWIG_fail;
arg3 = (bool) SWIG_AsBool(obj2);
if (PyErr_Occurred()) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->ShowColumn(arg2,arg3);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_IsColumnShown(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
size_t arg2 ;
bool result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "column", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:TreeListCtrl_IsColumnShown",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
arg2 = (size_t) SWIG_AsUnsignedLong(obj1);
if (PyErr_Occurred()) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (bool)((wxPyTreeListCtrl const *)arg1)->IsColumnShown(arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
{
resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj);
}
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_GetItemText(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListCtrl_GetItemText(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ; wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
@@ -4372,7 +4445,7 @@ static PyObject *_wrap_TreeListCtrl_SetItemTextColour(PyObject *self, PyObject *
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ; PyObject * obj2 = 0 ;
char *kwnames[] = { char *kwnames[] = {
(char *) "self",(char *) "item",(char *) "col", NULL (char *) "self",(char *) "item",(char *) "colour", NULL
}; };
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_SetItemTextColour",kwnames,&obj0,&obj1,&obj2)) goto fail; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_SetItemTextColour",kwnames,&obj0,&obj1,&obj2)) goto fail;
@@ -4413,7 +4486,7 @@ static PyObject *_wrap_TreeListCtrl_SetItemBackgroundColour(PyObject *self, PyOb
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ; PyObject * obj2 = 0 ;
char *kwnames[] = { char *kwnames[] = {
(char *) "self",(char *) "item",(char *) "col", NULL (char *) "self",(char *) "item",(char *) "colour", NULL
}; };
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_SetItemBackgroundColour",kwnames,&obj0,&obj1,&obj2)) goto fail; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_SetItemBackgroundColour",kwnames,&obj0,&obj1,&obj2)) goto fail;
@@ -4976,7 +5049,7 @@ static PyObject *_wrap_TreeListCtrl_GetItemParent(PyObject *self, PyObject *args
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
result = ((wxPyTreeListCtrl const *)arg1)->GetParent((wxTreeItemId const &)*arg2); result = ((wxPyTreeListCtrl const *)arg1)->GetItemParent((wxTreeItemId const &)*arg2);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
@@ -5031,7 +5104,7 @@ static PyObject *_wrap_TreeListCtrl_GetNextChild(PyObject *self, PyObject *args,
PyObject *resultobj; PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ; wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
wxTreeItemId *arg2 = 0 ; wxTreeItemId *arg2 = 0 ;
long arg3 ; void *arg3 = (void *) 0 ;
PyObject *result; PyObject *result;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
@@ -5050,8 +5123,7 @@ static PyObject *_wrap_TreeListCtrl_GetNextChild(PyObject *self, PyObject *args,
PyErr_SetString(PyExc_TypeError,"null reference"); PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail; SWIG_fail;
} }
arg3 = (long) SWIG_AsLong(obj2); if ((SWIG_ConvertPtr(obj2,&arg3,0,SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if (PyErr_Occurred()) SWIG_fail;
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (PyObject *)wxPyTreeListCtrl_GetNextChild(arg1,(wxTreeItemId const &)*arg2,arg3); result = (PyObject *)wxPyTreeListCtrl_GetNextChild(arg1,(wxTreeItemId const &)*arg2,arg3);
@@ -6058,6 +6130,37 @@ static PyObject *_wrap_TreeListCtrl_SelectItem(PyObject *self, PyObject *args, P
} }
static PyObject *_wrap_TreeListCtrl_SelectAll(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
bool arg2 = (bool) False ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "extended_select", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:TreeListCtrl_SelectAll",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if (obj1) {
arg2 = (bool) SWIG_AsBool(obj1);
if (PyErr_Occurred()) SWIG_fail;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->SelectAll(arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ; wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
@@ -6320,54 +6423,23 @@ static PyObject *_wrap_TreeListCtrl_SortChildren(PyObject *self, PyObject *args,
} }
static PyObject *_wrap_TreeListCtrl_GetItemSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_TreeListCtrl_FindItem(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj; PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ; wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
wxTreeItemId *arg2 = 0 ; wxTreeItemId *arg2 = 0 ;
int result; wxString *arg3 = 0 ;
PyObject * obj0 = 0 ; int arg4 = (int) 0 ;
PyObject * obj1 = 0 ; wxTreeItemId result;
char *kwnames[] = { bool temp3 = False ;
(char *) "self",(char *) "item", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:TreeListCtrl_GetItemSelectedImage",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxTreeItemId,
SWIG_POINTER_EXCEPTION | 0)) == -1)
SWIG_fail;
if (arg2 == NULL) {
PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (int)((wxPyTreeListCtrl const *)arg1)->GetItemSelectedImage((wxTreeItemId const &)*arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
resultobj = SWIG_FromInt((int)result);
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_TreeListCtrl_SetItemSelectedImage(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
wxTreeItemId *arg2 = 0 ;
int arg3 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ; PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
char *kwnames[] = { char *kwnames[] = {
(char *) "self",(char *) "item",(char *) "image", NULL (char *) "self",(char *) "item",(char *) "str",(char *) "flags", NULL
}; };
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:TreeListCtrl_SetItemSelectedImage",kwnames,&obj0,&obj1,&obj2)) goto fail; if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:TreeListCtrl_FindItem",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl, if ((SWIG_ConvertPtr(obj0,(void **)(&arg1),SWIGTYPE_p_wxPyTreeListCtrl,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxTreeItemId, if ((SWIG_ConvertPtr(obj1,(void **)(&arg2),SWIGTYPE_p_wxTreeItemId,
@@ -6377,18 +6449,37 @@ static PyObject *_wrap_TreeListCtrl_SetItemSelectedImage(PyObject *self, PyObjec
PyErr_SetString(PyExc_TypeError,"null reference"); PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail; SWIG_fail;
} }
arg3 = (int) SWIG_AsInt(obj2); {
if (PyErr_Occurred()) SWIG_fail; arg3 = wxString_in_helper(obj2);
if (arg3 == NULL) SWIG_fail;
temp3 = True;
}
if (obj3) {
arg4 = (int) SWIG_AsInt(obj3);
if (PyErr_Occurred()) SWIG_fail;
}
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->SetItemSelectedImage((wxTreeItemId const &)*arg2,arg3); result = (arg1)->FindItem((wxTreeItemId const &)*arg2,(wxString const &)*arg3,arg4);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
} }
Py_INCREF(Py_None); resultobj = Py_None; {
wxTreeItemId * resultptr;
resultptr = new wxTreeItemId((wxTreeItemId &) result);
resultobj = SWIG_NewPointerObj((void *)(resultptr), SWIGTYPE_p_wxTreeItemId, 1);
}
{
if (temp3)
delete arg3;
}
return resultobj; return resultobj;
fail: fail:
{
if (temp3)
delete arg3;
}
return NULL; return NULL;
} }
@@ -6505,11 +6596,13 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"LEDNumberCtrl_SetValue", (PyCFunction) _wrap_LEDNumberCtrl_SetValue, METH_VARARGS | METH_KEYWORDS }, { (char *)"LEDNumberCtrl_SetValue", (PyCFunction) _wrap_LEDNumberCtrl_SetValue, METH_VARARGS | METH_KEYWORDS },
{ (char *)"LEDNumberCtrl_swigregister", LEDNumberCtrl_swigregister, METH_VARARGS }, { (char *)"LEDNumberCtrl_swigregister", LEDNumberCtrl_swigregister, METH_VARARGS },
{ (char *)"new_TreeListColumnInfo", (PyCFunction) _wrap_new_TreeListColumnInfo, METH_VARARGS | METH_KEYWORDS }, { (char *)"new_TreeListColumnInfo", (PyCFunction) _wrap_new_TreeListColumnInfo, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetShown", (PyCFunction) _wrap_TreeListColumnInfo_GetShown, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetAlignment", (PyCFunction) _wrap_TreeListColumnInfo_GetAlignment, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_GetAlignment", (PyCFunction) _wrap_TreeListColumnInfo_GetAlignment, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetText", (PyCFunction) _wrap_TreeListColumnInfo_GetText, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_GetText", (PyCFunction) _wrap_TreeListColumnInfo_GetText, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetImage", (PyCFunction) _wrap_TreeListColumnInfo_GetImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_GetImage", (PyCFunction) _wrap_TreeListColumnInfo_GetImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetSelectedImage", (PyCFunction) _wrap_TreeListColumnInfo_GetSelectedImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_GetSelectedImage", (PyCFunction) _wrap_TreeListColumnInfo_GetSelectedImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_GetWidth", (PyCFunction) _wrap_TreeListColumnInfo_GetWidth, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_GetWidth", (PyCFunction) _wrap_TreeListColumnInfo_GetWidth, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_SetShown", (PyCFunction) _wrap_TreeListColumnInfo_SetShown, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_SetAlignment", (PyCFunction) _wrap_TreeListColumnInfo_SetAlignment, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_SetAlignment", (PyCFunction) _wrap_TreeListColumnInfo_SetAlignment, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_SetText", (PyCFunction) _wrap_TreeListColumnInfo_SetText, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_SetText", (PyCFunction) _wrap_TreeListColumnInfo_SetText, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListColumnInfo_SetImage", (PyCFunction) _wrap_TreeListColumnInfo_SetImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListColumnInfo_SetImage", (PyCFunction) _wrap_TreeListColumnInfo_SetImage, METH_VARARGS | METH_KEYWORDS },
@@ -6523,8 +6616,6 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"TreeListCtrl_GetCount", (PyCFunction) _wrap_TreeListCtrl_GetCount, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetCount", (PyCFunction) _wrap_TreeListCtrl_GetCount, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetIndent", (PyCFunction) _wrap_TreeListCtrl_GetIndent, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetIndent", (PyCFunction) _wrap_TreeListCtrl_GetIndent, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetIndent", (PyCFunction) _wrap_TreeListCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SetIndent", (PyCFunction) _wrap_TreeListCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetSpacing", (PyCFunction) _wrap_TreeListCtrl_GetSpacing, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetSpacing", (PyCFunction) _wrap_TreeListCtrl_SetSpacing, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetLineSpacing", (PyCFunction) _wrap_TreeListCtrl_GetLineSpacing, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetLineSpacing", (PyCFunction) _wrap_TreeListCtrl_GetLineSpacing, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetLineSpacing", (PyCFunction) _wrap_TreeListCtrl_SetLineSpacing, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SetLineSpacing", (PyCFunction) _wrap_TreeListCtrl_SetLineSpacing, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetImageList", (PyCFunction) _wrap_TreeListCtrl_GetImageList, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetImageList", (PyCFunction) _wrap_TreeListCtrl_GetImageList, METH_VARARGS | METH_KEYWORDS },
@@ -6554,6 +6645,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"TreeListCtrl_GetColumnAlignment", (PyCFunction) _wrap_TreeListCtrl_GetColumnAlignment, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetColumnAlignment", (PyCFunction) _wrap_TreeListCtrl_GetColumnAlignment, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetColumnImage", (PyCFunction) _wrap_TreeListCtrl_SetColumnImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SetColumnImage", (PyCFunction) _wrap_TreeListCtrl_SetColumnImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetColumnImage", (PyCFunction) _wrap_TreeListCtrl_GetColumnImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetColumnImage", (PyCFunction) _wrap_TreeListCtrl_GetColumnImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_ShowColumn", (PyCFunction) _wrap_TreeListCtrl_ShowColumn, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_IsColumnShown", (PyCFunction) _wrap_TreeListCtrl_IsColumnShown, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetItemText", (PyCFunction) _wrap_TreeListCtrl_GetItemText, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetItemText", (PyCFunction) _wrap_TreeListCtrl_GetItemText, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetItemImage", (PyCFunction) _wrap_TreeListCtrl_GetItemImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetItemImage", (PyCFunction) _wrap_TreeListCtrl_GetItemImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetItemText", (PyCFunction) _wrap_TreeListCtrl_SetItemText, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SetItemText", (PyCFunction) _wrap_TreeListCtrl_SetItemText, METH_VARARGS | METH_KEYWORDS },
@@ -6606,6 +6699,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"TreeListCtrl_Unselect", (PyCFunction) _wrap_TreeListCtrl_Unselect, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_Unselect", (PyCFunction) _wrap_TreeListCtrl_Unselect, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_UnselectAll", (PyCFunction) _wrap_TreeListCtrl_UnselectAll, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_UnselectAll", (PyCFunction) _wrap_TreeListCtrl_UnselectAll, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SelectItem", (PyCFunction) _wrap_TreeListCtrl_SelectItem, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SelectItem", (PyCFunction) _wrap_TreeListCtrl_SelectItem, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SelectAll", (PyCFunction) _wrap_TreeListCtrl_SelectAll, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_EnsureVisible", (PyCFunction) _wrap_TreeListCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_EnsureVisible", (PyCFunction) _wrap_TreeListCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_ScrollTo", (PyCFunction) _wrap_TreeListCtrl_ScrollTo, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_ScrollTo", (PyCFunction) _wrap_TreeListCtrl_ScrollTo, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_HitTest", (PyCFunction) _wrap_TreeListCtrl_HitTest, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_HitTest", (PyCFunction) _wrap_TreeListCtrl_HitTest, METH_VARARGS | METH_KEYWORDS },
@@ -6613,8 +6707,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"TreeListCtrl_EditLabel", (PyCFunction) _wrap_TreeListCtrl_EditLabel, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_EditLabel", (PyCFunction) _wrap_TreeListCtrl_EditLabel, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_Edit", (PyCFunction) _wrap_TreeListCtrl_Edit, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_Edit", (PyCFunction) _wrap_TreeListCtrl_Edit, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SortChildren", (PyCFunction) _wrap_TreeListCtrl_SortChildren, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_SortChildren", (PyCFunction) _wrap_TreeListCtrl_SortChildren, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetItemSelectedImage", (PyCFunction) _wrap_TreeListCtrl_GetItemSelectedImage, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_FindItem", (PyCFunction) _wrap_TreeListCtrl_FindItem, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_SetItemSelectedImage", (PyCFunction) _wrap_TreeListCtrl_SetItemSelectedImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetHeaderWindow", (PyCFunction) _wrap_TreeListCtrl_GetHeaderWindow, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetHeaderWindow", (PyCFunction) _wrap_TreeListCtrl_GetHeaderWindow, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_GetMainWindow", (PyCFunction) _wrap_TreeListCtrl_GetMainWindow, METH_VARARGS | METH_KEYWORDS }, { (char *)"TreeListCtrl_GetMainWindow", (PyCFunction) _wrap_TreeListCtrl_GetMainWindow, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_swigregister", TreeListCtrl_swigregister, METH_VARARGS }, { (char *)"TreeListCtrl_swigregister", TreeListCtrl_swigregister, METH_VARARGS },
@@ -8205,6 +8298,11 @@ SWIGEXPORT(void) SWIG_init(void) {
PyDict_SetItemString(d,"TL_ALIGN_RIGHT", SWIG_FromInt((int)wxTL_ALIGN_RIGHT)); PyDict_SetItemString(d,"TL_ALIGN_RIGHT", SWIG_FromInt((int)wxTL_ALIGN_RIGHT));
PyDict_SetItemString(d,"TL_ALIGN_CENTER", SWIG_FromInt((int)wxTL_ALIGN_CENTER)); PyDict_SetItemString(d,"TL_ALIGN_CENTER", SWIG_FromInt((int)wxTL_ALIGN_CENTER));
PyDict_SetItemString(d,"TREE_HITTEST_ONITEMCOLUMN", SWIG_FromInt((int)wxTREE_HITTEST_ONITEMCOLUMN)); PyDict_SetItemString(d,"TREE_HITTEST_ONITEMCOLUMN", SWIG_FromInt((int)wxTREE_HITTEST_ONITEMCOLUMN));
PyDict_SetItemString(d,"TL_SEARCH_VISIBLE", SWIG_FromInt((int)wxTL_SEARCH_VISIBLE));
PyDict_SetItemString(d,"TL_SEARCH_LEVEL", SWIG_FromInt((int)wxTL_SEARCH_LEVEL));
PyDict_SetItemString(d,"TL_SEARCH_FULL", SWIG_FromInt((int)wxTL_SEARCH_FULL));
PyDict_SetItemString(d,"TL_SEARCH_PARTIAL", SWIG_FromInt((int)wxTL_SEARCH_PARTIAL));
PyDict_SetItemString(d,"TL_SEARCH_NOCASE", SWIG_FromInt((int)wxTL_SEARCH_NOCASE));
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow"); wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");

View File

@@ -1,11 +1,12 @@
// -*- C++ -*- ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: treelistctrl.h (derived by wx/treectrlg.h) // Name: treelistctrl.h
// Purpose: wxTreeListCtrl class // Purpose: wxTreeListCtrl class
// Author: Robert Roebling // Author: Robert Roebling
// Modified by: Alberto Griggio, 2002 // Modified by: Alberto Griggio, 2002
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1997,1998 Robert Roebling // Copyright: (c) Robert Roebling, Julian Smart, Alberto Griggio,
// Vadim Zeitlin, Otto Wyss
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -33,6 +34,16 @@ class GIZMODLLEXPORT wxTreeListItem;
class GIZMODLLEXPORT wxTreeListHeaderWindow; class GIZMODLLEXPORT wxTreeListHeaderWindow;
class GIZMODLLEXPORT wxTreeListMainWindow; class GIZMODLLEXPORT wxTreeListMainWindow;
// Using this typedef removes an ambiguity when calling Remove()
#ifdef __WXMSW__
#if !wxCHECK_VERSION(2, 5, 0)
typedef long wxTreeItemIdValue;
#else
typedef void *wxTreeItemIdValue;
#endif
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTreeListColumnAttrs // wxTreeListColumnAttrs
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -48,15 +59,17 @@ class GIZMODLLEXPORT wxTreeListColumnInfo: public wxObject {
public: public:
enum { DEFAULT_COL_WIDTH = 100 }; enum { DEFAULT_COL_WIDTH = 100 };
wxTreeListColumnInfo(const wxChar* text = wxT(""), wxTreeListColumnInfo(const wxString &text = wxT(""),
int image = -1, int image = -1,
size_t width = DEFAULT_COL_WIDTH, size_t width = DEFAULT_COL_WIDTH,
bool shown = true,
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT) wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT)
{ {
m_image = image; m_image = image;
m_selected_image = -1; m_selected_image = -1;
m_text = text; m_text = text;
m_width = width; m_width = width;
m_shown = shown;
m_alignment = alignment; m_alignment = alignment;
} }
@@ -66,12 +79,14 @@ public:
m_selected_image = other.m_selected_image; m_selected_image = other.m_selected_image;
m_text = other.m_text; m_text = other.m_text;
m_width = other.m_width; m_width = other.m_width;
m_shown = other.m_shown;
m_alignment = other.m_alignment; m_alignment = other.m_alignment;
} }
~wxTreeListColumnInfo() {} ~wxTreeListColumnInfo() {}
// getters // getters
bool GetShown() const { return m_shown; }
wxTreeListColumnAlign GetAlignment() const { return m_alignment; } wxTreeListColumnAlign GetAlignment() const { return m_alignment; }
wxString GetText() const { return m_text; } wxString GetText() const { return m_text; }
int GetImage() const { return m_image; } int GetImage() const { return m_image; }
@@ -79,6 +94,9 @@ public:
size_t GetWidth() const { return m_width; } size_t GetWidth() const { return m_width; }
// setters // setters
wxTreeListColumnInfo& SetShown(bool shown)
{ m_shown = shown; return *this; }
wxTreeListColumnInfo& SetAlignment(wxTreeListColumnAlign alignment) wxTreeListColumnInfo& SetAlignment(wxTreeListColumnAlign alignment)
{ m_alignment = alignment; return *this; } { m_alignment = alignment; return *this; }
@@ -95,6 +113,7 @@ public:
{ m_width = with; return *this; } { m_width = with; return *this; }
private: private:
bool m_shown;
wxTreeListColumnAlign m_alignment; wxTreeListColumnAlign m_alignment;
wxString m_text; wxString m_text;
int m_image; int m_image;
@@ -106,6 +125,13 @@ private:
// wxTreeListCtrl - the multicolumn tree control // wxTreeListCtrl - the multicolumn tree control
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// flags for FindItem
const int wxTL_SEARCH_VISIBLE = 0x0000;
const int wxTL_SEARCH_LEVEL = 0x0001;
const int wxTL_SEARCH_FULL = 0x0002;
const int wxTL_SEARCH_PARTIAL = 0x0010;
const int wxTL_SEARCH_NOCASE = 0x0020;
// additional flag for HitTest // additional flag for HitTest
const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000; const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000;
extern GIZMODLLEXPORT const wxChar* wxTreeListCtrlNameStr; extern GIZMODLLEXPORT const wxChar* wxTreeListCtrlNameStr;
@@ -143,35 +169,31 @@ public:
// accessors // accessors
// --------- // ---------
// get the total number of items in the control // get the total number of items in the control
size_t GetCount() const; size_t GetCount() const;
// indent is the number of pixels the children are indented relative to // indent is the number of pixels the children are indented relative to
// the parents position. SetIndent() also redraws the control // the parents position. SetIndent() also redraws the control
// immediately. // immediately.
unsigned int GetIndent() const; unsigned int GetIndent() const;
void SetIndent(unsigned int indent); 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);
// line spacing is the space above and below the text on each line // line spacing is the space above and below the text on each line
unsigned int GetLineSpacing() const; unsigned int GetLineSpacing() const;
void SetLineSpacing(unsigned int spacing); void SetLineSpacing(unsigned int spacing);
// image list: these functions allow to associate an image list with // image list: these functions allow to associate an image list with
// the control and retrieve it. Note that when assigned with // the control and retrieve it. Note that when assigned with
// SetImageList, the control does _not_ delete // SetImageList, the control does _not_ delete
// the associated image list when it's deleted in order to allow image // the associated image list when it's deleted in order to allow image
// lists to be shared between different controls. If you use // lists to be shared between different controls. If you use
// AssignImageList, the control _does_ delete the image list. // AssignImageList, the control _does_ delete the image list.
// //
// The normal image list is for the icons which correspond to the // The normal image list is for the icons which correspond to the
// normal tree item state (whether it is selected or not). // normal tree item state (whether it is selected or not).
// Additionally, the application might choose to show a state icon // Additionally, the application might choose to show a state icon
// which corresponds to an app-defined item state (for example, // which corresponds to an app-defined item state (for example,
// checked/unchecked) which are taken from the state image list. // checked/unchecked) which are taken from the state image list.
wxImageList *GetImageList() const; wxImageList *GetImageList() const;
wxImageList *GetStateImageList() const; wxImageList *GetStateImageList() const;
wxImageList *GetButtonsImageList() const; wxImageList *GetButtonsImageList() const;
@@ -188,12 +210,20 @@ public:
// adds a column // adds a column
void AddColumn(const wxString& text) void AddColumn(const wxString& text)
{ AddColumn(wxTreeListColumnInfo().SetText(text)); } { AddColumn(wxTreeListColumnInfo(text)); }
void AddColumn(const wxString& text,
size_t width,
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT)
{ AddColumn(wxTreeListColumnInfo(text,
-1,
width,
true,
alignment)); }
void AddColumn(const wxTreeListColumnInfo& col); void AddColumn(const wxTreeListColumnInfo& col);
// inserts a column before the given one // inserts a column before the given one
void InsertColumn(size_t before, const wxString& text) void InsertColumn(size_t before, const wxString& text)
{ InsertColumn(before, wxTreeListColumnInfo().SetText(text)); } { InsertColumn(before, wxTreeListColumnInfo(text)); }
void InsertColumn(size_t before, const wxTreeListColumnInfo& col); void InsertColumn(size_t before, const wxTreeListColumnInfo& col);
// deletes the given column - does not delete the corresponding column // deletes the given column - does not delete the corresponding column
@@ -224,25 +254,28 @@ public:
void SetColumnImage(size_t column, int image); void SetColumnImage(size_t column, int image);
int GetColumnImage(size_t column) const; int GetColumnImage(size_t column) const;
void ShowColumn(size_t column, bool shown);
bool IsColumnShown(size_t column) const;
// Functions to work with tree list ctrl items. // Functions to work with tree list ctrl items.
// accessors // accessors
// --------- // ---------
// retrieve item's label (of the main column) // retrieve item's label (of the main column)
wxString GetItemText(const wxTreeItemId& item) const wxString GetItemText(const wxTreeItemId& item) const
{ return GetItemText(item, GetMainColumn()); } { return GetItemText(item, GetMainColumn()); }
// retrieves item's label of the given column // retrieves item's label of the given column
wxString GetItemText(const wxTreeItemId& item, size_t column) const; wxString GetItemText(const wxTreeItemId& item, size_t column) const;
// get one of the images associated with the item (normal by default) // get one of the images associated with the item (normal by default)
int GetItemImage(const wxTreeItemId& item, int GetItemImage(const wxTreeItemId& item,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const wxTreeItemIcon which = wxTreeItemIcon_Normal) const
{ return GetItemImage(item, GetMainColumn(), which); } { return GetItemImage(item, GetMainColumn(), which); }
int GetItemImage(const wxTreeItemId& item, size_t column, int GetItemImage(const wxTreeItemId& item, size_t column,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const; wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
// get the data associated with the item // get the data associated with the item
wxTreeItemData *GetItemData(const wxTreeItemId& item) const; wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
bool GetItemBold(const wxTreeItemId& item) const; bool GetItemBold(const wxTreeItemId& item) const;
@@ -253,7 +286,7 @@ public:
// modifiers // modifiers
// --------- // ---------
// set item's label // set item's label
void SetItemText(const wxTreeItemId& item, const wxString& text) void SetItemText(const wxTreeItemId& item, const wxString& text)
{ SetItemText(item, GetMainColumn(), text); } { SetItemText(item, GetMainColumn(), text); }
void SetItemText(const wxTreeItemId& item, size_t column, void SetItemText(const wxTreeItemId& item, size_t column,
@@ -267,32 +300,31 @@ public:
void SetItemImage(const wxTreeItemId& item, size_t column, int image, void SetItemImage(const wxTreeItemId& item, size_t column, int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal); wxTreeItemIcon which = wxTreeItemIcon_Normal);
// associate some data with the item // associate some data with the item
void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
// force appearance of [+] button near the item. This is useful to // 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 // allow the user to expand the items which don't have any children now
// - but instead add them only when needed, thus minimizing memory // - but instead add them only when needed, thus minimizing memory
// usage and loading time. // usage and loading time.
void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
// the item will be shown in bold // the item will be shown in bold
void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
// set the item's text colour // set the item's text colour
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour);
// set the item's background colour // set the item's background colour
void SetItemBackgroundColour(const wxTreeItemId& item, void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& colour);
const wxColour& col);
// set the item's font (should be of the same height for all items) // set the item's font (should be of the same height for all items)
void SetItemFont(const wxTreeItemId& item, const wxFont& font); void SetItemFont(const wxTreeItemId& item, const wxFont& font);
// set the window font // set the window font
virtual bool SetFont( const wxFont &font ); virtual bool SetFont( const wxFont &font );
// set the styles. // set the styles.
void SetWindowStyle(const long styles); void SetWindowStyle(const long styles);
long GetWindowStyle() const; long GetWindowStyle() const;
long GetWindowStyleFlag() const { return GetWindowStyle(); } long GetWindowStyleFlag() const { return GetWindowStyle(); }
@@ -300,25 +332,25 @@ public:
// item status inquiries // item status inquiries
// --------------------- // ---------------------
// is the item visible (it might be outside the view or not expanded)? // is the item visible (it might be outside the view or not expanded)?
bool IsVisible(const wxTreeItemId& item) const; bool IsVisible(const wxTreeItemId& item) const;
// does the item has any children? // does the item has any children?
bool HasChildren(const wxTreeItemId& item) const bool HasChildren(const wxTreeItemId& item) const
{ return ItemHasChildren(item); } { return ItemHasChildren(item); }
bool ItemHasChildren(const wxTreeItemId& item) const; bool ItemHasChildren(const wxTreeItemId& item) const;
// is the item expanded (only makes sense if HasChildren())? // is the item expanded (only makes sense if HasChildren())?
bool IsExpanded(const wxTreeItemId& item) const; bool IsExpanded(const wxTreeItemId& item) const;
// is this item currently selected (the same as has focus)? // is this item currently selected (the same as has focus)?
bool IsSelected(const wxTreeItemId& item) const; bool IsSelected(const wxTreeItemId& item) const;
// is item text in bold font? // is item text in bold font?
bool IsBold(const wxTreeItemId& item) const; bool IsBold(const wxTreeItemId& item) const;
// does the layout include space for a button? // does the layout include space for a button?
// number of children // number of children
// ------------------ // ------------------
// if 'recursively' is FALSE, only immediate children count, otherwise // if 'recursively' is FALSE, only immediate children count, otherwise
// the returned number is the number of all items in this branch // the returned number is the number of all items in this branch
size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
// navigation // navigation
@@ -326,155 +358,163 @@ public:
// wxTreeItemId.IsOk() will return FALSE if there is no such item // wxTreeItemId.IsOk() will return FALSE if there is no such item
// get the root tree item // get the root tree item
wxTreeItemId GetRootItem() const; wxTreeItemId GetRootItem() const;
// get the item currently selected (may return NULL if no selection) // get the item currently selected (may return NULL if no selection)
wxTreeItemId GetSelection() const; wxTreeItemId GetSelection() const;
// get the items currently selected, return the number of such item // get the items currently selected, return the number of such item
size_t GetSelections(wxArrayTreeItemIds&) const; size_t GetSelections(wxArrayTreeItemIds&) const;
// get the parent of this item (may return NULL if root) // get the parent of this item (may return NULL if root)
wxTreeItemId GetParent(const wxTreeItemId& item) const; wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
// for this enumeration function you must pass in a "cookie" parameter // for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library // which is opaque for the application but is necessary for the library
// to make these functions reentrant (i.e. allow more than one // to make these functions reentrant (i.e. allow more than one
// enumeration on one and the same object simultaneously). Of course, // enumeration on one and the same object simultaneously). Of course,
// the "cookie" passed to GetFirstChild() and GetNextChild() should be // the "cookie" passed to GetFirstChild() and GetNextChild() should be
// the same! // the same!
// get the first child of this item // get the first child of this item
#if !wxCHECK_VERSION(2, 5, 0)
wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const; wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const;
// get the next child #else
wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
#endif
// get the next child
#if !wxCHECK_VERSION(2, 5, 0)
wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const; wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const;
// get the last child of this item - this method doesn't use cookies #else
wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
#endif
// get the prev child
#if !wxCHECK_VERSION(2, 5, 0)
wxTreeItemId GetPrevChild(const wxTreeItemId& item, long& cookie) const;
#else
wxTreeItemId GetPrevChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
#endif
// get the last child of this item - this method doesn't use cookies
wxTreeItemId GetLastChild(const wxTreeItemId& item) const; wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
// get the next sibling of this item // get the next sibling of this item
wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
// get the previous sibling // get the previous sibling
wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
// get first visible item // get first visible item
wxTreeItemId GetFirstVisibleItem() const; wxTreeItemId GetFirstVisibleItem() const;
// get the next visible item: item must be visible itself! // get the next visible item: item must be visible itself!
// see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
// get the previous visible item: item must be visible itself! // get the previous visible item: item must be visible itself!
wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
// Only for internal use right now, but should probably be public // Only for internal use right now, but should probably be public
wxTreeItemId GetNext(const wxTreeItemId& item) const; wxTreeItemId GetNext(const wxTreeItemId& item) const;
// operations // operations
// ---------- // ----------
// add the root node to the tree // add the root node to the tree
wxTreeItemId AddRoot(const wxString& text, wxTreeItemId AddRoot(const wxString& text,
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// insert a new item in as the first child of the parent // insert a new item in as the first child of the parent
wxTreeItemId PrependItem(const wxTreeItemId& parent, wxTreeItemId PrependItem(const wxTreeItemId& parent,
const wxString& text, const wxString& text,
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// insert a new item after a given one // insert a new item after a given one
wxTreeItemId InsertItem(const wxTreeItemId& parent, wxTreeItemId InsertItem(const wxTreeItemId& parent,
const wxTreeItemId& idPrevious, const wxTreeItemId& idPrevious,
const wxString& text, const wxString& text,
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// insert a new item before the one with the given index // insert a new item before the one with the given index
wxTreeItemId InsertItem(const wxTreeItemId& parent, wxTreeItemId InsertItem(const wxTreeItemId& parent,
size_t index, size_t index,
const wxString& text, const wxString& text,
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// insert a new item in as the last child of the parent // insert a new item in as the last child of the parent
wxTreeItemId AppendItem(const wxTreeItemId& parent, wxTreeItemId AppendItem(const wxTreeItemId& parent,
const wxString& text, const wxString& text,
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// delete this item and associated data if any // delete this item and associated data if any
void Delete(const wxTreeItemId& item); void Delete(const wxTreeItemId& item);
// delete all children (but don't delete the item itself) // delete all children (but don't delete the item itself)
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
void DeleteChildren(const wxTreeItemId& item); void DeleteChildren(const wxTreeItemId& item);
// delete all items from the tree // delete all items from the tree
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
void DeleteAllItems(); void DeleteAllItems();
// expand this item // expand this item
void Expand(const wxTreeItemId& item); void Expand(const wxTreeItemId& item);
// expand this item and all subitems recursively // expand this item and all subitems recursively
void ExpandAll(const wxTreeItemId& item); void ExpandAll(const wxTreeItemId& item);
// collapse the item without removing its children // collapse the item without removing its children
void Collapse(const wxTreeItemId& item); void Collapse(const wxTreeItemId& item);
// collapse the item and remove all children // collapse the item and remove all children
void CollapseAndReset(const wxTreeItemId& item); void CollapseAndReset(const wxTreeItemId& item);
// toggles the current state // toggles the current state
void Toggle(const wxTreeItemId& item); void Toggle(const wxTreeItemId& item);
// remove the selection from currently selected item (if any) // remove the selection from currently selected item (if any)
void Unselect(); void Unselect();
void UnselectAll(); void UnselectAll();
// select this item // select this item
void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE,
bool extended_select=FALSE); bool extended_select=FALSE);
// make sure this item is visible (expanding the parent item and/or void SelectAll(bool extended_select=FALSE);
// scrolling to this item if necessary) // make sure this item is visible (expanding the parent item and/or
// scrolling to this item if necessary)
void EnsureVisible(const wxTreeItemId& item); void EnsureVisible(const wxTreeItemId& item);
// scroll to this item (but don't expand its parent) // scroll to this item (but don't expand its parent)
void ScrollTo(const wxTreeItemId& item); void ScrollTo(const wxTreeItemId& item);
//void AdjustMyScrollbars(); //void AdjustMyScrollbars();
// The first function is more portable (because easier to implement // The first function is more portable (because easier to implement
// on other platforms), but the second one returns some extra info. // on other platforms), but the second one returns some extra info.
wxTreeItemId HitTest(const wxPoint& point) wxTreeItemId HitTest(const wxPoint& point)
{ int dummy; return HitTest(point, dummy); } { int dummy; return HitTest(point, dummy); }
wxTreeItemId HitTest(const wxPoint& point, int& flags) wxTreeItemId HitTest(const wxPoint& point, int& flags)
{ int col; return HitTest(point, flags, col); } { int col; return HitTest(point, flags, col); }
wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column); wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column);
// get the bounding rectangle of the item (or of its label only) // get the bounding rectangle of the item (or of its label only)
bool GetBoundingRect(const wxTreeItemId& item, bool GetBoundingRect(const wxTreeItemId& item,
wxRect& rect, wxRect& rect,
bool textOnly = FALSE) const; bool textOnly = FALSE) const;
// Start editing the item label: this (temporarily) replaces the item // 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 // with a one line edit control. The item will be selected if it hadn't
// been before. // been before.
void EditLabel( const wxTreeItemId& item ) { Edit( item ); } void EditLabel( const wxTreeItemId& item ) { Edit( item ); }
void Edit( const wxTreeItemId& item ); void Edit( const wxTreeItemId& item );
// sorting // sorting
// this function is called to compare 2 items and should return -1, 0 // 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 // or +1 if the first item is less than, equal to or greater than the
// second one. The base class version performs alphabetic comparaison // second one. The base class version performs alphabetic comparaison
// of item labels (GetText) // of item labels (GetText)
virtual int OnCompareItems(const wxTreeItemId& item1, virtual int OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2); const wxTreeItemId& item2);
// sort the children of this item using OnCompareItems // sort the children of this item using OnCompareItems
// //
// NB: this function is not reentrant and not MT-safe (FIXME)! // NB: this function is not reentrant and not MT-safe (FIXME)!
void SortChildren(const wxTreeItemId& item); void SortChildren(const wxTreeItemId& item);
// deprecated functions: use Set/GetItemImage directly // searching
// get the selected item image wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
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 // overridden base class virtuals
virtual bool SetBackgroundColour(const wxColour& colour); virtual bool SetBackgroundColour(const wxColour& colour);
@@ -487,20 +527,21 @@ public:
wxTreeListMainWindow* GetMainWindow() const wxTreeListMainWindow* GetMainWindow() const
{ return m_main_win; } { return m_main_win; }
protected: protected:
// header window, responsible for column visualization and manipulation // header window, responsible for column visualization and manipulation
wxTreeListHeaderWindow* m_header_win; wxTreeListHeaderWindow* m_header_win;
// main window, the "true" tree ctrl // main window, the "true" tree ctrl
wxTreeListMainWindow* m_main_win; wxTreeListMainWindow* m_main_win;
// the common part of all ctors // // the common part of all ctors
void Init(); // void Init();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
private: private:
size_t fill_column;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTreeListCtrl) DECLARE_DYNAMIC_CLASS(wxTreeListCtrl)
}; };

View File

@@ -1,7 +1,7 @@
Recent Changes for wxPython Recent Changes for wxPython
===================================================================== =====================================================================
2.5.1.6 2.5.2.0
------- -------
wx.ADJUST_MINSIZE is now the default behaviour for window items in wx.ADJUST_MINSIZE is now the default behaviour for window items in
@@ -64,6 +64,11 @@ running on wxGTK to work around the fact that GTK requires the locale
to be set to the system settings but Python depends on LC_NUMERIC to be set to the system settings but Python depends on LC_NUMERIC
remaining compatible with "C". remaining compatible with "C".
Switched gizmos.TreeListCtrl to the newer version of the code from the
wxCode project.
2.5.1.5 2.5.1.5

View File

@@ -586,9 +586,9 @@ if BUILD_GIZMOS:
USE_SWIG, swig_force, swig_args, swig_deps) USE_SWIG, swig_force, swig_args, swig_deps)
ext = Extension('_gizmos', ext = Extension('_gizmos',
[ '%s/treelistctrl.cpp' % location ] + swig_sources, [ '%s/treelistctrl.cpp' % opj(location, 'wxCode/src') ] + swig_sources,
include_dirs = includes + [ location ] + CONTRIBS_INC, include_dirs = includes + [ location, opj(location, 'wxCode/include') ] + CONTRIBS_INC,
define_macros = defines, define_macros = defines,
library_dirs = libdirs, library_dirs = libdirs,

View File

@@ -58,6 +58,11 @@ wxTL_ALIGN_LEFT = wx.gizmos.TL_ALIGN_LEFT
wxTL_ALIGN_RIGHT = wx.gizmos.TL_ALIGN_RIGHT wxTL_ALIGN_RIGHT = wx.gizmos.TL_ALIGN_RIGHT
wxTL_ALIGN_CENTER = wx.gizmos.TL_ALIGN_CENTER wxTL_ALIGN_CENTER = wx.gizmos.TL_ALIGN_CENTER
wxTREE_HITTEST_ONITEMCOLUMN = wx.gizmos.TREE_HITTEST_ONITEMCOLUMN wxTREE_HITTEST_ONITEMCOLUMN = wx.gizmos.TREE_HITTEST_ONITEMCOLUMN
wxTL_SEARCH_VISIBLE = wx.gizmos.TL_SEARCH_VISIBLE
wxTL_SEARCH_LEVEL = wx.gizmos.TL_SEARCH_LEVEL
wxTL_SEARCH_FULL = wx.gizmos.TL_SEARCH_FULL
wxTL_SEARCH_PARTIAL = wx.gizmos.TL_SEARCH_PARTIAL
wxTL_SEARCH_NOCASE = wx.gizmos.TL_SEARCH_NOCASE
wxTreeListColumnInfo = wx.gizmos.TreeListColumnInfo wxTreeListColumnInfo = wx.gizmos.TreeListColumnInfo
wxTreeListColumnInfoPtr = wx.gizmos.TreeListColumnInfoPtr wxTreeListColumnInfoPtr = wx.gizmos.TreeListColumnInfoPtr
wxTreeListCtrl = wx.gizmos.TreeListCtrl wxTreeListCtrl = wx.gizmos.TreeListCtrl