wxWindows stuff
Patch for wxListCtrl/generic (v. 2.3.3) to make wxLIST_FORMAT_* work
This is a really simple (and so probably not full-optimized) patch to make
column alignment work also on the generic version of wxListCtrl. You can get it here. To apply it:
cd $PATH_TO_WXWIN
patch -p2 src/generic/listctrl.cpp <listctrl.cpp.diff
wxTreeListCtrl
This is my first effort to produce a multicolumn tree control (or, as the name
says, a combination of a tree and a list control). The implementation is
basically just a cut & paste of portions of src/generic/listctrl.cpp
and src/generic/treectrl.cpp (with some minor modifications to make
the whole thing work, of course ;-).
It is not derived from wxTreeCtrl (the main reason is that on wxMSW it
would not have been possible - or at least I wouldn't have been able to do
it), but the interface is virtually identical, with some new methods to handle
columns in various ways.
The methods added are listed here, but please see the sources for the
details.
- void AddColumn(const wxString& text)
- void AddColumn(const wxTreeListColumnInfo& col)
- void InsertColumn(size_t before, const wxString& text)
- void InsertColumn(size_t before, const wxTreeListColumnInfo& col)
- void RemoveColumn(size_t column)
- size_t GetColumnCount() const
- void SetColumnWidth(size_t column, size_t width)
- int GetColumnWidth(size_t column) const
- void SetMainColumn(size_t column)
- size_t GetMainColumn() const
- void SetColumnText(size_t column, const wxString& text)
- wxString GetColumnText(size_t column) const
- void SetColumn(size_t column, const wxTreeListColumnInfo& info)
- wxTreeListColumnInfo& GetColumn(size_t column)
There are also new overloaded versions of some methods (again, see the
sources for the details):
- wxString GetItemText(const wxTreeItemId& item, size_t column) const
- int GetItemImage(const wxTreeItemId& item, size_t column,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const
- void SetItemText(const wxTreeItemId& item, size_t column,
const wxString& text)
- void SetItemImage(const wxTreeItemId& item, size_t column, int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal)
- wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column)
Event handling
wxTreeListCtrl supports all the EVT_TREE_* events. In addition to
those, it supports also the EVT_LIST_COL_* events, to get information about
the columns behaviour.
Compiling
There's just one issue to address when compiling the sources: you have to edit
the wx/treebase.h header file to add a friend declaration,
otherwise the compilation will fail. In particular, you have to add the
following line in the body of class wxTreeEvent (around line
260):
friend class wxTreeListMainWindow;
Screenshot
If you, like me, want to see how something works before dowloading it, here's a simple screenshot.
Download
You can get wxTreeListCtrl here. The archive
contains a modified version of wxWindows' tree ctrl sample which shows how to
use the widget.
Last modified: 2002-10-10 14.30