many compilation fixes for WinCE using VC8 (it now build, although still doesn't work)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-27 16:34:24 +00:00
parent d8af5b3aad
commit d6f2a8911e
24 changed files with 235 additions and 141 deletions

View File

@@ -423,14 +423,17 @@ enum wxFileKind
#define wxCRT_Lstat wxCRT_Stat #define wxCRT_Lstat wxCRT_Stat
#endif #endif
inline int wxStat(const wxString& path, wxStructStat *buf)
{ return wxCRT_Stat(path.fn_str(), buf); }
inline int wxLstat(const wxString& path, wxStructStat *buf)
{ return wxCRT_Lstat(path.fn_str(), buf); }
inline int wxAccess(const wxString& path, mode_t mode) inline int wxAccess(const wxString& path, mode_t mode)
{ return wxCRT_Access(path.fn_str(), mode); } { return wxCRT_Access(path.fn_str(), mode); }
inline int wxOpen(const wxString& path, int flags, mode_t mode) inline int wxOpen(const wxString& path, int flags, mode_t mode)
{ return wxCRT_Open(path.fn_str(), flags, mode); } { return wxCRT_Open(path.fn_str(), flags, mode); }
// FIXME-CE: provide our own implementations of the missing CRT functions
#ifndef __WXWINCE__
inline int wxStat(const wxString& path, wxStructStat *buf)
{ return wxCRT_Stat(path.fn_str(), buf); }
inline int wxLstat(const wxString& path, wxStructStat *buf)
{ return wxCRT_Lstat(path.fn_str(), buf); }
inline int wxRmDir(const wxString& path) inline int wxRmDir(const wxString& path)
{ return wxCRT_RmDir(path.fn_str()); } { return wxCRT_RmDir(path.fn_str()); }
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@@ -440,6 +443,7 @@ inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0)
inline int wxMkDir(const wxString& path, mode_t mode) inline int wxMkDir(const wxString& path, mode_t mode)
{ return wxCRT_MkDir(path.fn_str(), mode); } { return wxCRT_MkDir(path.fn_str(), mode); }
#endif #endif
#endif // !__WXWINCE__
#ifdef O_BINARY #ifdef O_BINARY
#define wxO_BINARY O_BINARY #define wxO_BINARY O_BINARY

View File

@@ -49,15 +49,13 @@ public:
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr); const wxString& name = wxListBoxNameStr);
// override base class virtuals
virtual void DoDeleteOneItem(unsigned int n);
// items may be checked // items may be checked
virtual bool IsChecked(unsigned int uiIndex) const; virtual bool IsChecked(unsigned int uiIndex) const;
virtual void Check(unsigned int uiIndex, bool bCheck = true); virtual void Check(unsigned int uiIndex, bool bCheck = true);
// public interface derived from wxListBox and lower classes // public interface derived from wxListBox and lower classes
virtual void Clear(); virtual void DoClear();
virtual void DoDeleteOneItem(unsigned int n);
virtual unsigned int GetCount() const; virtual unsigned int GetCount() const;
virtual int GetSelection() const; virtual int GetSelection() const;
virtual int GetSelections(wxArrayInt& aSelections) const; virtual int GetSelections(wxArrayInt& aSelections) const;

View File

