// Recommended setting: 1
#define wxUSE_CONFIG_NATIVE 1
+// Use wxFileConfig.
+// Recommended setting: 1
+#define wxUSE_FILECONFIG 0
+
// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows
// to connect/disconnect from the network and be notified whenever the dial-up
// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER.
// Default is 1.
//
// Recommended setting: 1
-#define wxUSE_DIALUP_MANAGER 1
+#define wxUSE_DIALUP_MANAGER 0
// Compile in classes for run-time DLL loading and function calling.
// Required by wxUSE_DIALUP_MANAGER.
#define wxUSE_DYNLIB_CLASS 1
// experimental, don't use for now
-#define wxUSE_DYNAMIC_LOADER 1
+#define wxUSE_DYNAMIC_LOADER 0
// Set to 1 to use socket classes
-#define wxUSE_SOCKETS 1
+#define wxUSE_SOCKETS 0
// Set to 1 to enable virtual file systems (required by wxHTML)
-#define wxUSE_FILESYSTEM 1
+#define wxUSE_FILESYSTEM 0
// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM)
-#define wxUSE_FS_ZIP 1
+#define wxUSE_FS_ZIP 0
// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM)
-#define wxUSE_FS_INET 1
+#define wxUSE_FS_INET 0
// Set to 1 to compile wxZipInput/OutputStream classes.
-#define wxUSE_ZIPSTREAM 1
+#define wxUSE_ZIPSTREAM 0
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
// wxUSE_LIBPNG.
// Default is 1.
//
// Recommended setting: 1
-#define wxUSE_PROTOCOL 1
+#define wxUSE_PROTOCOL 0
// The settings for the individual URL schemes
#define wxUSE_PROTOCOL_FILE 1
#define wxUSE_PROTOCOL_HTTP 1
// Define this to use wxURL class.
-#define wxUSE_URL 1
+#define wxUSE_URL 0
// Support for regular expression matching via wxRegEx class: enable this to
// use POSIX regular expressions in your code. You need to compile regex
//
// Recommended setting: 1 if your compiler supports it, if it doesn't please
// contribute us a makefile for src/regex for it
-#define wxUSE_REGEX 1
+#define wxUSE_REGEX 0
// wxSystemOptions class
#define wxUSE_SYSTEM_OPTIONS 1
// Default is 1
//
// Recommended setting: 1 (unless it really doesn't work)
-#define wxUSE_COMMON_DIALOGS 1
+#define wxUSE_COMMON_DIALOGS 0
// wxBusyInfo displays window with message when app is busy. Works in same way
// as wxBusyCursor
#define wxUSE_MDI_ARCHITECTURE 1
// Set to 0 to disable print/preview architecture code
-#define wxUSE_PRINTING_ARCHITECTURE 1
+#define wxUSE_PRINTING_ARCHITECTURE 0
// wxHTML sublibrary allows to display HTML in wxWindow programs and much,
// much more.
//
// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a
// smaller library.
-#define wxUSE_HTML 1
+#define wxUSE_HTML 0
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
// 0 for no interprocess comms
#define wxUSE_HELP 0
// 0 for no help facility
-#define wxUSE_MS_HTML_HELP 1
+#define wxUSE_MS_HTML_HELP 0
// 0 for no MS HTML Help
// Use wxHTML-based help controller?
#define wxUSE_WXHTML_HELP 0
-#define wxUSE_RESOURCES 1
+#define wxUSE_RESOURCES 0
// 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1
// 0 for no window layout constraint system
// Set to 0 to disable PostScript print/preview architecture code under Windows
// (just use Windows printing).
-#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1
+#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
// ----------------------------------------------------------------------------
// database classes
#define wxUSE_IMAGE 1
// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB.
-#define wxUSE_LIBPNG 1
+#define wxUSE_LIBPNG 0
// Set to 1 for JPEG format support (requires libjpeg)
-#define wxUSE_LIBJPEG 1
+#define wxUSE_LIBJPEG 0
// Set to 1 for TIFF format support (requires libtiff)
-#define wxUSE_LIBTIFF 1
+#define wxUSE_LIBTIFF 0
// Set to 1 for GIF format support
-#define wxUSE_GIF 1
+#define wxUSE_GIF 0
// Set to 1 for PNM format support
-#define wxUSE_PNM 1
+#define wxUSE_PNM 0
// Set to 1 for PCX format support
-#define wxUSE_PCX 1
+#define wxUSE_PCX 0
// Set to 1 for IFF format support (Amiga format)
#define wxUSE_IFF 0
#define wxUSE_XPM 1
// Set to 1 for MS Icons and Cursors format support
-#define wxUSE_ICO_CUR 1
+#define wxUSE_ICO_CUR 0
// Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1
#define wxUSE_OWNER_DRAWN 1
// Set to 1 to compile MS Windows XP theme engine support
-#define wxUSE_UXTHEME 1
+#define wxUSE_UXTHEME 0
// Set to 1 to auto-adapt to MS Windows XP themes where possible
// (notably, wxNotebook pages)
-#define wxUSE_UXTHEME_AUTO 1
+#define wxUSE_UXTHEME_AUTO 0
// ----------------------------------------------------------------------------
// obsolete settings
--- /dev/null
+
+/*
+ * time.h
+ * Missing time functions and structures for use under WinCE
+ */
+
+#ifndef __WINCE_TIME_
+#define __WINCE_TIME_
+
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+ };
+
+struct tm * __cdecl localtime(const time_t *);
+
+time_t __cdecl time(time_t *);
+
+time_t __cdecl mktime(struct tm *);
+
+struct tm * __cdecl gmtime(const time_t *);
+
+#define _tcsftime wcsftime
+
+size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
+ const struct tm *);
+
+extern long timezone;
+
+#endif
+
#if wxUSE_FILENAME
#include "wx/filename.h"
#endif // wxUSE_FILENAME
-#if wxUSE_FONTMAP
- #include "wx/fontmap.h"
-#endif // wxUSE_FONTMAP
#include "wx/msgout.h"
#include "wx/tokenzr.h"
#include "wx/msw/private.h" // includes windows.h for MessageBox()
#endif
+#if wxUSE_FONTMAP
+ #include "wx/fontmap.h"
+#endif // wxUSE_FONTMAP
+
#if defined(__WXMAC__)
// VZ: MacTypes.h is enough under Mac OS X (where I could test it) but
// I don't know which headers are needed under earlier systems so
#endif
#include "wx/apptrait.h"
-#if wxUSE_FONTMAP
- #include "wx/fontmap.h"
-#endif // wxUSE_FONTMAP
#include "wx/msgout.h"
#include "wx/thread.h"
#include "wx/utils.h"
+#if defined(__WXMSW__)
+ #include "wx/msw/private.h" // includes windows.h for LOGFONT
+#endif
+
+#if wxUSE_FONTMAP
+ #include "wx/fontmap.h"
+#endif // wxUSE_FONTMAP
+
// ============================================================================
// wxAppBase implementation
// ============================================================================
wxPendingEventsLocker = new wxCriticalSection;
#endif
- wxTheColourDatabase = new wxColourDatabase;
- wxTheColourDatabase->Initialize();
-
wxInitializeStockLists();
wxInitializeStockObjects();
#endif // wxUSE_PRINTING_ARCHITECTURE
#ifdef __WXMSW__
- #include <windows.h>
+ #include <windowsx.h>
#include "wx/msw/private.h"
- #if !defined(__WIN32__)
- #include <print.h>
+ #ifdef __WXWINCE__
#include <commdlg.h>
- #endif // Win16
+ #endif
#if defined(__WATCOMC__) || defined(__SYMANTEC__) || defined(__SALFORDC__)
#include <windowsx.h>
pd.lStructSize = 66;
#else
memset(&pd, 0, sizeof(PRINTDLG));
+#ifdef __WXWINCE__
+ pd.cbStruct = sizeof(PRINTDLG);
+#else
pd.lStructSize = sizeof(PRINTDLG);
+#endif
#endif
pd.hwndOwner = (HWND)NULL;
wxString strVarName(str.c_str() + n + 1, m - n - 1);
+#ifdef __WXWINCE__
+ const wxChar *pszValue = NULL;
+#else
const wxChar *pszValue = wxGetenv(strVarName);
+#endif
if ( pszValue != NULL ) {
strResult += pszValue;
}
// parse the optional width
size_t width = 0;
- while ( isdigit(*++fmt) )
+ while ( wxIsdigit(*++fmt) )
{
width *= 10;
width += *fmt - _T('0');
// using LoadLibraryEx under Win32 to avoid name clash with LoadLibrary
# ifdef __WIN32__
#ifdef _UNICODE
+#ifdef __WXWINCE__
+# define wxDllOpen(lib) ::LoadLibrary(lib)
+#else
# define wxDllOpen(lib) ::LoadLibraryExW(lib, 0, 0)
+#endif
#else
# define wxDllOpen(lib) ::LoadLibraryExA(lib, 0, 0)
#endif
// mb_str() is necessary in Unicode build
//
// "void *" cast is needed by gcc 3.1 + w32api 1.4, don't ask me why
- symbol = (void *)wxDllGetSymbol(dllHandle, name.mb_str());
+#ifdef __WXWINCE__
+ symbol = (void *) wxDllGetSymbol(dllHandle, name.c_str());
+#else
+ symbol = (void *) wxDllGetSymbol(dllHandle, name.mb_str());
+#endif
#endif // OS
typedef char tchar;
#endif
+#ifdef __WXWINCE__
+#undef LINKAGEMODE
+#define LINKAGEMODE __cdecl
+#endif
+
static wxUint16* LINKAGEMODE GetEncTable(wxFontEncoding enc)
{
for (int i = 0; encodings_list[i].table != NULL; i++)
wxUint8 c;
} CharsetItem;
-
-
extern "C" int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2)
{
return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u );
for (i = 0; i < 128; i++) m_Table[128 + i] = (tchar)in_tbl[i];
return TRUE;
}
+ // FIXME: write a substitute for bsearch
+#ifndef __WXWINCE__
else
{
CharsetItem *rev = BuildReverseTable(out_tbl);
delete[] rev;
return TRUE;
}
+#endif
+ return TRUE;
}
}
#if wxUSE_FILE
// standard
-#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#include <io.h>
#ifndef __SALFORDC__
#define NOMCX
#endif
+#elif defined(__WXMSW__) && defined(__WXWINCE__)
+ // TODO: what to include?
#elif (defined(__UNIX__) || defined(__GNUWIN32__))
#include <unistd.h>
#include <sys/stat.h>
#endif //Win/UNIX
#include <stdio.h> // SEEK_xxx constants
+
+#ifndef __WXWINCE__
#include <fcntl.h> // O_RDONLY &c
+#endif
-#ifndef __MWERKS__
+#ifdef __WXWINCE__
+// Nothing
+#elif !defined(__MWERKS__)
#include <sys/types.h> // needed for stat
#include <sys/stat.h> // stat
#elif defined(__MWERKS__) && ( defined(__WXMSW__) || defined(__MACH__) )
#include "wx/msw/mslu.h"
#endif
+#ifdef __WXWINCE__
+ #include "wx/msw/private.h"
+#endif
+
// ============================================================================
// implementation of wxFile
// ============================================================================
break;
}
+#ifdef __WXWINCE__
+ // FIXME: use CreateFile with 0 access to query the file
+ return TRUE;
+#else
return wxAccess(name, how) == 0;
+#endif
}
// ----------------------------------------------------------------------------
// Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
// int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
int fd = creat( szFileName , accessMode);
+#else
+#ifdef __WXWINCE__
+ HANDLE fileHandle = ::CreateFile(szFileName, GENERIC_WRITE, 0, NULL,
+ bOverwrite ? CREATE_ALWAYS : CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
+ 0);
+ int fd = 0;
+ if (fileHandle == INVALID_HANDLE_VALUE)
+ fd = (int) fileHandle;
+ else
+ fd = -1;
#else
int fd = wxOpen( szFileName,
O_BINARY | O_WRONLY | O_CREAT |
(bOverwrite ? O_TRUNC : O_EXCL)
ACCESS(accessMode) );
+#endif
#endif
if ( fd == -1 )
{
// open the file
bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
{
+#ifdef __WXWINCE__
+ DWORD access = 0;
+ DWORD shareMode = 0;
+ DWORD disposition = 0;
+
+ int flags = O_BINARY;
+
+ switch ( mode )
+ {
+ case read:
+ access = GENERIC_READ;
+ shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE;
+ disposition = OPEN_EXISTING;
+ break;
+
+ case write_append:
+ if ( wxFile::Exists(szFileName) )
+ {
+ access = GENERIC_READ|GENERIC_WRITE;
+ shareMode = FILE_SHARE_READ;
+ disposition = 0;
+ break;
+ }
+ //else: fall through as write_append is the same as write if the
+ // file doesn't exist
+
+ case write:
+ access = GENERIC_WRITE;
+ shareMode = 0;
+ disposition = TRUNCATE_EXISTING;
+ break;
+
+ case write_excl:
+ access = GENERIC_WRITE;
+ shareMode = 0;
+ disposition = TRUNCATE_EXISTING;
+ break;
+
+ case read_write:
+ access = GENERIC_READ|GENERIC_WRITE;
+ shareMode = 0;
+ disposition = 0;
+ break;
+ }
+
+ int fd = 0;
+ HANDLE fileHandle = ::CreateFile(szFileName, access, shareMode, NULL,
+ disposition, FILE_ATTRIBUTE_NORMAL, 0);
+ if (fileHandle == INVALID_HANDLE_VALUE)
+ fd = -1;
+ else
+ fd = (int) fileHandle;
+#else
int flags = O_BINARY;
switch ( mode )
}
int fd = wxOpen( szFileName, flags ACCESS(accessMode));
+#endif
if ( fd == -1 )
{
wxLogSysError(_("can't open file '%s'"), szFileName);
bool wxFile::Close()
{
if ( IsOpened() ) {
- if ( close(m_fd) == -1 ) {
+#ifdef __WXWINCE__
+ if (!CloseHandle((HANDLE) m_fd))
+#else
+ if ( close(m_fd) == -1 )
+#endif
+ {
wxLogSysError(_("can't close file descriptor %d"), m_fd);
m_fd = fd_invalid;
return FALSE;
{
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
-#ifdef __MWERKS__
+#ifdef __WXWINCE__
+ DWORD bytesRead = 0;
+ int iRc = 0;
+ if (ReadFile((HANDLE) m_fd, pBuf, (DWORD) nCount, & bytesRead, NULL))
+ iRc = bytesRead;
+ else
+ iRc = -1;
+#elif defined(__MWERKS__)
int iRc = ::read(m_fd, (char*) pBuf, nCount);
#else
int iRc = ::read(m_fd, pBuf, nCount);
{
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
-#ifdef __MWERKS__
+#ifdef __WXWINCE__
+ DWORD bytesRead = 0;
+ int iRc = 0;
+ if (WriteFile((HANDLE) m_fd, pBuf, (DWORD) nCount, & bytesRead, NULL))
+ iRc = bytesRead;
+ else
+ iRc = -1;
+#elif defined(__MWERKS__)
#if __MSL__ >= 0x6000
int iRc = ::write(m_fd, (void*) pBuf, nCount);
#else
bool wxFile::Flush()
{
if ( IsOpened() ) {
-#if defined(__VISUALC__) || wxHAVE_FSYNC
+#ifdef __WXWINCE__
+ // Do nothing
+#elif defined(__VISUALC__) || wxHAVE_FSYNC
if ( wxFsync(m_fd) == -1 )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
{
wxASSERT( IsOpened() );
+#ifdef __WXWINCE__
+ int origin;
+ switch ( mode ) {
+ default:
+ wxFAIL_MSG(_("unknown seek origin"));
+
+ case wxFromStart:
+ origin = FILE_BEGIN;
+ break;
+
+ case wxFromCurrent:
+ origin = FILE_CURRENT;
+ break;
+
+ case wxFromEnd:
+ origin = FILE_END;
+ break;
+ }
+
+ DWORD res = SetFilePointer((HANDLE) m_fd, ofs, 0, origin) ;
+ if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR)
+ {
+ wxLogSysError(_("can't seek on file descriptor %d"), m_fd);
+ return wxInvalidOffset;
+ }
+ else
+ return (off_t)res;
+#else
int origin;
switch ( mode ) {
default:
}
else
return (off_t)iRc;
+#endif
}
// get current off_t
{
wxASSERT( IsOpened() );
+#ifdef __WXWINCE__
+ DWORD res = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT) ;
+ if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR)
+ {
+ wxLogSysError(_("can't get seek position on file descriptor %d"), m_fd);
+ return wxInvalidOffset;
+ }
+ else
+ return (off_t)res;
+#else
int iRc = wxTell(m_fd);
if ( iRc == -1 ) {
wxLogSysError(_("can't get seek position on file descriptor %d"), m_fd);
}
else
return (off_t)iRc;
+#endif
}
// get current file length
{
wxASSERT( IsOpened() );
+#ifdef __WXWINCE__
+ DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT);
+ DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END);
+ off_t len = off1;
+
+ // Restore position
+ SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN);
+ return len;
+#else
#ifdef __VISUALC__
int iRc = _filelength(m_fd);
#else // !VC++
}
else
return (off_t)iRc;
+#endif
}
// is end of file reached?
{
wxASSERT( IsOpened() );
+#ifdef __WXWINCE__
+ DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT);
+ DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END);
+ if (off0 == off1)
+ return TRUE;
+ else
+ {
+ SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN);
+ return FALSE;
+ }
+#else
int iRc;
#if defined(__DOS__) || defined(__UNIX__) || defined(__GNUWIN32__) || defined( __MWERKS__ ) || defined(__SALFORDC__)
}
return TRUE;
+#endif
}
// ============================================================================
return FALSE;
}
- if ( wxRename(m_strTemp, m_strName) != 0 ) {
+ if ( wxRenameFile(m_strTemp, m_strName) != 0 ) {
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
return FALSE;
}
#pragma hdrstop
#endif //__BORLANDC__
-#if wxUSE_CONFIG
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/mac/private.h" // includes mac headers
#endif
+#ifdef __WXWINCE__
+#include "wx/msw/wince/time.h"
+#include "wx/msw/private.h"
+#else
#include <time.h>
+#endif
-#ifndef __MWERKS__
+#ifdef __WXWINCE__
+// Nothing
+#elif !defined(__MWERKS__)
#include <sys/types.h>
#include <sys/stat.h>
#else
#include "wx/os2/private.h"
#endif
#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
-#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
+#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__)
#include <direct.h>
#include <dos.h>
#include <io.h>
// Add paths e.g. from the PATH environment variable
void wxPathList::AddEnvList (const wxString& envVariable)
{
+ // No environment variables on WinCE
+#ifndef __WXWINCE__
static const wxChar PATH_TOKS[] =
#ifdef __WINDOWS__
/*
delete [] s;
}
+#endif
}
// Given a full filename (with path), ensure that that file can
} else
# endif
#endif
+ // No env variables on WinCE
+#ifndef __WXWINCE__
#ifdef __WXMSW__
if (*s++ == wxT('$') && (*s == wxT('{') || *s == wxT(')')))
#else
s++;
}
}
+#endif
+ // __WXWINCE__
}
/* Expand ~ and ~user */
// Handle environment
const wxChar *val = (const wxChar *) NULL;
+#ifndef __WXWINCE__
wxChar *tcp = (wxChar *) NULL;
if (envname != WXSTRINGCAST NULL && (val = wxGetenv (WXSTRINGCAST envname)) != NULL &&
(tcp = wxStrstr (dest, val)) != NULL)
wxStrcat (tcp, wxT("}"));
wxStrcat (tcp, wxFileFunctionsBuffer);
}
+#endif
// Handle User's home (ignore root homes!)
size_t len = 0;
bool
wxRenameFile (const wxString& file1, const wxString& file2)
{
- // Normal system call
+#ifndef __WXWINCE__
+ // Normal system call
if ( wxRename (file1, file2) == 0 )
return TRUE;
+#endif
// Try to copy
if (wxCopyFile(file1, file2)) {
#endif
#else // !MSW, !DOS and !OS/2 VAC++
(void)perm;
+#ifdef __WXWINCE__
+ if ( !CreateDirectory(dirname, NULL) )
+#else
if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 )
+#endif
#endif // !MSW/MSW
{
wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
{
#ifdef __VMS__
- return FALSE; //to be changed since rmdir exists in VMS7.x
+ return FALSE; //to be changed since rmdir exists in VMS7.x
#elif defined(__WXPM__)
- return (::DosDeleteDir((PSZ)dir.c_str()) == 0);
+ return (::DosDeleteDir((PSZ)dir.c_str()) == 0);
#else
-#ifdef __SALFORDC__
- return FALSE; // What to do?
+#ifdef __WXWINCE__
+ return (CreateDirectory(dir, NULL) != 0);
#else
- return (wxRmDir(OS_FILENAME(dir)) == 0);
+ return (wxRmDir(OS_FILENAME(dir)) == 0);
#endif
#endif
// copies into buf.
wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
{
+#ifdef __WXWINCE__
+ return NULL;
+#else
if ( !buf )
{
buf = new wxChar[sz + 1];
#if !wxUSE_UNICODE
#undef cbuf
#endif
+
+#endif
+ // __WXWINCE__
}
wxString wxGetCwd()
bool wxSetWorkingDirectory(const wxString& d)
{
#if defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__)
- return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
+ return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
#elif defined(__WXPM__)
- return (::DosSetCurrentDir((PSZ)d.c_str()) == 0);
+ return (::DosSetCurrentDir((PSZ)d.c_str()) == 0);
#elif defined(__WINDOWS__)
-
+
#ifdef __WIN32__
- return (bool)(SetCurrentDirectory(d) != 0);
+#ifdef __WXWINCE__
+ // No equivalent in WinCE
+ return FALSE;
#else
- // Must change drive, too.
- bool isDriveSpec = ((strlen(d) > 1) && (d[1] == ':'));
- if (isDriveSpec)
- {
- wxChar firstChar = d[0];
-
- // To upper case
- if (firstChar > 90)
- firstChar = firstChar - 32;
-
- // To a drive number
- unsigned int driveNo = firstChar - 64;
- if (driveNo > 0)
+ return (bool)(SetCurrentDirectory(d) != 0);
+#endif
+#else
+ // Must change drive, too.
+ bool isDriveSpec = ((strlen(d) > 1) && (d[1] == ':'));
+ if (isDriveSpec)
{
- unsigned int noDrives;
- _dos_setdrive(driveNo, &noDrives);
+ wxChar firstChar = d[0];
+
+ // To upper case
+ if (firstChar > 90)
+ firstChar = firstChar - 32;
+
+ // To a drive number
+ unsigned int driveNo = firstChar - 64;
+ if (driveNo > 0)
+ {
+ unsigned int noDrives;
+ _dos_setdrive(driveNo, &noDrives);
+ }
}
- }
- bool success = (chdir(WXSTRINGCAST d) == 0);
-
- return success;
+ bool success = (chdir(WXSTRINGCAST d) == 0);
+
+ return success;
#endif
-
+
#endif
}
// On non-Windows platform, probably just return the empty string.
wxString wxGetOSDirectory()
{
-#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
+#ifdef __WXWINCE__
+ return wxString(wxT("\\Windows"));
+#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
wxChar buf[256];
GetWindowsDirectory(buf, 256);
return wxString(buf);
time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename)
{
+#ifdef __WXWINCE__
+ FILETIME creationTime, lastAccessTime, lastWriteTime;
+ HANDLE fileHandle = ::CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
+ 0, FILE_ATTRIBUTE_NORMAL, 0);
+ if (fileHandle == INVALID_HANDLE_VALUE)
+ return 0;
+ else
+ {
+ if (GetFileTime(fileHandle, & creationTime, & lastAccessTime, & lastWriteTime))
+ {
+ CloseHandle(fileHandle);
+
+ wxDateTime dateTime;
+ FILETIME ftLocal;
+ if ( !::FileTimeToLocalFileTime(&lastWriteTime, &ftLocal) )
+ {
+ wxLogLastError(_T("FileTimeToLocalFileTime"));
+ }
+
+ SYSTEMTIME st;
+ if ( !::FileTimeToSystemTime(&ftLocal, &st) )
+ {
+ wxLogLastError(_T("FileTimeToSystemTime"));
+ }
+
+ dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear,
+ st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
+ return dateTime.GetTicks();
+ }
+ else
+ return 0;
+ }
+#else
wxStructStat buf;
wxStat( filename, &buf);
return buf.st_mtime;
+#endif
}
#include "wx/msw/winundef.h"
#endif
+#ifdef __WXWINCE__
+#include "wx/msw/private.h"
+#endif
+
#if defined(__WXMAC__)
#include "wx/mac/private.h" // includes mac headers
#endif
// use the directory specified by the prefix
SplitPath(prefix, &dir, &name, NULL /* extension */);
-#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
+#if defined(__WXWINCE__)
+ if (dir.empty())
+ {
+ // FIXME. Create \temp dir?
+ dir = wxT("\\");
+ }
+ path = dir + wxT("\\") + prefix;
+ int i = 1;
+ while (wxFileExists(path))
+ {
+ path = dir + wxT("\\") + prefix ;
+ path << i;
+ i ++;
+ }
+#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
#ifdef __WIN32__
if ( dir.empty() )
{
// Return the short form of the path (returns identity on non-Windows platforms)
wxString wxFileName::GetShortPath() const
{
-#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
wxString path(GetFullPath());
wxString pathOut;
DWORD sz = ::GetShortPathName(path, NULL, 0);
#include "wx/intl.h"
#endif //WX_PRECOMP
+#if defined(__WXMSW__)
+ #include "wx/msw/private.h" // includes windows.h for LOGFONT
+ #include "wx/msw/winundef.h"
+#endif
+
#include "wx/fontmap.h"
#include "wx/fmappriv.h"
#endif // WX_PRECOMP
#include "wx/gdicmn.h"
+
+#if defined(__WXMSW__)
+ #include "wx/msw/private.h" // includes windows.h for LOGFONT
+ #include "wx/msw/winundef.h"
+#endif
+
#include "wx/fontutil.h" // for wxNativeFontInfo
#include "wx/fontmap.h"
#include "wx/intl.h"
#endif // PCH
-#include "wx/fontmap.h"
-#include "wx/fmappriv.h"
-
#if wxUSE_CONFIG
#include "wx/config.h"
#endif // wxUSE_CONFIG
+#if defined(__WXMSW__)
+ #include "wx/msw/private.h" // includes windows.h for LOGFONT
+ #include "wx/msw/winundef.h"
+#endif
+
+#include "wx/fontmap.h"
+#include "wx/fmappriv.h"
#include "wx/fontutil.h"
#include "wx/msgdlg.h"
#include "wx/fontdlg.h"
void wxInitializeStockLists()
{
- wxTheBrushList = new wxBrushList;
- wxThePenList = new wxPenList;
- wxTheFontList = new wxFontList;
- wxTheBitmapList = new wxBitmapList;
+ wxTheColourDatabase = new wxColourDatabase;
+ wxTheColourDatabase->Initialize();
+
+ wxTheBrushList = new wxBrushList;
+ wxThePenList = new wxPenList;
+ wxTheFontList = new wxFontList;
+ wxTheBitmapList = new wxBitmapList;
}
void wxInitializeStockObjects ()
// OnFatalException() if necessary
#if defined(__WXMSW__) && wxUSE_ON_FATAL_EXCEPTION
+#ifdef __WXWINCE__
+// For ExitThread
+#include "wx/msw/private.h"
+#endif
+
extern unsigned long wxGlobalSEHandler();
int wxEntry(int& argc, wxChar **argv)
}
__except ( wxGlobalSEHandler() )
{
+#ifdef __WXWINCE__
+ ::ExitThread(3); // the same exit code as abort()
+#else
::ExitProcess(3); // the same exit code as abort()
+#endif
#if !defined(_MSC_VER) || _MSC_VER < 1300
// this code is unreachable but put it here to suppress warnings
#if wxUSE_INTL
// standard headers
+
+#ifndef __WXWINCE__
#include <locale.h>
+#endif
+
#include <ctype.h>
#include <stdlib.h>
#ifdef HAVE_LANGINFO_H
#include "wx/dynarray.h"
#endif // WX_PRECOMP
+#ifdef __WIN32__
+ #include "wx/msw/private.h"
+#elif defined(__UNIX_LIKE__)
+ #include "wx/fontmap.h" // for CharsetToEncoding()
+#endif
+
#include "wx/file.h"
#include "wx/tokenzr.h"
#include "wx/module.h"
#include "wx/encconv.h"
#include "wx/hashmap.h"
-#ifdef __WIN32__
- #include "wx/msw/private.h"
-#elif defined(__UNIX_LIKE__)
- #include "wx/fontmap.h" // for CharsetToEncoding()
-#endif
-
#if defined(__WXMAC__)
#include "wx/mac/private.h" // includes mac headers
#endif
// LC_PATH is a standard env var containing the search path for the .mo
// files
+#ifndef __WXWINCE__
const wxChar *pszLcPath = wxGetenv(wxT("LC_PATH"));
if ( pszLcPath != NULL )
searchPath << GetAllMsgCatalogSubdirs(pszLcPath, lang);
+#endif
#ifdef __UNIX__
// add some standard ones and the one in the tree where wxWin was installed:
wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") );
}
+#ifdef __WXWINCE__
+ // FIXME: I'm guessing here
+ wxChar localeName[256];
+ int ret = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLANGUAGE, localeName,
+ 256);
+ if (ret != 0)
+ {
+ m_pszOldLocale = wxStrdup(localeName);
+ }
+ else
+ m_pszOldLocale = NULL;
+
+ // TODO: how to find languageId
+ // SetLocaleInfo(languageId, SORT_DEFAULT, localeName);
+#else
m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale));
+#endif
+
if ( m_pszOldLocale == NULL )
wxLogError(_("locale '%s' can not be set."), szLocale);
int codepage = -1;
wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
SORT_DEFAULT);
+ // FIXME
+#ifndef __WXWINCE__
SetThreadLocale(lcid);
+#endif
// NB: we must translate LCID to CRT's setlocale string ourselves,
// because SetThreadLocale does not modify change the
// interpretation of setlocale(LC_ALL, "") call:
}
else
{
+ // FIXME
+#ifndef __WXWINCE__
retloc = wxSetlocale(LC_ALL, locale);
+#endif
#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
if (codepage == 0 && (const wxChar*)retloc == NULL)
{
}
else
{
+ // FIXME
+#ifndef __WXWINCE__
retloc = wxSetlocale(LC_ALL, wxEmptyString);
+#else
+ retloc = NULL;
+#endif
#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
if ((const wxChar*)retloc == NULL)
{
wxString wxLocale::GetSysName() const
{
+ // FIXME
+#ifndef __WXWINCE__
return wxSetlocale(LC_ALL, NULL);
+#else
+ return wxEmptyString;
+#endif
}
// clean up
// restore old locale
wxSetLocale(m_pOldLocale);
+ // FIXME
+#ifndef __WXWINCE__
wxSetlocale(LC_ALL, m_pszOldLocale);
+#endif
free((wxChar *)m_pszOldLocale); // const_cast
}
}
// sort the array
- qsort((void *)objArray,num,sizeof(wxObject *),compfunc);
+ qsort((void *)objArray,num,sizeof(wxObject *),
+#ifdef __WXWINCE__
+ (int (__cdecl *)(const void *,const void *))
+#endif
+ compfunc);
// put the sorted pointers back into the list
objPtr = objArray;
return FALSE;
}
+#ifdef __WXWINCE__
+extern "C" int __cdecl
+#else
extern "C" int LINKAGEMODE
+#endif
+
wx_comparestrings(const void *arg1, const void *arg2)
{
wxChar **s1 = (wxChar **) arg1;
#include "wx/wxchar.h"
// other standard headers
+#ifndef __WXWINCE__
#include <errno.h>
+#endif
+
#include <stdlib.h>
+
+#ifndef __WXWINCE__
#include <time.h>
+#else
+#include "wx/msw/wince/time.h"
+#endif
#if defined(__WINDOWS__)
#include "wx/msw/private.h" // includes windows.h
wxSafeShowMessage(_T("Fatal Error"), s_szBuf);
+#ifdef __WXWINCE__
+ ExitThread(3);
+#else
abort();
+#endif
}
void wxLogFatalError(const wxChar *szFormat, ...)
DoLogString(wxString(_("Fatal error: ")) + szString, t);
DoLogString(_("Program aborted."), t);
Flush();
+#ifdef __WXWINCE__
+ ExitThread(3);
+#else
abort();
+#endif
break;
case wxLOG_Error:
}
else {
// is it a function key?
- if ( current[0U] == 'f' && isdigit(current[1U]) &&
+ if ( current[0U] == 'f' && wxIsdigit(current[1U]) &&
(current.Len() == 2 ||
- (current.Len() == 3 && isdigit(current[2U]))) ) {
+ (current.Len() == 3 && wxIsdigit(current[2U]))) ) {
int n;
wxSscanf(current.c_str() + 1, wxT("%d"), &n);
#ifdef __WXMSW__
#include <windows.h>
+#include "wx/msw/private.h"
#endif
#include <stdlib.h>
#include <sys/types.h>
#endif
+#ifndef __WXWINCE__
#include <regex.h>
+#endif
#include "wx/regex.h"
#include <windows.h>
#endif
-#if defined(__WIN32__) && !defined(HAVE_FTIME) && !defined(__MWERKS__)
+#if defined(__WIN32__) && !defined(HAVE_FTIME) && !defined(__MWERKS__) && !defined(__WXWINCE__)
#define HAVE_FTIME
#endif
# undef HAVE_GETTIMEOFDAY
#endif
+#ifndef __WXWINCE__
#include <time.h>
-#ifndef __WXMAC__
+#else
+#include "wx/msw/private.h"
+#include "wx/msw/wince/time.h"
+#endif
+
+#if !defined(__WXMAC__) && !defined(__WXWINCE__)
#include <sys/types.h> // for time_t
#endif
val *= wxGetLocalTime();
// GRG: This will go soon as all WIN32 seem to have ftime
+// JACS: unfortunately not. WinCE doesn't have it.
#if defined (__WIN32__)
// If your platform/compiler needs to use two different functions
// to get ms resolution, please do NOT just shut off these warnings,
// drop me a line instead at <guille@iies.es>
+
+ // FIXME
+#ifndef __WXWINCE__
#warning "Possible clock skew bug in wxGetLocalTimeMillis()!"
+#endif
SYSTEMTIME st;
::GetLocalTime(&st);
#include "wx/msw/private.h"
#endif
+#ifndef __WXWINCE__
#include <errno.h>
+#endif
+
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
{
const wxChar *s = (const wxChar*) *this;
while(*s){
- if(!isascii(*s)) return(FALSE);
+ if(!wxIsascii(*s)) return(FALSE);
s++;
}
return(TRUE);
#include "wx/statusbr.h"
#endif // wxUSE_GUI
+#ifndef __WXWINCE__
#include <time.h>
+#else
+#include "wx/msw/wince/time.h"
+#endif
#ifndef __MWERKS__
#include <sys/types.h>
(
((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludeList(wxString((char) keyCode, 1))) ||
((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(wxString((char) keyCode, 1))) ||
- ((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) ||
+ ((m_validatorStyle & wxFILTER_ASCII) && !wxIsascii(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) ||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode)
{
// Allow for "," (French) as well as "." -- in future we should
// use wxSystemSettings or other to do better localisation
- if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ',') && (val[i] != wxT('e')) && (val[i] != wxT('E')) && (val[i] != wxT('+')) && (val[i] != wxT('-')))
+ if ((!wxIsdigit(val[i])) && (val[i] != '.') && (val[i] != ',') && (val[i] != wxT('e')) && (val[i] != wxT('E')) && (val[i] != wxT('+')) && (val[i] != wxT('-')))
return FALSE;
}
return TRUE;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <locale.h>
+
+#ifndef __WXWINCE__
#include <time.h>
+#include <locale.h>
+#else
+#include "wx/msw/wince/time.h"
+#endif
#ifndef WX_PRECOMP
#include "wx/defs.h"
return TRUE;
}
- name = strdup(inname);
+ name = wxStrdup(inname);
// theRGBRecords[] has no names with spaces, and no grey, but a
// lot of gray...
{
if ( *r != *q )
continue;
- if ( !isspace((int) (*(r - 1))) )
+ if ( !wxIsspace((int) (*(r - 1))) )
continue;
p = r;
for (;;)
// older releases don't, but it should be verified and the checks modified
// accordingly.
#if !defined(__GNUWIN32__) || (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
+#if !defined(__WXWINCE__)
#include <direct.h>
+#endif
#include <stdlib.h>
#include <ctype.h>
#endif
default:
// accept 8 bit chars too if isprint() agrees
- if ( (keycode < 255) && (isprint(keycode)) )
+ if ( (keycode < 255) && (wxIsprint(keycode)) )
return TRUE;
}
}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/msw/wince/time.cpp
+// Purpose: Implements missing time functionality for WinCE
+// Author:
+// Modified by:
+// Created: 2003-07-10
+// RCS-ID: $Id$
+// Copyright:
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "window.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include <windows.h>
+ #include "wx/msw/winundef.h"
+#endif
+
+#include "wx/msw/wince/time.h"
+
+long timezone = 0;
+
+// Hint: use GetSystemTime()
+
+struct tm * localtime(const time_t *)
+{
+ // TODO
+ return NULL;
+
+ // Possible implementation
+#if 0
+ // Localtime for WinCE
+ // By martin brown (mpatalberta@yahoo.com)
+ // This is really stupid, converting FILETIME to timeval back and
+ // forth. It assumes FILETIME and DWORDLONG are the same structure
+ // internally.
+
+ TIME_ZONE_INFORMATION pTz;
+
+ const unsigned short int __mon_yday[2][13] =
+ {
+ /* Normal years. */
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+ /* Leap years. */
+ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+ };
+
+
+ ULARGE_INTEGER _100ns;
+ ::GetTimeZoneInformation(&pTz);
+
+ // FIXME
+ _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 /* + ACE_Time_Value::FILETIME_to_timval_skew */;
+ FILETIME file_time;
+ file_time.dwLowDateTime = _100ns.LowPart;
+ file_time.dwHighDateTime = _100ns.HighPart;
+
+ FILETIME localtime;
+ SYSTEMTIME systime;
+ FileTimeToLocalFileTime (&file_time, &localtime);
+ FileTimeToSystemTime (&localtime, &systime);
+
+ res->tm_hour = systime.wHour;
+
+ if(pTz.DaylightBias!=0)
+ {
+ res->tm_isdst = 1;
+ }
+ else
+ {
+ res->tm_isdst = 1;
+ }
+
+ int iLeap;
+ iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));
+ // based on leap select which group to use
+
+ res->tm_mday = systime.wDay;
+ res->tm_min = systime.wMinute;
+ res->tm_mon = systime.wMonth;
+ res->tm_sec = systime.wSecond;
+ res->tm_wday = systime.wDayOfWeek;
+ res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;
+ res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900
+ res->tm_year = res->tm_year - 1900;
+
+ return res;
+#endif
+}
+
+time_t time(time_t *)
+{
+ // TODO
+ return 0;
+}
+
+size_t wcsftime(wchar_t *, size_t, const wchar_t *,
+ const struct tm *)
+{
+ // TODO
+ return 0;
+}
+
+time_t mktime(struct tm *)
+{
+ // TODO
+ return 0;
+}
+
+struct tm * gmtime(const time_t *)
+{
+ // TODO
+ return NULL;
+}
+