/////////////////////////////////////////////////////////////////////////////
-// Name: dirctrlg.cpp
+// Name: src/generic/dirctrlg.cpp
// Purpose: wxGenericDirCtrl
// Author: Harm van der Heijden, Robert Roebling, Julian Smart
// Modified by:
// Note: If _filesys is unsupported by some compilers,
// we can always replace it by DosQueryFSAttach
char filesysname[20];
+#ifdef __WATCOMC__
+ ULONG cbBuffer = sizeof(filesysname);
+ PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)filesysname;
+ APIRET rc = ::DosQueryFSAttach(name.fn_str(),0,FSAIL_QUERYNAME,pfsqBuffer,&cbBuffer);
+ if (rc != NO_ERROR)
+ {
+ filesysname[0] = '\0';
+ }
+#else
_filesys(name.fn_str(), filesysname, sizeof(filesysname));
+#endif
/* FAT, LAN, HPFS, CDFS, NFS */
int imageId;
if (path == wxT("A:\\") || path == wxT("B:\\"))
// Now do the filenames -- but only if we're allowed to
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
{
- wxLogNull log;
-
d.Open(dirName);
if (d.IsOpened())
size_t i;
for (i = 0; i < dirs.Count(); i++)
{
- wxString eachFilename(dirs[i]);
+ eachFilename = dirs[i];
path = dirName;
if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH);
{
for (i = 0; i < filenames.Count(); i++)
{
- wxString eachFilename(filenames[i]);
+ eachFilename = filenames[i];
path = dirName;
if (!wxEndsWithPathSeparator(path))
path += wxString(wxFILE_SEP_PATH);
if (id.IsOk())
lastId = id;
}
- if (lastId.IsOk())
+ if (!lastId.IsOk())
+ return false;
+
+ wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId);
+ if (data->m_isDir)
{
- wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId);
- if (data->m_isDir)
- {
- m_treeCtrl->Expand(lastId);
- }
- if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
+ m_treeCtrl->Expand(lastId);
+ }
+ if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
+ {
+ // Find the first file in this directory
+ wxTreeItemIdValue cookie;
+ wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
+ bool selectedChild = false;
+ while (childId.IsOk())
{
- // Find the first file in this directory
- wxTreeItemIdValue cookie;
- wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
- bool selectedChild = false;
- while (childId.IsOk())
- {
- wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
+ data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
- if (data && data->m_path != wxEmptyString && !data->m_isDir)
- {
- m_treeCtrl->SelectItem(childId);
- m_treeCtrl->EnsureVisible(childId);
- selectedChild = true;
- break;
- }
- childId = m_treeCtrl->GetNextChild(lastId, cookie);
- }
- if (!selectedChild)
+ if (data && data->m_path != wxEmptyString && !data->m_isDir)
{
- m_treeCtrl->SelectItem(lastId);
- m_treeCtrl->EnsureVisible(lastId);
+ m_treeCtrl->SelectItem(childId);
+ m_treeCtrl->EnsureVisible(childId);
+ selectedChild = true;
+ break;
}
+ childId = m_treeCtrl->GetNextChild(lastId, cookie);
}
- else
+ if (!selectedChild)
{
m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId);
}
-
- return true;
}
else
- return false;
+ {
+ m_treeCtrl->SelectItem(lastId);
+ m_treeCtrl->EnsureVisible(lastId);
+ }
+
+ return true;
}
wxString wxGenericDirCtrl::GetPath() const