@@ -12,12 +12,15 @@
#ifndef _WX_MSW_WINCE_CHKCONF_H_ #ifndef _WX_MSW_WINCE_CHKCONF_H_
#define _WX_MSW_WINCE_CHKCONF_H_ #define _WX_MSW_WINCE_CHKCONF_H_
// Standard SDK lacks a few things, forcefully disable them // ----------------------------------------------------------------------------
#ifdef WCE_PLATFORM_STANDARDSDK // Disable features which don't work or don't make sense under CE
// no shell functions support // ----------------------------------------------------------------------------
#undef wxUSE_STDPATHS
#define wxUSE_STDPATHS 0 // please keep the list in alphabetic order except for closely related settings
#endif // WCE_PLATFORM_STANDARDSDK // (e.g. wxUSE_ENH_METAFILE is put immediately after wxUSE_METAFILE)
#undef wxUSE_DEBUGREPORT
#define wxUSE_DEBUGREPORT 0
#if _WIN32_WCE < 400 #if _WIN32_WCE < 400
// not enough API and lack of ddraw.h // not enough API and lack of ddraw.h
@@ -25,48 +28,86 @@
#define wxUSE_DISPLAY 0 #define wxUSE_DISPLAY 0
#endif #endif
// wxFSVolume currently doesn't compile under CE and it's not clear if it makes
// sense at all there (the drives and their names are fixed on CE systems)
#undef wxUSE_FSVOLUME
#define wxUSE_FSVOLUME 0
// no .INI files API under CE
#undef wxUSE_INICONF
#define wxUSE_INICONF 0
// DDE doesn't exist under WinCE and wxIPC is DDE-based under MSW // DDE doesn't exist under WinCE and wxIPC is DDE-based under MSW
#undef wxUSE_IPC #undef wxUSE_IPC
#define wxUSE_IPC 0 #define wxUSE_IPC 0
// metafiles are not supported neither
#undef wxUSE_ENH_METAFILE
#define wxUSE_ENH_METAFILE 0
#undef wxUSE_METAFILE
#define wxUSE_METAFILE 0
// eVC doesn't support SEH
#undef wxUSE_ON_FATAL_EXCEPTION
#define wxUSE_ON_FATAL_EXCEPTION 0
#undef wxUSE_WXHTML_HELP
#define wxUSE_WXHTML_HELP 0
// libtiff and regex apparently don't compile with eVC (to check with eVC4?)
// and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't // and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't
// be enabled here // be enabled here
#undef wxUSE_LIBTIFF #undef wxUSE_LIBTIFF
#define wxUSE_LIBTIFF 0 #define wxUSE_LIBTIFF 0
// no MDI under CE
#undef wxUSE_MDI
#define wxUSE_MDI 0
#undef wxUSE_MDI_ARCHITECTURE
#define wxUSE_MDI_ARCHITECTURE 0
// metafiles are not supported neither
#undef wxUSE_METAFILE
#define wxUSE_METAFILE 0
#undef wxUSE_ENH_METAFILE
#define wxUSE_ENH_METAFILE 0
// not sure if this is supported by CE but it doesn't compile currently anyhow
#undef wxUSE_MS_HTML_HELP
#define wxUSE_MS_HTML_HELP 0
// eVC doesn't support SEH
#undef wxUSE_ON_FATAL_EXCEPTION
#define wxUSE_ON_FATAL_EXCEPTION 0
// no owner drawn controls (not sure if this is possible at all but in any case
// the code doesn't currently compile)
#undef wxUSE_OWNER_DRAWN
#define wxUSE_OWNER_DRAWN 0
// libtiff and regex apparently don't compile with eVC (to check with eVC4?)
// other MSW settings not supported by CE
#undef wxUSE_PRINTING_ARCHITECTURE
#define wxUSE_PRINTING_ARCHITECTURE 0
#undef wxUSE_REGEX #undef wxUSE_REGEX
#define wxUSE_REGEX 0 #define wxUSE_REGEX 0
#undef wxUSE_DEBUGREPORT
#define wxUSE_DEBUGREPORT 0
// other MSW settings not supported by CE
#undef wxUSE_RICHEDIT #undef wxUSE_RICHEDIT
#define wxUSE_RICHEDIT 0 #define wxUSE_RICHEDIT 0
#undef wxUSE_RICHEDIT2 #undef wxUSE_RICHEDIT2
#define wxUSE_RICHEDIT2 0 #define wxUSE_RICHEDIT2 0
#undef wxUSE_UXTHEME // Standard SDK lacks a few things, forcefully disable them
#define wxUSE_UXTHEME 0 #ifdef WCE_PLATFORM_STANDARDSDK
// no shell functions support
#undef wxUSE_STDPATHS
#define wxUSE_STDPATHS 0
#endif // WCE_PLATFORM_STANDARDSDK
// not sure if this is supported by eVC but VC8 SDK lacks the tooltips control
// related declarations
#if defined(__VISUALC__) && __VISUALC__ >= 1400
#undef wxUSE_TOOLTIPS
#define wxUSE_TOOLTIPS 0
#endif
#undef wxUSE_UNICODE_MSLU #undef wxUSE_UNICODE_MSLU
#define wxUSE_UNICODE_MSLU 0 #define wxUSE_UNICODE_MSLU 0
#undef wxUSE_UXTHEME
#define wxUSE_UXTHEME 0
#undef wxUSE_WXHTML_HELP
#define wxUSE_WXHTML_HELP 0
// Disable features which don't make sense for MS Smartphones // Disable features which don't make sense for MS Smartphones
// (due to pointer device usage, limited controls or dialogs, file system) // (due to pointer device usage, limited controls or dialogs, file system)
#if defined(__SMARTPHONE__) #if defined(__SMARTPHONE__)

View File

@@ -149,7 +149,8 @@ protected:
wxObject *clientData, wxObject *clientData,
const wxString& shortHelp, const wxString& shortHelp,
const wxString& longHelp); const wxString& longHelp);
virtual wxToolBarToolBase *CreateTool(wxControl *control); virtual wxToolBarToolBase *CreateTool(wxControl *control,
const wxString& label);
// The menubar associated with this toolbar // The menubar associated with this toolbar
wxMenuBar* m_menuBar; wxMenuBar* m_menuBar;

