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!
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

Postby pkullmann » Mon Nov 19, 2012 1:48 pm

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: 3757
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxTreeList with NO_HEADER style option

Postby DavidHart » Mon Nov 19, 2012 3:04 pm

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

Postby pkullmann » Tue Nov 20, 2012 10:00 am

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


Return to “The Code Dump”

Who is online

Users browsing this forum: No registered users and 1 guest