I'd like to modify the way wxGenericDirCtrl behaves. Specifically, I'd like the option to sort directories by date, rather than alphabetically.
I have tried to inherit from it, so that I can overload ExpandDir() (which is virtual, so I guess it's designed to be overloaded), and have it call a different version of PopulateNode(). However, I hit a couple of problems.
1. All of the member variables of wxGenericDirCtrl are private, so my new class doesn't have access to them.
2. Even when I sneakily changed them to protected, my new ExpandDir() function wasn't called.
My questions are:
1. Am I doing something wrong here? Is there some correct way to overload wxGenericDirCtrl::ExpandDir()?
2. Has anyone ever tried something similar?
3. Why are some of wxGenericDirCtrl's functions virtual, while all of its member functions are private?
Code: Select all
class PowerDirCtrl : public wxGenericDirCtrl
PowerDirCtrl( wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString &dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRCTRL_DEFAULT_STYLE,
const wxString &filter = wxEmptyString,
int defaultFilter = 0,
const wxString &name = wxTreeCtrlNameStr)
:wxGenericDirCtrl(parent, id, dir, pos, size, style, filter, defaultFilter, name)
//Create(parent, id, dir, pos, size, style, filter, defaultFilter, name);
void ExpandDir(wxTreeItemId parentId)
void PopulateNode2(wxTreeItemId node);
wxDirItemData* GetItemData2(wxTreeItemId itemId)