View File

@@ -272,43 +272,6 @@
# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) # define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) )
#endif #endif
/*
check the consistency of the settings in setup.h: note that this must be
done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
*/
#include "wx/chkconf.h"
/*
some compilers don't support iostream.h any longer, while some of theme
are not updated with <iostream> yet, so override the users setting here
in such case.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1310)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#elif defined(__DMC__) || defined(__WATCOMC__)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 1
#elif defined(__MINGW32__)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#endif /* compilers with/without iostream.h */
/*
old C++ headers (like <iostream.h>) declare classes in the global namespace
while the new, standard ones (like <iostream>) do it in std:: namespace,
unless it's an old gcc version.
using this macro allows constuctions like "wxSTD iostream" to work in
either case
*/
#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define wxSTD std::
#else
# define wxSTD
#endif
/* /*
OS: first of all, test for MS-DOS platform. We must do this before testing OS: first of all, test for MS-DOS platform. We must do this before testing
for Unix, because DJGPP compiler defines __unix__ under MS-DOS for Unix, because DJGPP compiler defines __unix__ under MS-DOS
@@ -582,6 +545,44 @@
# endif # endif
#endif #endif
/*
check the consistency of the settings in setup.h: note that this must be
done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
and after defining the compiler macros which are used in it too
*/
#include "wx/chkconf.h"
/*
some compilers don't support iostream.h any longer, while some of theme
are not updated with <iostream> yet, so override the users setting here
in such case.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1310)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#elif defined(__DMC__) || defined(__WATCOMC__)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 1
#elif defined(__MINGW32__)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#endif /* compilers with/without iostream.h */
/*
old C++ headers (like <iostream.h>) declare classes in the global namespace
while the new, standard ones (like <iostream>) do it in std:: namespace,
unless it's an old gcc version.
using this macro allows constuctions like "wxSTD iostream" to work in
either case
*/
#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define wxSTD std::
#else
# define wxSTD
#endif
/* Choose which method we will use for updating menus /* Choose which method we will use for updating menus
* - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event.
* Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN.

View File

@@ -414,6 +414,7 @@ inline int wxStricmp_String(const wxString& s1, const T& s2)
{ return s1.CmpNoCase(s2); } { return s1.CmpNoCase(s2); }
WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String)
#if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW)
// GCC 3.3 and other compilers have a bug that causes it to fail compilation if // GCC 3.3 and other compilers have a bug that causes it to fail compilation if
// the template's implementation uses overloaded function declared later (see // the template's implementation uses overloaded function declared later (see
@@ -446,6 +447,7 @@ inline int wxStrcoll_String(const wxString& s1, const T& s2)
WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
#endif #endif
#endif // defined(wxCRT_Strcoll[AW])
template<typename T> template<typename T>
inline int wxStrspn_String(const wxString& s1, const T& s2) inline int wxStrspn_String(const wxString& s1, const T& s2)
@@ -484,6 +486,8 @@ WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String)
#undef WX_STR_FUNC #undef WX_STR_FUNC
#undef WX_STR_FUNC_NO_INVERT #undef WX_STR_FUNC_NO_INVERT
#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW)
inline size_t wxStrxfrm(char *dest, const char *src, size_t n) inline size_t wxStrxfrm(char *dest, const char *src, size_t n)
{ return wxCRT_StrxfrmA(dest, src, n); } { return wxCRT_StrxfrmA(dest, src, n); }
inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n) inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n)
@@ -500,6 +504,8 @@ inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n) inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); } { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
#endif // defined(wxCRT_Strxfrm[AW])
inline char *wxStrtok(char *str, const char *delim, char **saveptr) inline char *wxStrtok(char *str, const char *delim, char **saveptr)
{ return wxCRT_StrtokA(str, delim, saveptr); } { return wxCRT_StrtokA(str, delim, saveptr); }
inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr) inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr)
@@ -852,6 +858,9 @@ WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW)
#undef WX_STRTOX_FUNC #undef WX_STRTOX_FUNC
// there is no command interpreter under CE, hence no system()
#ifndef __WXWINCE__
// mingw32 doesn't provide _tsystem() even though it provides other stdlib.h // mingw32 doesn't provide _tsystem() even though it provides other stdlib.h
// functions in their wide versions // functions in their wide versions
#ifdef wxCRT_SystemW #ifdef wxCRT_SystemW
@@ -860,6 +869,8 @@ inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); }
inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); } inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); }
#endif #endif
#endif // !__WXWINCE__/__WXWINCE__
inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); } inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); }
inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); } inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); }
inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); } inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); }
@@ -867,7 +878,6 @@ inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsChar
inline char* wxGetenv(const wxCharBuffer& name) { return wxCRT_GetenvA(name.data()); } inline char* wxGetenv(const wxCharBuffer& name) { return wxCRT_GetenvA(name.data()); }
inline wchar_t* wxGetenv(const wxWCharBuffer& name) { return wxCRT_GetenvW(name.data()); } inline wchar_t* wxGetenv(const wxWCharBuffer& name) { return wxCRT_GetenvW(name.data()); }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// time.h functions // time.h functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -34,8 +34,8 @@
#include <wctype.h> #include <wctype.h>
#include <time.h> #include <time.h>
#ifdef __WINDOWS__ #if defined(__WINDOWS__) && !defined(__WXWINCE__)
#include <io.h> #include <io.h>
#endif #endif
#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS #if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
@@ -132,7 +132,6 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
#define wxCRT_StrcatA strcat #define wxCRT_StrcatA strcat
#define wxCRT_StrchrA strchr #define wxCRT_StrchrA strchr
#define wxCRT_StrcmpA strcmp #define wxCRT_StrcmpA strcmp
#define wxCRT_StrcollA strcoll
#define wxCRT_StrcpyA strcpy #define wxCRT_StrcpyA strcpy
#define wxCRT_StrcspnA strcspn #define wxCRT_StrcspnA strcspn
#define wxCRT_StrlenA strlen #define wxCRT_StrlenA strlen
@@ -143,12 +142,10 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
#define wxCRT_StrrchrA strrchr #define wxCRT_StrrchrA strrchr
#define wxCRT_StrspnA strspn #define wxCRT_StrspnA strspn
#define wxCRT_StrstrA strstr #define wxCRT_StrstrA strstr
#define wxCRT_StrxfrmA strxfrm
#define wxCRT_StrcatW wcscat #define wxCRT_StrcatW wcscat
#define wxCRT_StrchrW wcschr #define wxCRT_StrchrW wcschr
#define wxCRT_StrcmpW wcscmp #define wxCRT_StrcmpW wcscmp
#define wxCRT_StrcollW wcscoll
#define wxCRT_StrcpyW wcscpy #define wxCRT_StrcpyW wcscpy
#define wxCRT_StrcspnW wcscspn #define wxCRT_StrcspnW wcscspn
#define wxCRT_StrncatW wcsncat #define wxCRT_StrncatW wcsncat
@@ -158,7 +155,15 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
#define wxCRT_StrrchrW wcsrchr #define wxCRT_StrrchrW wcsrchr
#define wxCRT_StrspnW wcsspn #define wxCRT_StrspnW wcsspn
#define wxCRT_StrstrW wcsstr #define wxCRT_StrstrW wcsstr
#define wxCRT_StrxfrmW wcsxfrm
/* these functions are not defined under CE, at least in VC8 CRT */
#ifndef __WXWINCE__
#define wxCRT_StrcollA strcoll
#define wxCRT_StrxfrmA strxfrm
#define wxCRT_StrcollW wcscoll
#define wxCRT_StrxfrmW wcsxfrm
#endif /* __WXWINCE__ */
/* Almost all compiler have strdup(), but not quite all: CodeWarrior under /* Almost all compiler have strdup(), but not quite all: CodeWarrior under
Mac and VC++ for Windows CE don't provide it; additionally, gcc under Mac and VC++ for Windows CE don't provide it; additionally, gcc under
@@ -413,7 +418,6 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha
#define wxCRT_Rename rename #define wxCRT_Rename rename
#else /* Unicode filenames */ #else /* Unicode filenames */
/* special case: these functions are missing under Win9x with Unicows so we /* special case: these functions are missing under Win9x with Unicows so we
have to implement them ourselves */ have to implement them ourselves */
#if wxUSE_UNICODE_MSLU #if wxUSE_UNICODE_MSLU
@@ -426,17 +430,17 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha
#define wxCRT_Remove wxMSLU__wremove #define wxCRT_Remove wxMSLU__wremove
#define wxCRT_Rename wxMSLU__wrename #define wxCRT_Rename wxMSLU__wrename
#else #else
#define wxCRT_Rename _wrename /* WinCE CRT doesn't provide these functions so use our own */
#define wxCRT_Fopen _wfopen
#define wxCRT_Freopen _wfreopen
#ifdef __WXWINCE__ #ifdef __WXWINCE__
/* carefully: wxCRT_Remove() must return 0 on success while WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src,
DeleteFile() returns 0 on error, so don't just define one as const wchar_t *dst);
the other */ WXDLLIMPEXP_BASE int wxCRT_Remove(const wchar_t *path);
int wxCRT_Remove(const wchar_t *path);
#else #else
#define wxCRT_Rename _wrename
#define wxCRT_Remove _wremove #define wxCRT_Remove _wremove
#endif #endif
#define wxCRT_Fopen _wfopen
#define wxCRT_Freopen _wfreopen
#endif #endif
#endif /* wxMBFILES/!wxMBFILES */ #endif /* wxMBFILES/!wxMBFILES */
@@ -483,11 +487,16 @@ WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream);
*/ */
#define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead #define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead
/* FIXME-CE: provide our own perror() using ::GetLastError() */
#ifndef __WXWINCE__
#define wxCRT_PerrorA perror #define wxCRT_PerrorA perror
#ifdef wxHAVE_TCHAR_SUPPORT #ifdef wxHAVE_TCHAR_SUPPORT
#define wxCRT_PerrorW _wperror #define wxCRT_PerrorW _wperror
#endif #endif
#endif /* !__WXWINCE__ */
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
stdlib.h stdlib.h
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@@ -495,8 +504,8 @@ WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream);
/* there are no env vars at all under CE, so no _tgetenv neither */ /* there are no env vars at all under CE, so no _tgetenv neither */
#ifdef __WXWINCE__ #ifdef __WXWINCE__
/* can't define as inline function as this is a C file... */ /* can't define as inline function as this is a C file... */
#define wxCRT_GetenvA(name) ((char*)NULL) #define wxCRT_GetenvA(name) (name, NULL)
#define wxCRT_GetenvW(name) ((wchar_t*)NULL) #define wxCRT_GetenvW(name) (name, NULL)
#else #else
#define wxCRT_GetenvA getenv #define wxCRT_GetenvA getenv
#ifdef _tgetenv #ifdef _tgetenv

