-wxDirCtrl::wxDirCtrl(wxWindow *parent,
- const wxWindowID id,
- const wxString &WXUNUSED(dir),
- const wxPoint& pos,
- const wxSize& size,
- const long style,
- const wxString& name )
- : wxTreeCtrl( parent, id, pos, size, style, wxDefaultValidator, name )
-{
-#ifndef __WXMSW__
- m_imageListNormal = new wxImageList(16, 16, TRUE);
- m_imageListNormal->Add(wxICON(icon1));
- m_imageListNormal->Add(wxICON(icon2));
- SetImageList(m_imageListNormal);
-#endif // !MSW
-
- m_showHidden = FALSE;
- m_rootId = AddRoot( _("Sections") );
- SetItemHasChildren(m_rootId);
- Expand(m_rootId); // automatically expand first level
-}
-
-/* Quick macro. Don't worry, I'll #undef it later */
-#define ADD_SECTION(a,b) \
- if (wxPathExists((a))) { m_paths.Add( (a) ); m_names.Add( (b) ); };
-
-void wxDirCtrl::SetupSections()
-{
- wxString home;
-
- m_paths.Clear();
- m_names.Clear();
-#ifdef __WXMSW__
- // better than nothing
- ADD_SECTION(wxT("c:\\"), _("My Harddisk") )
-#else
- ADD_SECTION(wxT("/"), _("The Computer") )
- wxGetHomeDir(&home);
- ADD_SECTION(home, _("My Home") )
- ADD_SECTION(wxT("/mnt"), _("Mounted Devices") )
- ADD_SECTION(wxT("/usr/local"), _("User Local") )
- ADD_SECTION(wxT("/usr"), _("User") )
- ADD_SECTION(wxT("/var"), _("Variables") )
- ADD_SECTION(wxT("/etc"), _("Etcetera") )
- ADD_SECTION(wxT("/tmp"), _("Temporary") )
-#endif
-}
-#undef ADD_SECTION