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_CENTER) wxTL_ALIGN_CENTER;
%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;
#endif

View File

@ -21,7 +21,7 @@
%{
#include "wx/wxPython/wxPython.h"
#include "wx/wxPython/pyclasses.h"
#include <wx/gizmos/dynamicsash.h>
#include <wx/gizmos/editlbox.h>
#include <wx/gizmos/splittree.h>
@ -30,8 +30,8 @@
#include <wx/listctrl.h>
#include <wx/treectrl.h>
#include <wx/imaglist.h>
#include "treelistctrl.h"
#include "wx/treelistctrl.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 {
@ -428,14 +437,18 @@ public:
wxTreeListColumnInfo(const wxString& text = wxPyEmptyString,
int image = -1,
size_t width = 100,
bool shown = True,
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT);
bool GetShown() const;
wxTreeListColumnAlign GetAlignment() const;
wxString GetText() const;
int GetImage() const;
int GetSelectedImage() 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 SetText(const wxString& text);
void SetImage(int image);
@ -511,7 +524,7 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
// get the total number of items in the control
size_t GetCount() const;
@ -521,10 +534,6 @@ public:
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);
// line spacing is the space above and below the text on each line
unsigned int GetLineSpacing() const;
void SetLineSpacing(unsigned int spacing);
@ -558,6 +567,9 @@ public:
// adds a column
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);
// inserts a column before the given one
@ -591,6 +603,8 @@ public:
void SetColumnImage(size_t column, int image);
int GetColumnImage(size_t column) const;
void ShowColumn(size_t column, bool shown);
bool IsColumnShown(size_t column) const;
%extend {
// 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);
// 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
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)
void SetItemFont(const wxTreeItemId& item, const wxFont& font);
@ -738,7 +752,7 @@ public:
// 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
// which is opaque for the application but is necessary for the library
@ -748,17 +762,19 @@ public:
// 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 {
// Get the first child of this item. Returns a wxTreeItemId and an
// opaque "cookie" value that should be passed to GetNextChild in
// order to continue the search.
PyObject* GetFirstChild(const wxTreeItemId& item) {
long cookie = 0;
void* cookie = 0;
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked);
return tup;
}
@ -768,15 +784,19 @@ public:
// value returned from GetFirstChild or the previous GetNextChild.
// Returns a wxTreeItemId and an opaque "cookie" value that should be
// 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));
bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked);
return tup;
}
}
// TODO: GetPrevChild
}
// 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,
bool extended_select=False);
void SelectAll(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);
@ -905,12 +927,8 @@ public:
// 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);
// searching
wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
wxWindow* GetHeaderWindow() 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_CENTER = _gizmos.TL_ALIGN_CENTER
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):
def __repr__(self):
return "<%s.%s; proxy of C++ wxTreeListColumnInfo instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
"""
__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)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def GetShown(*args, **kwargs):
"""GetShown(self) -> bool"""
return _gizmos.TreeListColumnInfo_GetShown(*args, **kwargs)
def GetAlignment(*args, **kwargs):
"""GetAlignment(self) -> int"""
return _gizmos.TreeListColumnInfo_GetAlignment(*args, **kwargs)
@ -385,6 +394,10 @@ class TreeListColumnInfo(_core.Object):
"""GetWidth(self) -> size_t"""
return _gizmos.TreeListColumnInfo_GetWidth(*args, **kwargs)
def SetShown(*args, **kwargs):
"""SetShown(self, bool shown)"""
return _gizmos.TreeListColumnInfo_SetShown(*args, **kwargs)
def SetAlignment(*args, **kwargs):
"""SetAlignment(self, int alignment)"""
return _gizmos.TreeListColumnInfo_SetAlignment(*args, **kwargs)
@ -456,14 +469,6 @@ class TreeListCtrl(_core.Control):
"""SetIndent(self, unsigned int indent)"""
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):
"""GetLineSpacing(self) -> unsigned int"""
return _gizmos.TreeListCtrl_GetLineSpacing(*args, **kwargs)
@ -580,6 +585,14 @@ class TreeListCtrl(_core.Control):
"""GetColumnImage(self, size_t column) -> int"""
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):
"""GetItemText(self, TreeItemId item, int column=-1) -> String"""
return _gizmos.TreeListCtrl_GetItemText(*args, **kwargs)
@ -623,11 +636,11 @@ class TreeListCtrl(_core.Control):
return _gizmos.TreeListCtrl_SetItemBold(*args, **kwargs)
def SetItemTextColour(*args, **kwargs):
"""SetItemTextColour(self, TreeItemId item, Colour col)"""
"""SetItemTextColour(self, TreeItemId item, Colour colour)"""
return _gizmos.TreeListCtrl_SetItemTextColour(*args, **kwargs)
def SetItemBackgroundColour(*args, **kwargs):
"""SetItemBackgroundColour(self, TreeItemId item, Colour col)"""
"""SetItemBackgroundColour(self, TreeItemId item, Colour colour)"""
return _gizmos.TreeListCtrl_SetItemBackgroundColour(*args, **kwargs)
def SetItemFont(*args, **kwargs):
@ -695,7 +708,7 @@ class TreeListCtrl(_core.Control):
return _gizmos.TreeListCtrl_GetFirstChild(*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)
def GetLastChild(*args, **kwargs):
@ -802,6 +815,10 @@ class TreeListCtrl(_core.Control):
"""SelectItem(self, TreeItemId item, bool unselect_others=True, bool extended_select=False)"""
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):
"""EnsureVisible(self, TreeItemId item)"""
return _gizmos.TreeListCtrl_EnsureVisible(*args, **kwargs)
@ -830,13 +847,9 @@ class TreeListCtrl(_core.Control):
"""SortChildren(self, TreeItemId item)"""
return _gizmos.TreeListCtrl_SortChildren(*args, **kwargs)
def GetItemSelectedImage(*args, **kwargs):
"""GetItemSelectedImage(self, TreeItemId item) -> int"""
return _gizmos.TreeListCtrl_GetItemSelectedImage(*args, **kwargs)
def SetItemSelectedImage(*args, **kwargs):
"""SetItemSelectedImage(self, TreeItemId item, int image)"""
return _gizmos.TreeListCtrl_SetItemSelectedImage(*args, **kwargs)
def FindItem(*args, **kwargs):
"""FindItem(self, TreeItemId item, String str, int flags=0) -> TreeItemId"""
return _gizmos.TreeListCtrl_FindItem(*args, **kwargs)
def GetHeaderWindow(*args, **kwargs):
"""GetHeaderWindow(self) -> Window"""

View File

@ -294,7 +294,7 @@ static swig_type_info *swig_types[32];
#include "wx/wxPython/wxPython.h"
#include "wx/wxPython/pyclasses.h"
#include <wx/gizmos/dynamicsash.h>
#include <wx/gizmos/editlbox.h>
#include <wx/gizmos/splittree.h>
@ -303,8 +303,8 @@ static swig_type_info *swig_types[32];
#include <wx/listctrl.h>
#include <wx/treectrl.h>
#include <wx/imaglist.h>
#include "treelistctrl.h"
#include "wx/treelistctrl.h"
#include "wx/wxPython/pytree.h"
@ -637,21 +637,21 @@ PyObject *wxPyTreeListCtrl_GetSelections(wxPyTreeListCtrl *self){
return rval;
}
PyObject *wxPyTreeListCtrl_GetFirstChild(wxPyTreeListCtrl *self,wxTreeItemId const &item){
long cookie = 0;
void* cookie = 0;
wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked);
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));
bool blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), True));
PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
wxPyEndBlockThreads(blocked);
return tup;
}
@ -2289,18 +2289,20 @@ static PyObject *_wrap_new_TreeListColumnInfo(PyObject *self, PyObject *args, Py
wxString *arg1 = (wxString *) &arg1_defvalue ;
int arg2 = (int) -1 ;
size_t arg3 = (size_t) 100 ;
int arg4 = (int) wxTL_ALIGN_LEFT ;
bool arg4 = (bool) True ;
int arg5 = (int) wxTL_ALIGN_LEFT ;
wxTreeListColumnInfo *result;
bool temp1 = False ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
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) {
{
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 (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;
}
{
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);
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) {
PyObject *resultobj;
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) {
PyObject *resultobj;
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) {
PyObject *resultobj;
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) {
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
@ -4372,7 +4445,7 @@ static PyObject *_wrap_TreeListCtrl_SetItemTextColour(PyObject *self, PyObject *
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
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;
@ -4413,7 +4486,7 @@ static PyObject *_wrap_TreeListCtrl_SetItemBackgroundColour(PyObject *self, PyOb
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
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;
@ -4976,7 +5049,7 @@ static PyObject *_wrap_TreeListCtrl_GetItemParent(PyObject *self, PyObject *args
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = ((wxPyTreeListCtrl const *)arg1)->GetParent((wxTreeItemId const &)*arg2);
result = ((wxPyTreeListCtrl const *)arg1)->GetItemParent((wxTreeItemId const &)*arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
@ -5031,7 +5104,7 @@ static PyObject *_wrap_TreeListCtrl_GetNextChild(PyObject *self, PyObject *args,
PyObject *resultobj;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
wxTreeItemId *arg2 = 0 ;
long arg3 ;
void *arg3 = (void *) 0 ;
PyObject *result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
@ -5050,8 +5123,7 @@ static PyObject *_wrap_TreeListCtrl_GetNextChild(PyObject *self, PyObject *args,
PyErr_SetString(PyExc_TypeError,"null reference");
SWIG_fail;
}
arg3 = (long) SWIG_AsLong(obj2);
if (PyErr_Occurred()) SWIG_fail;
if ((SWIG_ConvertPtr(obj2,&arg3,0,SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
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) {
PyObject *resultobj;
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;
wxPyTreeListCtrl *arg1 = (wxPyTreeListCtrl *) 0 ;
wxTreeItemId *arg2 = 0 ;
int result;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(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 ;
wxString *arg3 = 0 ;
int arg4 = (int) 0 ;
wxTreeItemId result;
bool temp3 = False ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
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,
SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail;
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");
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();
(arg1)->SetItemSelectedImage((wxTreeItemId const &)*arg2,arg3);
result = (arg1)->FindItem((wxTreeItemId const &)*arg2,(wxString const &)*arg3,arg4);
wxPyEndAllowThreads(__tstate);
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;
fail:
{
if (temp3)
delete arg3;
}
return NULL;
}
@ -6505,11 +6596,13 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"LEDNumberCtrl_SetValue", (PyCFunction) _wrap_LEDNumberCtrl_SetValue, METH_VARARGS | METH_KEYWORDS },
{ (char *)"LEDNumberCtrl_swigregister", LEDNumberCtrl_swigregister, METH_VARARGS },
{ (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_GetText", (PyCFunction) _wrap_TreeListColumnInfo_GetText, 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_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_SetText", (PyCFunction) _wrap_TreeListColumnInfo_SetText, 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_GetIndent", (PyCFunction) _wrap_TreeListCtrl_GetIndent, 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_SetLineSpacing", (PyCFunction) _wrap_TreeListCtrl_SetLineSpacing, 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_SetColumnImage", (PyCFunction) _wrap_TreeListCtrl_SetColumnImage, 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_GetItemImage", (PyCFunction) _wrap_TreeListCtrl_GetItemImage, 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_UnselectAll", (PyCFunction) _wrap_TreeListCtrl_UnselectAll, 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_ScrollTo", (PyCFunction) _wrap_TreeListCtrl_ScrollTo, 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_Edit", (PyCFunction) _wrap_TreeListCtrl_Edit, 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_SetItemSelectedImage", (PyCFunction) _wrap_TreeListCtrl_SetItemSelectedImage, METH_VARARGS | METH_KEYWORDS },
{ (char *)"TreeListCtrl_FindItem", (PyCFunction) _wrap_TreeListCtrl_FindItem, 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_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_CENTER", SWIG_FromInt((int)wxTL_ALIGN_CENTER));
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");

View File

@ -1,11 +1,12 @@
// -*- C++ -*- //////////////////////////////////////////////////////////////
// Name: treelistctrl.h (derived by wx/treectrlg.h)
/////////////////////////////////////////////////////////////////////////////
// Name: treelistctrl.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
// Copyright: (c) Robert Roebling, Julian Smart, Alberto Griggio,
// Vadim Zeitlin, Otto Wyss
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
@ -33,6 +34,16 @@ class GIZMODLLEXPORT wxTreeListItem;
class GIZMODLLEXPORT wxTreeListHeaderWindow;
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
//-----------------------------------------------------------------------------
@ -48,15 +59,17 @@ class GIZMODLLEXPORT wxTreeListColumnInfo: public wxObject {
public:
enum { DEFAULT_COL_WIDTH = 100 };
wxTreeListColumnInfo(const wxChar* text = wxT(""),
wxTreeListColumnInfo(const wxString &text = wxT(""),
int image = -1,
size_t width = DEFAULT_COL_WIDTH,
bool shown = true,
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT)
{
m_image = image;
m_selected_image = -1;
m_text = text;
m_width = width;
m_shown = shown;
m_alignment = alignment;
}
@ -66,12 +79,14 @@ public:
m_selected_image = other.m_selected_image;
m_text = other.m_text;
m_width = other.m_width;
m_shown = other.m_shown;
m_alignment = other.m_alignment;
}
~wxTreeListColumnInfo() {}
// getters
bool GetShown() const { return m_shown; }
wxTreeListColumnAlign GetAlignment() const { return m_alignment; }
wxString GetText() const { return m_text; }
int GetImage() const { return m_image; }
@ -79,6 +94,9 @@ public:
size_t GetWidth() const { return m_width; }
// setters
wxTreeListColumnInfo& SetShown(bool shown)
{ m_shown = shown; return *this; }
wxTreeListColumnInfo& SetAlignment(wxTreeListColumnAlign alignment)
{ m_alignment = alignment; return *this; }
@ -95,6 +113,7 @@ public:
{ m_width = with; return *this; }
private:
bool m_shown;
wxTreeListColumnAlign m_alignment;
wxString m_text;
int m_image;
@ -106,6 +125,13 @@ private:
// 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
const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000;
extern GIZMODLLEXPORT const wxChar* wxTreeListCtrlNameStr;
@ -143,35 +169,31 @@ public:
// accessors
// ---------
// get the total number of items in the control
// 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.
// 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);
// line spacing is the space above and below the text on each line
unsigned int GetLineSpacing() const;
void SetLineSpacing(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.
// 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;
@ -188,12 +210,20 @@ public:
// adds a column
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);
// inserts a column before the given one
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);
// deletes the given column - does not delete the corresponding column
@ -224,25 +254,28 @@ public:
void SetColumnImage(size_t column, int image);
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.
// accessors
// ---------
// retrieve item's label (of the main column)
// retrieve item's label (of the main column)
wxString GetItemText(const wxTreeItemId& item) const
{ return GetItemText(item, GetMainColumn()); }
{ 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)
// 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
// get the data associated with the item
wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
bool GetItemBold(const wxTreeItemId& item) const;
@ -253,7 +286,7 @@ public:
// modifiers
// ---------
// set item's label
// set item's label
void SetItemText(const wxTreeItemId& item, const wxString& text)
{ SetItemText(item, GetMainColumn(), text); }
void SetItemText(const wxTreeItemId& item, size_t column,
@ -267,32 +300,31 @@ public:
void SetItemImage(const wxTreeItemId& item, size_t column, int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal);
// associate some data with the item
// 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.
// 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
// 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 text colour
void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour);
// set the item's background colour
void SetItemBackgroundColour(const wxTreeItemId& item,
const wxColour& col);
// set the item's background colour
void SetItemBackgroundColour(const wxTreeItemId& item, 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);
// set the window font
// set the window font
virtual bool SetFont( const wxFont &font );
// set the styles.
// set the styles.
void SetWindowStyle(const long styles);
long GetWindowStyle() const;
long GetWindowStyleFlag() const { return GetWindowStyle(); }
@ -300,25 +332,25 @@ public:
// 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;
// does the item has any children?
// 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())?
// 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)?
// is this item currently selected (the same as has focus)?
bool IsSelected(const wxTreeItemId& item) const;
// is item text in bold font?
// is item text in bold font?
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
// ------------------
// if 'recursively' is FALSE, only immediate children count, otherwise
// the returned number is the number of all items in this branch
// 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
@ -326,155 +358,163 @@ public:
// wxTreeItemId.IsOk() will return FALSE if there is no such item
// get the root tree item
// get the root tree item
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;
// 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;
// get the parent of this item (may return NULL if root)
wxTreeItemId GetParent(const wxTreeItemId& item) const;
// get the parent of this item (may return NULL if root)
wxTreeItemId GetItemParent(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!
// 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
// get the first child of this item
#if !wxCHECK_VERSION(2, 5, 0)
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;
// 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;
// get the next sibling of this item
// get the next sibling of this item
wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
// get the previous sibling
// get the previous sibling
wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
// get first visible item
// get first visible item
wxTreeItemId GetFirstVisibleItem() const;
// get the next visible item: item must be visible itself!
// see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
// 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!
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// delete all items from the tree
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
void DeleteAllItems();
// expand this item
// expand this 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);
// collapse the item without removing its children
// collapse the item without removing its children
void Collapse(const wxTreeItemId& item);
// collapse the item and remove all children
// collapse the item and remove all children
void CollapseAndReset(const wxTreeItemId& item);
// toggles the current state
// toggles the current state
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 UnselectAll();
// select this item
// 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 SelectAll(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)
// 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.
// 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)
// 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.
// 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)
// 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)!
// 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
// searching
wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
// overridden base class virtuals
virtual bool SetBackgroundColour(const wxColour& colour);
@ -487,20 +527,21 @@ public:
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();
// // the common part of all ctors
// void Init();
void OnSize(wxSizeEvent& event);
private:
size_t fill_column;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTreeListCtrl)
};

View File

@ -1,7 +1,7 @@
Recent Changes for wxPython
=====================================================================
2.5.1.6
2.5.2.0
-------
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
remaining compatible with "C".
Switched gizmos.TreeListCtrl to the newer version of the code from the
wxCode project.
2.5.1.5

View File

@ -586,9 +586,9 @@ if BUILD_GIZMOS:
USE_SWIG, swig_force, swig_args, swig_deps)
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,
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_CENTER = wx.gizmos.TL_ALIGN_CENTER
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
wxTreeListColumnInfoPtr = wx.gizmos.TreeListColumnInfoPtr
wxTreeListCtrl = wx.gizmos.TreeListCtrl