View File

@@ -665,7 +665,7 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable()
#if wxUSE_INTL #if wxUSE_INTL
void wxAppTraitsBase::SetLocale() void wxAppTraitsBase::SetLocale()
{ {
setlocale(LC_ALL, ""); wxSetlocale(LC_ALL, "");
wxUpdateLocaleIsUtf8(); wxUpdateLocaleIsUtf8();
} }
#endif #endif

View File

@@ -2736,7 +2736,7 @@ void wxCSConv::SetName(const char *charset)
{ {
if (charset) if (charset)
{ {
m_name = strdup(charset); m_name = wxStrdup(charset);
m_deferred = true; m_deferred = true;
} }
} }

View File

@@ -142,6 +142,13 @@ bool WXDLLEXPORT wxOKlibc()
char* wxSetlocale(int category, const char *locale) char* wxSetlocale(int category, const char *locale)
{ {
#ifdef __WXWINCE__
// FIXME-CE: there is no setlocale() in CE CRT, use SetThreadLocale()?
wxUnusedVar(category);
wxUnusedVar(locale);
return NULL;
#else // !__WXWINCE__
char *rv = setlocale(category, locale); char *rv = setlocale(category, locale);
if ( locale != NULL /* setting locale, not querying */ && if ( locale != NULL /* setting locale, not querying */ &&
rv /* call was successful */ ) rv /* call was successful */ )
@@ -149,6 +156,7 @@ char* wxSetlocale(int category, const char *locale)
wxUpdateLocaleIsUtf8(); wxUpdateLocaleIsUtf8();
} }
return rv; return rv;
#endif // __WXWINCE__/!__WXWINCE__
} }
// ============================================================================ // ============================================================================
@@ -1099,15 +1107,6 @@ void *calloc( size_t num, size_t size )
#endif // __WXWINCE__ <= 211 #endif // __WXWINCE__ <= 211
#ifdef __WXWINCE__
int wxCRT_RemoveW(const wchar_t *path)
{
return ::DeleteFile(path) == 0;
}
#endif
// ============================================================================ // ============================================================================
// wxLocaleIsUtf8 // wxLocaleIsUtf8
// ============================================================================ // ============================================================================
@@ -1208,6 +1207,8 @@ int wxFputc(const wxUniChar& c, FILE *stream)
#endif #endif
} }
#ifdef wxCRT_PerrorA
void wxPerror(const wxString& s) void wxPerror(const wxString& s)
{ {
#ifdef wxCRT_PerrorW #ifdef wxCRT_PerrorW
@@ -1219,6 +1220,8 @@ void wxPerror(const wxString& s)
#endif #endif
} }
#endif // wxCRT_PerrorA
wchar_t *wxFgets(wchar_t *s, int size, FILE *stream) wchar_t *wxFgets(wchar_t *s, int size, FILE *stream)
{ {
wxCHECK_MSG( s, NULL, "empty buffer passed to wxFgets()" ); wxCHECK_MSG( s, NULL, "empty buffer passed to wxFgets()" );

View File

@@ -324,9 +324,9 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
#ifdef __WXWINCE__ #ifdef __WXWINCE__
wxString tmp = GetAppName(); wxString tmp = GetAppName();
tmp += wxT("ClassName"); tmp += wxT("ClassName");
wxCanvasClassName = wxStrdup( tmp.c_str() ); wxCanvasClassName = wxStrdup( tmp.wc_str() );
tmp += wxT("NR"); tmp += wxT("NR");
wxCanvasClassNameNR = wxStrdup( tmp.c_str() ); wxCanvasClassNameNR = wxStrdup( tmp.wc_str() );
HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL ); HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL );
if (hWnd) if (hWnd)
{ {

View File

@@ -374,6 +374,8 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
return true; return true;
#else // __WXMICROWIN__ || __WXWINCE__ #else // __WXMICROWIN__ || __WXWINCE__
wxUnusedVar(icon); wxUnusedVar(icon);
wxUnusedVar(transp);
return false; return false;
#endif // !__WXWINCE__/__WXWINCE__ #endif // !__WXWINCE__/__WXWINCE__
} }

