git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9206
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+#ifdef __WXPM__
+
+#define INCL_BASE
+#include <os2.h>
+#include <direct.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#endif // __WXPM__
+
#ifdef __BORLANDC__
#include "dos.h"
#endif
#ifdef __BORLANDC__
#include "dos.h"
#endif
#undef GetFirstChild
#endif
#undef GetFirstChild
#endif
-#if !defined(__WXMSW__) || wxUSE_XPM_IN_MSW
+#if !defined(__WXMSW__) || wxUSE_XPM_IN_MSW || wxUSE_XPM_IN_OS2
/* Closed folder */
static char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */
/* Closed folder */
static char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */
static const int ID_NEW = 1004;
//static const int ID_CHECK = 1005;
static const int ID_NEW = 1004;
//static const int ID_CHECK = 1005;
+#if defined(__WXMSW__) || defined(__WXPM__)
static bool wxIsDriveAvailable(const wxString dirName)
{
#ifdef __WIN32__
static bool wxIsDriveAvailable(const wxString dirName)
{
#ifdef __WIN32__
+#if defined(__WXMSW__) || defined(__WXPM__)
rootName = _("Computer");
#else
rootName = _("Sections");
rootName = _("Computer");
#else
rootName = _("Sections");
{
wxDirItemDataEx *dir_item = new wxDirItemDataEx(path,name,TRUE);
{
wxDirItemDataEx *dir_item = new wxDirItemDataEx(path,name,TRUE);
-#ifdef __WXMSW__
- // Windows: sections are displayed as drives
+#if defined(__WXMSW__) || defined(__WXPM__)
+ // Windows and OS/2: sections are displayed as drives
wxTreeItemId id = m_treeCtrl->AppendItem( m_rootId, name, imageId, -1, dir_item);
#else
// Unix: sections are displayed as folders
wxTreeItemId id = m_treeCtrl->AppendItem( m_rootId, name, imageId, -1, dir_item);
#else
// Unix: sections are displayed as folders
void wxGenericDirCtrl::SetupSections()
{
void wxGenericDirCtrl::SetupSections()
{
+#if defined(__WXMSW__) || defined(__WXPM__)
#ifdef __WIN32__
wxChar driveBuffer[256];
#ifdef __WIN32__
wxChar driveBuffer[256];
if (wxIsDriveAvailable(path))
{
if (wxIsDriveAvailable(path))
{
AddSection(path, name);
}
}
AddSection(path, name);
}
}
wxString dirName(data->m_path);
wxString dirName(data->m_path);
+#if defined(__WXMSW__) || defined(__WXPM__)
// Check if this is a root directory and if so,
// whether the drive is avaiable.
if (!wxIsDriveAvailable(dirName))
// Check if this is a root directory and if so,
// whether the drive is avaiable.
if (!wxIsDriveAvailable(dirName))
// This may take a longish time. Go to busy cursor
wxBusyCursor busy;
// This may take a longish time. Go to busy cursor
wxBusyCursor busy;
+#if defined(__WXMSW__) || defined(__WXPM__)
if (dirName.Last() == ':')
dirName += wxString(wxFILE_SEP_PATH);
#endif
if (dirName.Last() == ':')
dirName += wxString(wxFILE_SEP_PATH);
#endif
wxLogNull log;
d.Open(dirName);
wxLogNull log;
d.Open(dirName);
if (d.IsOpened())
{
if (d.GetFirst(& eachFilename, m_currentFilterStr, wxDIR_FILES))
if (d.IsOpened())
{
if (d.GetFirst(& eachFilename, m_currentFilterStr, wxDIR_FILES))
wxDirItemDataEx *dir_item = new wxDirItemDataEx(path,eachFilename,TRUE);
wxTreeItemId id = m_treeCtrl->AppendItem( parentId, eachFilename, 0, -1, dir_item);
m_treeCtrl->SetItemImage( id, 1, wxTreeItemIcon_Expanded );
wxDirItemDataEx *dir_item = new wxDirItemDataEx(path,eachFilename,TRUE);
wxTreeItemId id = m_treeCtrl->AppendItem( parentId, eachFilename, 0, -1, dir_item);
m_treeCtrl->SetItemImage( id, 1, wxTreeItemIcon_Expanded );
// Has this got any children? If so, make it expandable.
int options = wxDIR_DEFAULT;
if (GetWindowStyle() & wxDIRCTRL_DIR_ONLY) // If only showing dirs, then we specify dirs only here
// Has this got any children? If so, make it expandable.
int options = wxDIR_DEFAULT;
if (GetWindowStyle() & wxDIRCTRL_DIR_ONLY) // If only showing dirs, then we specify dirs only here
wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& path, bool& done)
{
wxString path2(path);
wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& path, bool& done)
{
wxString path2(path);
// Make sure all separators are as per the current platform
path2.Replace(wxT("\\"), wxString(wxFILE_SEP_PATH));
path2.Replace(wxT("/"), wxString(wxFILE_SEP_PATH));
// Make sure all separators are as per the current platform
path2.Replace(wxT("\\"), wxString(wxFILE_SEP_PATH));
path2.Replace(wxT("/"), wxString(wxFILE_SEP_PATH));
// Append a separator to foil bogus substring matching
path2 += wxString(wxFILE_SEP_PATH);
// Append a separator to foil bogus substring matching
path2 += wxString(wxFILE_SEP_PATH);
-
- // In MSW, case is not significant
-#ifdef __WXMSW__
+
+ // In MSW or PM, case is not significant
+#if defined(__WXMSW__) || defined(__WXPM__)
path2.MakeLower();
#endif
path2.MakeLower();
#endif
long cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie);
while (childId.IsOk())
{
wxDirItemDataEx* data = (wxDirItemDataEx*) m_treeCtrl->GetItemData(childId);
long cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie);
while (childId.IsOk())
{
wxDirItemDataEx* data = (wxDirItemDataEx*) m_treeCtrl->GetItemData(childId);
if (data && data->m_path != "")
{
wxString childPath(data->m_path);
if (childPath.Last() != wxFILE_SEP_PATH)
childPath += wxString(wxFILE_SEP_PATH);
if (data && data->m_path != "")
{
wxString childPath(data->m_path);
if (childPath.Last() != wxFILE_SEP_PATH)
childPath += wxString(wxFILE_SEP_PATH);
-
- // In MSW, case is not significant
-#ifdef __WXMSW__
+
+ // In MSW and PM, case is not significant
+#if defined(__WXMSW__) || defined(__WXPM__)
childPath.MakeLower();
#endif
childPath.MakeLower();
#endif
if (childPath.Len() <= path2.Len())
{
wxString path3 = path2.Mid(0, childPath.Len());
if (childPath.Len() <= path2.Len())
{
wxString path3 = path2.Mid(0, childPath.Len());
childId = m_treeCtrl->GetNextChild(childId, cookie);
}
wxTreeItemId invalid;
childId = m_treeCtrl->GetNextChild(childId, cookie);
}
wxTreeItemId invalid;
while (childId.IsOk())
{
wxDirItemDataEx* data = (wxDirItemDataEx*) m_treeCtrl->GetItemData(childId);
while (childId.IsOk())
{
wxDirItemDataEx* data = (wxDirItemDataEx*) m_treeCtrl->GetItemData(childId);
if (data && data->m_path != "" && !data->m_isDir)
{
m_treeCtrl->SelectItem(childId);
if (data && data->m_path != "" && !data->m_isDir)
{
m_treeCtrl->SelectItem(childId);
wxString dirName(data->m_path);
wxString dirName(data->m_path);
+#if defined(__WXMSW__) || defined(__WXPM__)
if (dirName.Last() == ':')
dirName += wxString(wxFILE_SEP_PATH);
#endif
if (dirName.Last() == ':')
dirName += wxString(wxFILE_SEP_PATH);
#endif
int sel = GetSelection();
wxString currentPath = m_dirCtrl->GetPath();
int sel = GetSelection();
wxString currentPath = m_dirCtrl->GetPath();
m_dirCtrl->SetFilterIndex(sel);
// If the filter has changed, the view is out of date, so
m_dirCtrl->SetFilterIndex(sel);
// If the filter has changed, the view is out of date, so