wxTreeList with NO_HEADER style option

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
pkullmann
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Nov 30, 2006 6:15 pm

wxTreeList with NO_HEADER style option

Post by pkullmann »

Hi,

wxTreeList is using wxDataViewCtrl, which allows to not display column headers (wxDV_NO_HEADER style). Unfortunately this style is not available in wxTreeList. Also, it is not possible to simply override wxTreeList::Create, because it uses an internal class, which is not exported. So, I enhanced wxTreeList to support the new style wxTL_NO_HEADER:

Based on 2.9.4:

in include/wx/treelist.h, line 50
add

Code: Select all

wxTL_NO_HEADER      = 0x0010,
in src/generic/treelist.cpp, line 1032
replace with

Code: Select all

	long styleDataView = HasFlag(wxTL_MULTIPLE) ? wxDV_MULTIPLE
                                                : wxDV_SINGLE;
	if ( HasFlag(wxTL_NO_HEADER) )
		styleDataView |= wxDV_NO_HEADER;

	if ( !m_view->Create(this, wxID_ANY,
                        wxPoint(0, 0), GetClientSize(),
								styleDataView) )
Great, if this could be included in wxWidgets in the next version.

Peter
Last edited by pkullmann on Tue Nov 20, 2012 10:01 am, edited 1 time in total.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxTreeList with NO_HEADER style option

Post by DavidHart »

Hi Peter,

Thank you for posting the code.
Great if this could be included in wxWidgets in the next version.
This is a user forum. If you feel this should be in wx itself, you should make a bug-report to trac, attaching a patch made against svn trunk.

Regards,

David
pkullmann
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Nov 30, 2006 6:15 pm

Re: wxTreeList with NO_HEADER style option

Post by pkullmann »

If you feel this should be in wx itself, you should make a bug-report to trac, attaching a patch made against svn trunk.
I did that in the meamtime.
The patch has been accepted and will be in 2.9.5
Post Reply