View File

@@ -474,19 +474,20 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
const wxRect& rectButton = m_btnArea; const wxRect& rectButton = m_btnArea;
wxRect rectTextField = m_tcArea; wxRect rectTextField = m_tcArea;
const bool isEnabled = IsEnabled();
wxColour bgCol = GetBackgroundColour(); wxColour bgCol = GetBackgroundColour();
#if wxUSE_UXTHEME
const bool isEnabled = IsEnabled();
HDC hDc = GetHdcOf(dc); HDC hDc = GetHdcOf(dc);
HWND hWnd = GetHwndOf(this); HWND hWnd = GetHwndOf(this);
#if wxUSE_UXTHEME
wxUxThemeEngine* theme = NULL; wxUxThemeEngine* theme = NULL;
wxUxThemeHandle hTheme(this, L"COMBOBOX"); wxUxThemeHandle hTheme(this, L"COMBOBOX");
if ( hTheme ) if ( hTheme )
theme = wxUxThemeEngine::GetIfActive(); theme = wxUxThemeEngine::GetIfActive();
#endif #endif // wxUSE_UXTHEME
wxRect borderRect(0,0,sz.x,sz.y); wxRect borderRect(0,0,sz.x,sz.y);

View File

@@ -139,9 +139,8 @@ HMODULE wxGetModuleHandle(const char *name, void *addr)
} }
// Windows CE only has Unicode API, so even we have an ANSI string here, we // Windows CE only has Unicode API, so even we have an ANSI string here, we
// still need to use GetModuleHandleW() there and so do it everywhere to // still need to use GetModuleHandleW() there
// avoid #ifdefs -- this code is not performance-critical anyhow... #ifdef __WXWINCE__
#ifdef __WINCE__
return ::GetModuleHandleW(wxConvLibc.cMB2WC(name).data()); return ::GetModuleHandleW(wxConvLibc.cMB2WC(name).data());
#else #else
return ::GetModuleHandleA((char *)name); return ::GetModuleHandleA((char *)name);

