#endif
/* Closed folder */
-static char * icon1_xpm[] = {
+static const char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 6 1",
/* colors */
" "};
/* Open folder */
-static char * icon2_xpm[] = {
+static const char * icon2_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 6 1",
/* colors */
" "};
/* File */
-static char * icon3_xpm[] = {
+static const char * icon3_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 3 1",
/* colors */
" "};
/* Computer */
-static char * icon4_xpm[] = {
+static const char * icon4_xpm[] = {
"16 16 7 1",
" s None c None",
". c #808080",
"............o "};
/* Drive */
-static char * icon5_xpm[] = {
+static const char * icon5_xpm[] = {
"16 16 7 1",
" s None c None",
". c #808080",
" "};
/* CD-ROM */
-static char *icon6_xpm[] = {
+static const char *icon6_xpm[] = {
"16 16 10 1",
" s None c None",
". c #808080",
" "};
/* Floppy */
-static char * icon7_xpm[] = {
+static const char * icon7_xpm[] = {
"16 16 7 1",
" s None c None",
". c #808080",
" "};
/* Removeable */
-static char * icon8_xpm[] = {
+static const char * icon8_xpm[] = {
"16 16 7 1",
" s None c None",
". c #808080",
#if defined(__DOS__)
-static bool wxIsDriveAvailable(const wxString dirName)
+bool wxIsDriveAvailable(const wxString& dirName)
{
+ // FIXME_MGL - this method leads to hang up under Watcom for some reason
+#ifndef __WATCOMC__
if ( dirName.Len() == 3 && dirName[1u] == wxT(':') )
{
wxString dirNameLower(dirName.Lower());
wxPathExists(dirNameLower));
}
else
+#endif
return TRUE;
}
#endif // !GNUWIN32
}
-static bool wxIsDriveAvailable(const wxString dirName)
+bool wxIsDriveAvailable(const wxString& dirName)
{
#ifdef __WIN32__
UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
{
wxString *strFirst = (wxString *)first;
wxString *strSecond = (wxString *)second;
-
+
return strFirst->CmpNoCase(*strSecond);
}
return dir.HasSubDirs();
}
-bool wxDirItemData::HasFiles(const wxString& spec) const
+bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const
{
if (m_path.IsEmpty())
return FALSE;
Init();
- long treeStyle = wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS | wxTR_HIDE_ROOT;
+ long treeStyle = wxTR_HAS_BUTTONS;
+#ifdef __WXMSW__
+ // VS: Do **NOT** remove this style, ever. MSW native wxTreeCtrl::EditLabel doesn't
+ // work without this style and we need it to be able to create new directories.
+ // Generic wxTreeCtrl can do it even w/o wxTR_EDIT_LABELS, so we only add it
+ // in case of wxMSW (as it is arguably better to not have the style enabled)
+ treeStyle |= wxTR_EDIT_LABELS;
+#endif
+#ifndef __WXMSW__
+ // FIXME, doesn't work for some reason
+ treeStyle |= wxTR_HIDE_ROOT;
+#endif
+
if ((style & wxDIRCTRL_3D_INTERNAL) == 0)
treeStyle |= wxNO_BORDER;
m_filterListCtrl = NULL;
}
+void wxGenericDirCtrl::ShowHidden( bool show )
+{
+ m_showHidden = show;
+
+ wxString path = GetPath();
+ m_treeCtrl->Collapse(m_treeCtrl->GetRootItem());
+ m_treeCtrl->Expand(m_treeCtrl->GetRootItem());
+ SetPath(path);
+}
+
void wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
{
wxDirItemData *dir_item = new wxDirItemData(path,name,TRUE);
if (d.IsOpened())
{
- if (d.GetFirst(& eachFilename, wxEmptyString, wxDIR_DIRS | wxDIR_HIDDEN))
+ int style = wxDIR_DIRS;
+ if (m_showHidden) style |= wxDIR_HIDDEN;
+ if (d.GetFirst(& eachFilename, wxEmptyString, style))
{
do
{
wxSize filterSz ;
if (m_filterListCtrl)
{
+#ifdef __WXMSW__
+ // For some reason, this is required in order for the
+ // correct control height to always be returned, rather
+ // than the drop-down list height which is sometimes returned.
+ wxSize oldSize = m_filterListCtrl->GetSize();
+ m_filterListCtrl->SetSize(-1, -1, oldSize.x+10, -1, wxSIZE_USE_EXISTING);
+ m_filterListCtrl->SetSize(-1, -1, oldSize.x, -1, wxSIZE_USE_EXISTING);
+#endif
filterSz = m_filterListCtrl->GetSize();
sz.y -= (filterSz.y + verticalSpacing);
}