From d6f2a8911e509fd9e61f881cc881a97f5aa05ae8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 27 Jul 2007 16:34:24 +0000 Subject: [PATCH] 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 --- include/wx/filefn.h | 12 +++-- include/wx/msw/wince/checklst.h | 6 +-- include/wx/msw/wince/chkconf.h | 81 +++++++++++++++++++++++++-------- include/wx/msw/wince/tbarwce.h | 3 +- include/wx/platform.h | 75 +++++++++++++++--------------- include/wx/wxcrt.h | 12 ++++- include/wx/wxcrtbase.h | 41 ++++++++++------- src/common/appbase.cpp | 2 +- src/common/strconv.cpp | 2 +- src/common/wxcrt.cpp | 21 +++++---- src/msw/app.cpp | 4 +- src/msw/bitmap.cpp | 2 + src/msw/combo.cpp | 7 +-- src/msw/dlmsw.cpp | 5 +- src/msw/fontenum.cpp | 2 +- src/msw/menu.cpp | 10 ++-- src/msw/pen.cpp | 25 +++++----- src/msw/printwin.cpp | 2 +- src/msw/renderer.cpp | 9 +++- src/msw/stattext.cpp | 14 ++++-- src/msw/tbar95.cpp | 2 + src/msw/wince/checklst.cpp | 13 ++---- src/msw/wince/crt.cpp | 10 ++++ src/msw/wince/tbarwce.cpp | 2 +- 24 files changed, 228 insertions(+), 134 deletions(-) diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 54c1fcc928..c47f40a2ca 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -423,14 +423,17 @@ enum wxFileKind #define wxCRT_Lstat wxCRT_Stat #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) { return wxCRT_Access(path.fn_str(), mode); } inline int wxOpen(const wxString& path, int flags, mode_t 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) { return wxCRT_RmDir(path.fn_str()); } #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) { return wxCRT_MkDir(path.fn_str(), mode); } #endif +#endif // !__WXWINCE__ #ifdef O_BINARY #define wxO_BINARY O_BINARY diff --git a/include/wx/msw/wince/checklst.h b/include/wx/msw/wince/checklst.h index 42cc6475db..020e9798c2 100644 --- a/include/wx/msw/wince/checklst.h +++ b/include/wx/msw/wince/checklst.h @@ -49,15 +49,13 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - // override base class virtuals - virtual void DoDeleteOneItem(unsigned int n); - // items may be checked virtual bool IsChecked(unsigned int uiIndex) const; virtual void Check(unsigned int uiIndex, bool bCheck = true); // 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 int GetSelection() const; virtual int GetSelections(wxArrayInt& aSelections) const; diff --git a/include/wx/msw/wince/chkconf.h b/include/wx/msw/wince/chkconf.h index eefc234666..987b93f953 100644 --- a/include/wx/msw/wince/chkconf.h +++ b/include/wx/msw/wince/chkconf.h @@ -12,12 +12,15 @@ #ifndef _WX_MSW_WINCE_CHKCONF_H_ #define _WX_MSW_WINCE_CHKCONF_H_ -// Standard SDK lacks a few things, forcefully disable them -#ifdef WCE_PLATFORM_STANDARDSDK - // no shell functions support - #undef wxUSE_STDPATHS - #define wxUSE_STDPATHS 0 -#endif // WCE_PLATFORM_STANDARDSDK +// ---------------------------------------------------------------------------- +// Disable features which don't work or don't make sense under CE +// ---------------------------------------------------------------------------- + +// please keep the list in alphabetic order except for closely related settings +// (e.g. wxUSE_ENH_METAFILE is put immediately after wxUSE_METAFILE) + +#undef wxUSE_DEBUGREPORT +#define wxUSE_DEBUGREPORT 0 #if _WIN32_WCE < 400 // not enough API and lack of ddraw.h @@ -25,48 +28,86 @@ #define wxUSE_DISPLAY 0 #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 #undef wxUSE_IPC #define wxUSE_IPC 0 +// and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't +// be enabled here +#undef wxUSE_LIBTIFF +#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 -#undef wxUSE_METAFILE -#define wxUSE_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 -#undef wxUSE_WXHTML_HELP -#define wxUSE_WXHTML_HELP 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?) -// and they're disabled for WinCE in build/bakefiles/{tiff|regex}.bkl so can't -// be enabled here -#undef wxUSE_LIBTIFF -#define wxUSE_LIBTIFF 0 +// other MSW settings not supported by CE +#undef wxUSE_PRINTING_ARCHITECTURE +#define wxUSE_PRINTING_ARCHITECTURE 0 #undef wxUSE_REGEX #define wxUSE_REGEX 0 -#undef wxUSE_DEBUGREPORT -#define wxUSE_DEBUGREPORT 0 - -// other MSW settings not supported by CE #undef wxUSE_RICHEDIT #define wxUSE_RICHEDIT 0 #undef wxUSE_RICHEDIT2 #define wxUSE_RICHEDIT2 0 -#undef wxUSE_UXTHEME -#define wxUSE_UXTHEME 0 +// Standard SDK lacks a few things, forcefully disable them +#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 #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 // (due to pointer device usage, limited controls or dialogs, file system) #if defined(__SMARTPHONE__) diff --git a/include/wx/msw/wince/tbarwce.h b/include/wx/msw/wince/tbarwce.h index a32bab2f4e..cb7f97f697 100644 --- a/include/wx/msw/wince/tbarwce.h +++ b/include/wx/msw/wince/tbarwce.h @@ -149,7 +149,8 @@ protected: wxObject *clientData, const wxString& shortHelp, const wxString& longHelp); - virtual wxToolBarToolBase *CreateTool(wxControl *control); + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); // The menubar associated with this toolbar wxMenuBar* m_menuBar; diff --git a/include/wx/platform.h b/include/wx/platform.h index 8de9c98979..2c1a40d943 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -272,43 +272,6 @@ # define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) #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 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 ) declare classes in the global namespace - while the new, standard ones (like ) 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 for Unix, because DJGPP compiler defines __unix__ under MS-DOS @@ -582,6 +545,44 @@ # 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 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 ) declare classes in the global namespace + while the new, standard ones (like ) 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 * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index 04fffe5a44..b1608af826 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -414,6 +414,7 @@ inline int wxStricmp_String(const wxString& s1, const T& s2) { return s1.CmpNoCase(s2); } 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 // 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) #endif +#endif // defined(wxCRT_Strcoll[AW]) template 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_NO_INVERT +#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW) + inline size_t wxStrxfrm(char *dest, const char *src, size_t n) { return wxCRT_StrxfrmA(dest, src, 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) { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); } +#endif // defined(wxCRT_Strxfrm[AW]) + inline char *wxStrtok(char *str, const char *delim, char **saveptr) { return wxCRT_StrtokA(str, delim, 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 +// there is no command interpreter under CE, hence no system() +#ifndef __WXWINCE__ + // mingw32 doesn't provide _tsystem() even though it provides other stdlib.h // functions in their wide versions #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()); } #endif +#endif // !__WXWINCE__/__WXWINCE__ + inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(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()); } @@ -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 wchar_t* wxGetenv(const wxWCharBuffer& name) { return wxCRT_GetenvW(name.data()); } - // ---------------------------------------------------------------------------- // time.h functions // ---------------------------------------------------------------------------- diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index cf590db7c3..0afdc2ec5c 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -34,8 +34,8 @@ #include #include -#ifdef __WINDOWS__ -#include +#if defined(__WINDOWS__) && !defined(__WXWINCE__) + #include #endif #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_StrchrA strchr #define wxCRT_StrcmpA strcmp -#define wxCRT_StrcollA strcoll #define wxCRT_StrcpyA strcpy #define wxCRT_StrcspnA strcspn #define wxCRT_StrlenA strlen @@ -143,12 +142,10 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrrchrA strrchr #define wxCRT_StrspnA strspn #define wxCRT_StrstrA strstr -#define wxCRT_StrxfrmA strxfrm #define wxCRT_StrcatW wcscat #define wxCRT_StrchrW wcschr #define wxCRT_StrcmpW wcscmp -#define wxCRT_StrcollW wcscoll #define wxCRT_StrcpyW wcscpy #define wxCRT_StrcspnW wcscspn #define wxCRT_StrncatW wcsncat @@ -158,7 +155,15 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrrchrW wcsrchr #define wxCRT_StrspnW wcsspn #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 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 #else /* Unicode filenames */ - /* special case: these functions are missing under Win9x with Unicows so we have to implement them ourselves */ #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_Rename wxMSLU__wrename #else - #define wxCRT_Rename _wrename - #define wxCRT_Fopen _wfopen - #define wxCRT_Freopen _wfreopen + /* WinCE CRT doesn't provide these functions so use our own */ #ifdef __WXWINCE__ - /* carefully: wxCRT_Remove() must return 0 on success while - DeleteFile() returns 0 on error, so don't just define one as - the other */ - int wxCRT_Remove(const wchar_t *path); + WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src, + const wchar_t *dst); + WXDLLIMPEXP_BASE int wxCRT_Remove(const wchar_t *path); #else + #define wxCRT_Rename _wrename #define wxCRT_Remove _wremove #endif + #define wxCRT_Fopen _wfopen + #define wxCRT_Freopen _wfreopen #endif #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 +/* FIXME-CE: provide our own perror() using ::GetLastError() */ +#ifndef __WXWINCE__ + #define wxCRT_PerrorA perror #ifdef wxHAVE_TCHAR_SUPPORT #define wxCRT_PerrorW _wperror #endif +#endif /* !__WXWINCE__ */ + /* ------------------------------------------------------------------------- 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 */ #ifdef __WXWINCE__ /* can't define as inline function as this is a C file... */ - #define wxCRT_GetenvA(name) ((char*)NULL) - #define wxCRT_GetenvW(name) ((wchar_t*)NULL) + #define wxCRT_GetenvA(name) (name, NULL) + #define wxCRT_GetenvW(name) (name, NULL) #else #define wxCRT_GetenvA getenv #ifdef _tgetenv diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 4cf7d8c3c8..339fe276c4 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -665,7 +665,7 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() #if wxUSE_INTL void wxAppTraitsBase::SetLocale() { - setlocale(LC_ALL, ""); + wxSetlocale(LC_ALL, ""); wxUpdateLocaleIsUtf8(); } #endif diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 0f54c2821f..f2364b7fc3 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -2736,7 +2736,7 @@ void wxCSConv::SetName(const char *charset) { if (charset) { - m_name = strdup(charset); + m_name = wxStrdup(charset); m_deferred = true; } } diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index 6d5c08774d..341058372d 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -142,6 +142,13 @@ bool WXDLLEXPORT wxOKlibc() 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); if ( locale != NULL /* setting locale, not querying */ && rv /* call was successful */ ) @@ -149,6 +156,7 @@ char* wxSetlocale(int category, const char *locale) wxUpdateLocaleIsUtf8(); } return rv; +#endif // __WXWINCE__/!__WXWINCE__ } // ============================================================================ @@ -1099,15 +1107,6 @@ void *calloc( size_t num, size_t size ) #endif // __WXWINCE__ <= 211 -#ifdef __WXWINCE__ -int wxCRT_RemoveW(const wchar_t *path) -{ - return ::DeleteFile(path) == 0; -} -#endif - - - // ============================================================================ // wxLocaleIsUtf8 // ============================================================================ @@ -1208,6 +1207,8 @@ int wxFputc(const wxUniChar& c, FILE *stream) #endif } +#ifdef wxCRT_PerrorA + void wxPerror(const wxString& s) { #ifdef wxCRT_PerrorW @@ -1219,6 +1220,8 @@ void wxPerror(const wxString& s) #endif } +#endif // wxCRT_PerrorA + wchar_t *wxFgets(wchar_t *s, int size, FILE *stream) { wxCHECK_MSG( s, NULL, "empty buffer passed to wxFgets()" ); diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 682a3b3b29..537b447d18 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -324,9 +324,9 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #ifdef __WXWINCE__ wxString tmp = GetAppName(); tmp += wxT("ClassName"); - wxCanvasClassName = wxStrdup( tmp.c_str() ); + wxCanvasClassName = wxStrdup( tmp.wc_str() ); tmp += wxT("NR"); - wxCanvasClassNameNR = wxStrdup( tmp.c_str() ); + wxCanvasClassNameNR = wxStrdup( tmp.wc_str() ); HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL ); if (hWnd) { diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index b942d9d61f..875fe9ff6a 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -374,6 +374,8 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, return true; #else // __WXMICROWIN__ || __WXWINCE__ wxUnusedVar(icon); + wxUnusedVar(transp); + return false; #endif // !__WXWINCE__/__WXWINCE__ } diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 235fd668fa..04e430c428 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -474,19 +474,20 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) const wxRect& rectButton = m_btnArea; wxRect rectTextField = m_tcArea; - const bool isEnabled = IsEnabled(); wxColour bgCol = GetBackgroundColour(); +#if wxUSE_UXTHEME + const bool isEnabled = IsEnabled(); + HDC hDc = GetHdcOf(dc); HWND hWnd = GetHwndOf(this); -#if wxUSE_UXTHEME wxUxThemeEngine* theme = NULL; wxUxThemeHandle hTheme(this, L"COMBOBOX"); if ( hTheme ) theme = wxUxThemeEngine::GetIfActive(); -#endif +#endif // wxUSE_UXTHEME wxRect borderRect(0,0,sz.x,sz.y); diff --git a/src/msw/dlmsw.cpp b/src/msw/dlmsw.cpp index 18a819d796..39830797dc 100644 --- a/src/msw/dlmsw.cpp +++ b/src/msw/dlmsw.cpp @@ -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 - // still need to use GetModuleHandleW() there and so do it everywhere to - // avoid #ifdefs -- this code is not performance-critical anyhow... -#ifdef __WINCE__ + // still need to use GetModuleHandleW() there +#ifdef __WXWINCE__ return ::GetModuleHandleW(wxConvLibc.cMB2WC(name).data()); #else return ::GetModuleHandleA((char *)name); diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index cf3623766b..6833fec31b 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -160,7 +160,7 @@ void wxFontEnumeratorHelper::DoEnumerate() #ifdef __WXWINCE__ ::EnumFontFamilies(hDC, - m_facename.empty() ? NULL : m_facename.c_str(), + m_facename.empty() ? NULL : m_facename.wx_str(), (wxFONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this) ; #else // __WIN32__ diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index ad2f91eac1..596d2a9f84 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -759,7 +759,7 @@ void wxMenu::SetTitle(const wxString& label) info.fMask = MIIM_TYPE; info.fType = MFT_STRING; 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) ) { wxLogLastError(wxT("SetMenuItemInfo")); @@ -948,7 +948,7 @@ WXHMENU wxMenuBar::Create() HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu() ; tbButton.dwData = (DWORD)hPopupMenu; wxString label = wxStripMenuCodes(GetLabelTop(i)); - tbButton.iString = (int) label.c_str(); + tbButton.iString = (int) label.wx_str(); int position = i; @@ -1077,7 +1077,7 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label) info.fMask = MIIM_TYPE; info.fType = MFT_STRING; 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) ) { wxLogLastError(wxT("SetMenuItemInfo")); @@ -1185,7 +1185,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; tbButton.dwData = (DWORD)hPopupMenu; wxString label = wxStripMenuCodes(title); - tbButton.iString = (int) label.c_str(); + tbButton.iString = (int) label.wx_str(); tbButton.idCommand = NewControlId(); 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() ; tbButton.dwData = (DWORD)hPopupMenu; wxString label = wxStripMenuCodes(title); - tbButton.iString = (int) label.c_str(); + tbButton.iString = (int) label.wx_str(); tbButton.idCommand = NewControlId(); if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index cd58107ac9..a43d02b14d 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -206,18 +206,10 @@ wxPenRefData::~wxPenRefData() // wxPenRefData HPEN management // ---------------------------------------------------------------------------- -#ifdef wxHAVE_EXT_CREATE_PEN - static int ConvertPenStyle(int style) { switch ( style ) { - case wxDOT: - return PS_DOT; - - case wxDOT_DASH: - return PS_DASHDOT; - case wxSHORT_DASH: case wxLONG_DASH: return PS_DASH; @@ -225,13 +217,20 @@ static int ConvertPenStyle(int style) case wxTRANSPARENT: return PS_NULL; - case wxUSER_DASH: - return PS_USERSTYLE; - default: wxFAIL_MSG( _T("unknown pen style") ); // 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 wxBDIAGONAL_HATCH: case wxCROSSDIAG_HATCH: @@ -240,10 +239,14 @@ static int ConvertPenStyle(int style) case wxHORIZONTAL_HATCH: case wxVERTICAL_HATCH: case wxSOLID: +#endif // wxHAVE_EXT_CREATE_PEN + return PS_SOLID; } } +#ifdef wxHAVE_EXT_CREATE_PEN + static int ConvertJoinStyle(int join) { switch( join ) diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index 975a0936fd..310db919dd 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -75,7 +75,7 @@ LONG APIENTRY _EXPORT wxAbortProc(HDC hPr, int Code); wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data) : wxPrinterBase(data) { - m_lpAbortProc = (WXFARPROC) MakeProcInstance((FARPROC) wxAbortProc, wxGetInstance()); + m_lpAbortProc = (WXFARPROC)wxAbortProc; } wxWindowsPrinter::~wxWindowsPrinter() diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index 4d7b390127..7961dc3184 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -76,8 +76,13 @@ #define HSAS_SORTEDDOWN 2 #endif -#if defined(__WXWINCE__) && !defined(DFCS_FLAT) - #define DFCS_FLAT 0 +#if defined(__WXWINCE__) + #ifndef DFCS_FLAT + #define DFCS_FLAT 0 + #endif + #ifndef DFCS_MONO + #define DFCS_MONO 0 + #endif #endif #ifndef DFCS_HOT diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index f0252e1fc4..2df67c28b8 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -120,6 +120,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const else msStyle |= SS_LEFT; +#ifdef SS_ENDELLIPSIS // this style is necessary to receive mouse events // Win NT and later have the SS_ENDELLIPSIS style which is useful to us: if (wxGetOsVersion() == wxOS_WINDOWS_NT) @@ -130,6 +131,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const if ( style & wxST_ELLIPSIZE_END ) msStyle |= SS_ENDELLIPSIS; } +#endif // SS_ENDELLIPSIS 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 wxStaticTextBase::DoSetSize(x, y, w, h, sizeFlags); +#ifdef SS_ENDELLIPSIS // do we need to ellipsize the contents? long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE); if ( !(styleReal & SS_ENDELLIPSIS) ) @@ -203,6 +206,7 @@ void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags) UpdateLabel(); } //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 // 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) { +#ifdef SS_ENDELLIPSIS long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE); if ( HasFlag(wxST_ELLIPSIZE_END) && wxGetOsVersion() == wxOS_WINDOWS_NT ) @@ -231,15 +236,18 @@ void wxStaticText::SetLabel(const wxString& label) styleReal &= ~SS_ENDELLIPSIS; ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal); } +#endif // SS_ENDELLIPSIS // this call will save the label in m_labelOrig and set it into this window // (through wxWindow::SetLabel) m_labelOrig = label; - if ((styleReal & SS_ENDELLIPSIS) == 0) - DoSetLabel(GetEllipsizedLabelWithoutMarkup()); - else +#ifdef SS_ENDELLIPSIS + if ( styleReal & SS_ENDELLIPSIS ) DoSetLabel(RemoveMarkup(label)); + else +#endif // SS_ENDELLIPSIS + DoSetLabel(GetEllipsizedLabelWithoutMarkup()); // adjust the size of the window to fit to the label unless autoresizing is // disabled diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 2a9a61007e..54547adf94 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -303,8 +303,10 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) // toolbar-specific post initialisation ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); +#ifdef TB_SETEXTENDEDSTYLE if ( wxApp::GetComCtl32Version() >= 471 ) ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); +#endif return true; } diff --git a/src/msw/wince/checklst.cpp b/src/msw/wince/checklst.cpp index d5f5274921..334f86fd51 100644 --- a/src/msw/wince/checklst.cpp +++ b/src/msw/wince/checklst.cpp @@ -185,20 +185,17 @@ void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) // interface derived from wxListBox and lower classes // -------------------------------------------------- -void wxCheckListBox::Clear() +void wxCheckListBox::DoClear() { unsigned int n = GetCount(); while ( n > 0 ) { n--; - Delete(n); + DoDeleteOneItem(n); } - m_itemsClientData.Clear(); - - wxCHECK_RET( n == GetCount(), - _T("broken wxCheckListBox::Clear()") ); + wxASSERT_MSG( IsEmpty(), _T("logic error in DoClear()") ); } unsigned int wxCheckListBox::GetCount() const @@ -267,10 +264,10 @@ int wxCheckListBox::DoInsertItems(const wxArrayStringsAdapter & items, unsigned int pos, void **clientData, wxClientDataType type) { - ListView_SetItemCount( GetHwnd(), GetCount() + count ); - const unsigned int count = items.GetCount(); + ListView_SetItemCount( GetHwnd(), GetCount() + count ); + int n = wxNOT_FOUND; for( unsigned int i = 0; i < count; i++ ) diff --git a/src/msw/wince/crt.cpp b/src/msw/wince/crt.cpp index 2b283f0e95..29e1cb7019 100644 --- a/src/msw/wince/crt.cpp +++ b/src/msw/wince/crt.cpp @@ -70,3 +70,13 @@ char *getenv(const char * WXUNUSED(name)) 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; +} + diff --git a/src/msw/wince/tbarwce.cpp b/src/msw/wince/tbarwce.cpp index 0ff004bae3..4a2220009b 100644 --- a/src/msw/wince/tbarwce.cpp +++ b/src/msw/wince/tbarwce.cpp @@ -404,7 +404,7 @@ bool wxToolMenuBar::Realize() const wxString& label = tool->GetLabel(); if ( !label.empty() ) { - button.iString = (int)label.c_str(); + button.iString = (int)label.wx_str(); } } -- 2.45.2