View File

@@ -160,7 +160,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
#ifdef __WXWINCE__ #ifdef __WXWINCE__
::EnumFontFamilies(hDC, ::EnumFontFamilies(hDC,
m_facename.empty() ? NULL : m_facename.c_str(), m_facename.empty() ? NULL : m_facename.wx_str(),
(wxFONTENUMPROC)wxFontEnumeratorProc, (wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this) ; (LPARAM)this) ;
#else // __WIN32__ #else // __WIN32__

View File

@@ -759,7 +759,7 @@ void wxMenu::SetTitle(const wxString& label)
info.fMask = MIIM_TYPE; info.fMask = MIIM_TYPE;
info.fType = MFT_STRING; info.fType = MFT_STRING;
info.cch = m_title.length(); info.cch = m_title.length();
info.dwTypeData = (LPTSTR) m_title.c_str(); info.dwTypeData = wx_const_cast(wxChar *, m_title.wx_str());
if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) ) if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) )
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
@@ -948,7 +948,7 @@ WXHMENU wxMenuBar::Create()
HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu() ; HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(GetLabelTop(i)); wxString label = wxStripMenuCodes(GetLabelTop(i));
tbButton.iString = (int) label.c_str(); tbButton.iString = (int) label.wx_str();
int position = i; int position = i;
@@ -1077,7 +1077,7 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
info.fMask = MIIM_TYPE; info.fMask = MIIM_TYPE;
info.fType = MFT_STRING; info.fType = MFT_STRING;
info.cch = label.length(); info.cch = label.length();
info.dwTypeData = (LPTSTR) label.c_str(); info.dwTypeData = wx_const_cast(wxChar *, label.wx_str());
if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, & info) ) if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, & info) )
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
@@ -1185,7 +1185,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title); wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.c_str(); tbButton.iString = (int) label.wx_str();
tbButton.idCommand = NewControlId(); tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
@@ -1246,7 +1246,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title); wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.c_str(); tbButton.iString = (int) label.wx_str();
tbButton.idCommand = NewControlId(); tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))

