// Name: ownerdrw.h
// Purpose: interface for owner-drawn GUI elements
// Author: Vadim Zeitlin
-// Modified by:
+// Modified by:
// Created: 11.11.97
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
wxColour& GetBackgroundColour() const
{ return (wxColour&) m_colBack ; }
- void SetBitmaps(const wxBitmap& bmpChecked,
+ void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap)
{ m_bmpChecked = bmpChecked;
m_bmpUnchecked = bmpUnchecked;
// constants used in OnDrawItem
// (they have the same values as corresponding Win32 constants)
enum wxODAction
- {
+ {
wxODDrawAll = 0x0001, // redraw entire control
wxODSelectChanged = 0x0002, // selection changed (see Status.Select)
- wxODFocusChanged = 0x0004, // keyboard focus changed (see Status.Focus)
+ wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus)
};
enum wxODStatus
wxODDisabled = 0x0004, // item is to be drawn as disabled
wxODChecked = 0x0008, // item is to be checked
wxODHasFocus = 0x0010, // item has the keyboard focus
- wxODDefault = 0x0020, // item is the default item
+ wxODDefault = 0x0020 // item is the default item
};
// virtual functions to implement drawing (return TRUE if processed)
#include "wx/generic/prntdlgg.h"
#endif
-#if !defined(__WXMSW__) && !defined(__WXMAC__)
+#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__)
#define wxPrintDialog wxGenericPrintDialog
#define sm_classwxPrintDialog sm_classwxGenericPrintDialog
#include "wx/msw/winundef.h"
#endif
-#ifdef __WXPM__
-#define INCL_OS2
-#include <os2.h>
-#endif
-
#include "wx/wx.h"
#include "wx/intl.h"
#endif
+
#ifdef __WXGTK__
#include "wx/mdi.h"
#endif
wxPrintDialogData data;
- wxPrintDialog printerDialog(parentWin, & data);
+ wxPrintDialog printerDialog(parentWin, &data);
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
printerDialog.ShowModal();
#endif // wxUSE_PRINTING_ARCHITECTURE
#ifdef __BORLANDC__
#pragma hdrstop
#endif
-
#if wxUSE_DYNLIB_CLASS
#include "wx/dynlib.h"
# endif // Win32/16
# define wxDllGetSymbol(handle, name) ::GetProcAddress(handle, name)
# define wxDllClose ::FreeLibrary
+
+#elif defined(__OS2__)
+
+# define INCL_DOS
+# include <os2.h>
+# define wxDllOpen(error, lib, handle) DosLoadModule(error, sizeof(error), lib, &handle)
+# define wxDllGetSymbol(handle, modaddr) DosQueryProcAddr(handle, 1L, NULL, (PFN*)modaddr)
+# define wxDllClose(handle) DosFreeModule(handle)
#else
# error "Don't know how to load shared libraries on this platform."
#endif // OS
# else //__HPUX__
fullname << ".so";
# endif //__HPUX__
-#elif defined(__WINDOWS__)
+#elif defined(__WINDOWS__) || defined(__OS2__)
fullname << ".dll";
#endif
#ifdef __UNIX__
return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/);
#else
- wxFAIL_MSG(_("This method is not implemented under Windows"));
+ wxFAIL_MSG(_("This method is not implemented under Windows or OS/2"));
return 0;
#endif
wxASSERT_MSG( 1 , (char*)myErrName ) ;
return NULL ;
}
+#elif defined(__OS2__)
+ char zError[256] = "";
+ wxDllOpen(zError, libname, handle);
#else // !Mac
handle = wxDllOpen(libname);
#endif // OS
if ( FindSymbol( dllHandle , symName , &symAddress , &symClass ) == noErr )
symbol = (void *)symAddress ;
+#elif defined( __OS2__ )
+ wxDllGetSymbol(dllHandle, symbol);
#else
symbol = wxDllGetSymbol(dllHandle, name);
#endif
wxLibrary *lib;
wxClassInfo *old_sm_first;
+#if defined(__VISAGECPP__)
+ node = m_loaded.Find(name.GetData());
+ if (node != NULL)
+ return ((wxLibrary *)node->Data());
+#else // !OS/2
if ( (node = m_loaded.Find(name.GetData())) )
return ((wxLibrary *)node->Data());
-
+#endif
// If DLL shares data, this is necessary.
old_sm_first = wxClassInfo::sm_first;
wxClassInfo::sm_first = NULL;
#ifdef __GNUWIN32__
#include <windows.h>
#endif
+#elif (defined(__WXPM__))
+ #include <io.h>
+ #include <direct.h>
+ #define W_OK 2
+ #define R_OK 4
#elif (defined(__WXSTUBS__))
// Have to ifdef this for different environments
#include <io.h>
static const wxChar *szMktempSuffix = _T("XXXXXX");
m_strTemp << strName << szMktempSuffix;
mktemp(MBSTRINGCAST m_strTemp.mb_str()); // will do because length doesn't change
+#elif defined(__WXPM__)
+ // for now just create a file
+ // future enhancements can be to set some extended attributes for file systems
+ // OS/2 supports that have them (HPFS, FAT32) and security (HPFS386)
+ static const wxChar *szMktempSuffix = _T("XXX");
+ m_strTemp << strName << szMktempSuffix;
+ mkdir(m_strTemp.GetWriteBuf(MAX_PATH));
#else // Windows
wxString strPath;
wxSplitPath(strName, &strPath, NULL, NULL);
#if defined(__WXMSW__) && !defined(_WINDOWS_)
#include <windows.h>
#endif //windows.h
+#if defined(__WXPM__)
+ #define INCL_DOS
+ #include <os2.h>
+ #define LINKAGEMODE _Optlink
+#else
+ #define LINKAGEMODE
+#endif
#include <stdlib.h>
#include <ctype.h>
// ----------------------------------------------------------------------------
// compare functions for sorting the arrays
-static int CompareEntries(ConfigEntry *p1, ConfigEntry *p2);
-static int CompareGroups(ConfigGroup *p1, ConfigGroup *p2);
+static int LINKAGEMODE CompareEntries(ConfigEntry *p1, ConfigEntry *p2);
+static int LINKAGEMODE CompareGroups(ConfigGroup *p1, ConfigGroup *p2);
// filter strings
static wxString FilterInValue(const wxString& str);
#ifdef __UNIX__
strDir = _T("/etc/");
+ #elif defined(__WXPM__)
+ ULONG aulSysInfo[QSV_MAX] = {0};
+ UINT drive;
+ APIRET rc;
+
+ rc = DosQuerySysInfo( 1L, QSV_MAX, (PVOID)aulSysInfo, sizeof(ULONG)*QSV_MAX);
+ if (rc == 0)
+ {
+ drive = aulSysInfo[QSV_BOOT_DRIVE - 1];
+ switch(drive)
+ {
+ case 1:
+ strDir = "A:\\OS2\\";
+ break;
+ case 2:
+ strDir = "B:\\OS2\\";
+ break;
+ case 3:
+ strDir = "C:\\OS2\\";
+ break;
+ case 4:
+ strDir = "D:\\OS2\\";
+ break;
+ case 5:
+ strDir = "E:\\OS2\\";
+ break;
+ case 6:
+ strDir = "F:\\OS2\\";
+ break;
+ case 7:
+ strDir = "G:\\OS2\\";
+ break;
+ case 8:
+ strDir = "H:\\OS2\\";
+ break;
+ case 9:
+ strDir = "I:\\OS2\\";
+ break;
+ case 10:
+ strDir = "J:\\OS2\\";
+ break;
+ case 11:
+ strDir = "K:\\OS2\\";
+ break;
+ case 12:
+ strDir = "L:\\OS2\\";
+ break;
+ case 13:
+ strDir = "M:\\OS2\\";
+ break;
+ case 14:
+ strDir = "N:\\OS2\\";
+ break;
+ case 15:
+ strDir = "O:\\OS2\\";
+ break;
+ case 16:
+ strDir = "P:\\OS2\\";
+ break;
+ case 17:
+ strDir = "Q:\\OS2\\";
+ break;
+ case 18:
+ strDir = "R:\\OS2\\";
+ break;
+ case 19:
+ strDir = "S:\\OS2\\";
+ break;
+ case 20:
+ strDir = "T:\\OS2\\";
+ break;
+ case 21:
+ strDir = "U:\\OS2\\";
+ break;
+ case 22:
+ strDir = "V:\\OS2\\";
+ break;
+ case 23:
+ strDir = "W:\\OS2\\";
+ break;
+ case 24:
+ strDir = "X:\\OS2\\";
+ break;
+ case 25:
+ strDir = "Y:\\OS2\\";
+ break;
+ case 26:
+ strDir = "Z:\\OS2\\";
+ break;
+ }
+ }
#elif defined(__WXSTUBS__)
wxASSERT_MSG( FALSE, _T("TODO") ) ;
#elif defined(__WXMAC__)
#include <dirent.h>
#endif
+#ifdef __OS2__
+ #include <direct.h>
+ #include <process.h>
+#endif
#ifdef __WINDOWS__
#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
#include <direct.h>
#endif
/* Expand inline environment variables */
+#ifdef __VISAGECPP__
+ while (*d)
+ {
+ *d++ = *s;
+ if(*s == _T('\\'))
+ {
+ *(d - 1) = *++s;
+ if (*d)
+ {
+ s++;
+ continue;
+ }
+ else
+ break;
+ }
+ else
+#else
while ((*d++ = *s)) {
-#ifndef __WXMSW__
+# ifndef __WXMSW__
if (*s == _T('\\')) {
if ((*(d - 1) = *++s)) {
s++;
} else
break;
} else
+# endif
#endif
#ifdef __WXMSW__
if (*s++ == _T('$') && (*s == _T('{') || *s == _T(')')))
register wxChar *start = d;
register int braces = (*s == _T('{') || *s == _T('('));
register wxChar *value;
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ while (*d)
+ *d++ = *s;
+#else
while ((*d++ = *s))
+#endif
if (braces ? (*s == _T('}') || *s == _T(')')) : !(wxIsalnum(*s) || *s == _T('_')) )
break;
else
*--d = 0;
value = wxGetenv(braces ? start + 1 : start);
if (value) {
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ for ((d = start - 1); (*d); *d++ = *value++);
+#else
for ((d = start - 1); (*d++ = *value++););
+#endif
d--;
if (braces && *s)
s++;
*(d - 1) = SEP;
}
s = nm;
+#ifdef __VISAGECPP__
+ // VA gives assignment in logical expr warning
+ while (*d)
+ *d++ = *s++;
+#else
while ((*d++ = *s++));
-
+#endif
delete[] nm_tmp; // clean up alloc
/* Now clean up the buffer */
return wxRealPath(buf);
#endif
return tcp + 1;
} /* while */
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (wxIsalpha (*path) && *(path + 1) == _T(':'))
return path + 2;
#endif
#endif
return wxString(tcp + 1);
} /* while */
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (wxIsalpha (*path) && *(path + 1) == _T(':'))
return wxString(path + 2);
#endif
else i --;
}
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
// Try Drive specifier
if (wxIsalpha (buf[0]) && buf[1] == _T(':'))
{
else i --;
}
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
// Try Drive specifier
if (wxIsalpha (buf[0]) && buf[1] == _T(':'))
{
{
if (*s == _T('\\'))
*s = _T('/');
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
else
*s = wxTolower(*s); // Case INDEPENDENT
#endif
}
void
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
wxUnix2DosFilename (wxChar *s)
#else
wxUnix2DosFilename (wxChar *WXUNUSED(s))
#endif
{
// Yes, I really mean this to happen under DOS only! JACS
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXPM__)
if (s)
while (*s)
{
const wxChar *dirname = dir.c_str();
#endif // Mac/!Mac
- // assume mkdir() has 2 args on non Windows platforms and on Windows too
+ // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too
// for the GNU compiler
-#if !defined(__WXMSW__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__)
+#if (!(defined(__WXMSW__) || defined(__WXPM__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__)
if ( mkdir(wxFNCONV(dirname), perm) != 0 )
-#else // MSW
- if ( mkdir(wxFNCONV(dirname)) != 0 )
+#else // MSW and OS/2
+ if ( mkdir((char*)wxFNCONV(dirname)) != 0 )
#endif // !MSW/MSW
{
wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
bool wxSetWorkingDirectory(const wxString& d)
{
-#if defined( __UNIX__ ) || defined( __WXMAC__ )
- return (chdir(d.fn_str()) == 0);
+#if defined( __UNIX__ ) || defined( __WXMAC__ ) || defined(__WXPM__)
+ return (chdir((char*)d.fn_str()) == 0);
#elif defined(__WINDOWS__)
#ifdef __WIN32__
pDot = NULL;
}
#endif // MSW/Unix
-
+
if ( pDot < pLastSeparator )
{
// the dot is part of the path, not the start of the extension
if ( pstrPath )
{
- if ( pLastSeparator )
+ if ( pLastSeparator )
*pstrPath = wxString(pszFileName, pLastSeparator - pszFileName);
else
pstrPath->Empty();