View File

@@ -206,18 +206,10 @@ wxPenRefData::~wxPenRefData()
// wxPenRefData HPEN management // wxPenRefData HPEN management
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef wxHAVE_EXT_CREATE_PEN
static int ConvertPenStyle(int style) static int ConvertPenStyle(int style)
{ {
switch ( style ) switch ( style )
{ {
case wxDOT:
return PS_DOT;
case wxDOT_DASH:
return PS_DASHDOT;
case wxSHORT_DASH: case wxSHORT_DASH:
case wxLONG_DASH: case wxLONG_DASH:
return PS_DASH; return PS_DASH;
@@ -225,13 +217,20 @@ static int ConvertPenStyle(int style)
case wxTRANSPARENT: case wxTRANSPARENT:
return PS_NULL; return PS_NULL;
case wxUSER_DASH:
return PS_USERSTYLE;
default: default:
wxFAIL_MSG( _T("unknown pen style") ); wxFAIL_MSG( _T("unknown pen style") );
// fall through // fall through
#ifdef wxHAVE_EXT_CREATE_PEN
case wxDOT:
return PS_DOT;
case wxDOT_DASH:
return PS_DASHDOT;
case wxUSER_DASH:
return PS_USERSTYLE;
case wxSTIPPLE: case wxSTIPPLE:
case wxBDIAGONAL_HATCH: case wxBDIAGONAL_HATCH:
case wxCROSSDIAG_HATCH: case wxCROSSDIAG_HATCH:
@@ -240,10 +239,14 @@ static int ConvertPenStyle(int style)
case wxHORIZONTAL_HATCH: case wxHORIZONTAL_HATCH:
case wxVERTICAL_HATCH: case wxVERTICAL_HATCH:
case wxSOLID: case wxSOLID:
#endif // wxHAVE_EXT_CREATE_PEN
return PS_SOLID; return PS_SOLID;
} }
} }
#ifdef wxHAVE_EXT_CREATE_PEN
static int ConvertJoinStyle(int join) static int ConvertJoinStyle(int join)
{ {
switch( join ) switch( join )

View File

@@ -75,7 +75,7 @@ LONG APIENTRY _EXPORT wxAbortProc(HDC hPr, int Code);
wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data) wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data)
: wxPrinterBase(data) : wxPrinterBase(data)
{ {
m_lpAbortProc = (WXFARPROC) MakeProcInstance((FARPROC) wxAbortProc, wxGetInstance()); m_lpAbortProc = (WXFARPROC)wxAbortProc;
} }
wxWindowsPrinter::~wxWindowsPrinter() wxWindowsPrinter::~wxWindowsPrinter()

View File

@@ -76,8 +76,13 @@
#define HSAS_SORTEDDOWN 2 #define HSAS_SORTEDDOWN 2
#endif #endif
#if defined(__WXWINCE__) && !defined(DFCS_FLAT) #if defined(__WXWINCE__)
#define DFCS_FLAT 0 #ifndef DFCS_FLAT
#define DFCS_FLAT 0
#endif
#ifndef DFCS_MONO
#define DFCS_MONO 0
#endif
#endif #endif
#ifndef DFCS_HOT #ifndef DFCS_HOT

View File

@@ -120,6 +120,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
else else
msStyle |= SS_LEFT; msStyle |= SS_LEFT;
#ifdef SS_ENDELLIPSIS
// this style is necessary to receive mouse events // this style is necessary to receive mouse events
// Win NT and later have the SS_ENDELLIPSIS style which is useful to us: // Win NT and later have the SS_ENDELLIPSIS style which is useful to us:
if (wxGetOsVersion() == wxOS_WINDOWS_NT) if (wxGetOsVersion() == wxOS_WINDOWS_NT)
@@ -130,6 +131,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
if ( style & wxST_ELLIPSIZE_END ) if ( style & wxST_ELLIPSIZE_END )
msStyle |= SS_ENDELLIPSIS; msStyle |= SS_ENDELLIPSIS;
} }
#endif // SS_ENDELLIPSIS
msStyle |= SS_NOTIFY; msStyle |= SS_NOTIFY;
@@ -194,6 +196,7 @@ void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
// note: we first need to set the size and _then_ call UpdateLabel // note: we first need to set the size and _then_ call UpdateLabel
wxStaticTextBase::DoSetSize(x, y, w, h, sizeFlags); wxStaticTextBase::DoSetSize(x, y, w, h, sizeFlags);
#ifdef SS_ENDELLIPSIS
// do we need to ellipsize the contents? // do we need to ellipsize the contents?
long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE); long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE);
if ( !(styleReal & SS_ENDELLIPSIS) ) if ( !(styleReal & SS_ENDELLIPSIS) )
@@ -203,6 +206,7 @@ void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
UpdateLabel(); UpdateLabel();
} }
//else: we don't or the OS will do it for us //else: we don't or the OS will do it for us
#endif // SS_ENDELLIPSIS
// we need to refresh the window after changing its size as the standard // we need to refresh the window after changing its size as the standard
// control doesn't always update itself properly // control doesn't always update itself properly
@@ -211,6 +215,7 @@ void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
void wxStaticText::SetLabel(const wxString& label) void wxStaticText::SetLabel(const wxString& label)
{ {
#ifdef SS_ENDELLIPSIS
long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE); long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE);
if ( HasFlag(wxST_ELLIPSIZE_END) && if ( HasFlag(wxST_ELLIPSIZE_END) &&
wxGetOsVersion() == wxOS_WINDOWS_NT ) wxGetOsVersion() == wxOS_WINDOWS_NT )
@@ -231,15 +236,18 @@ void wxStaticText::SetLabel(const wxString& label)
styleReal &= ~SS_ENDELLIPSIS; styleReal &= ~SS_ENDELLIPSIS;
::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal); ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
} }
#endif // SS_ENDELLIPSIS
// this call will save the label in m_labelOrig and set it into this window // this call will save the label in m_labelOrig and set it into this window
// (through wxWindow::SetLabel) // (through wxWindow::SetLabel)
m_labelOrig = label; m_labelOrig = label;
if ((styleReal & SS_ENDELLIPSIS) == 0) #ifdef SS_ENDELLIPSIS
DoSetLabel(GetEllipsizedLabelWithoutMarkup()); if ( styleReal & SS_ENDELLIPSIS )
else
DoSetLabel(RemoveMarkup(label)); DoSetLabel(RemoveMarkup(label));
else
#endif // SS_ENDELLIPSIS
DoSetLabel(GetEllipsizedLabelWithoutMarkup());
// adjust the size of the window to fit to the label unless autoresizing is // adjust the size of the window to fit to the label unless autoresizing is
// disabled // disabled

View File

@@ -303,8 +303,10 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size)
// toolbar-specific post initialisation // toolbar-specific post initialisation
::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
#ifdef TB_SETEXTENDEDSTYLE
if ( wxApp::GetComCtl32Version() >= 471 ) if ( wxApp::GetComCtl32Version() >= 471 )
::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
#endif
return true; return true;
} }

View File

@@ -185,20 +185,17 @@ void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck)
// interface derived from wxListBox and lower classes // interface derived from wxListBox and lower classes
// -------------------------------------------------- // --------------------------------------------------
void wxCheckListBox::Clear() void wxCheckListBox::DoClear()
{ {
unsigned int n = GetCount(); unsigned int n = GetCount();
while ( n > 0 ) while ( n > 0 )
{ {
n--; n--;
Delete(n); DoDeleteOneItem(n);
} }
m_itemsClientData.Clear(); wxASSERT_MSG( IsEmpty(), _T("logic error in DoClear()") );
wxCHECK_RET( n == GetCount(),
_T("broken wxCheckListBox::Clear()") );
} }
unsigned int wxCheckListBox::GetCount() const unsigned int wxCheckListBox::GetCount() const
@@ -267,10 +264,10 @@ int wxCheckListBox::DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos, unsigned int pos,
void **clientData, wxClientDataType type) void **clientData, wxClientDataType type)
{ {
ListView_SetItemCount( GetHwnd(), GetCount() + count );
const unsigned int count = items.GetCount(); const unsigned int count = items.GetCount();
ListView_SetItemCount( GetHwnd(), GetCount() + count );
int n = wxNOT_FOUND; int n = wxNOT_FOUND;
for( unsigned int i = 0; i < count; i++ ) for( unsigned int i = 0; i < count; i++ )

View File

@@ -70,3 +70,13 @@ char *getenv(const char * WXUNUSED(name))
return NULL; return NULL;
} }
int wxCRT_Rename(const wchar_t *src, const wchar_t *dst)
{
return ::MoveFile(src, dst) ? 0 : -1;
}
int wxCRT_Remove(const wchar_t *path)
{
return ::DeleteFile(path) ? 0 : -1;
}

View File

@@ -404,7 +404,7 @@ bool wxToolMenuBar::Realize()
const wxString& label = tool->GetLabel(); const wxString& label = tool->GetLabel();
if ( !label.empty() ) if ( !label.empty() )
{ {
button.iString = (int)label.c_str(); button.iString = (int)label.wx_str();
} }
} }