From f07dc2e2a71f2c9dc9886a67e834a1b12a14df47 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 11 Jul 2003 23:04:34 +0000 Subject: [PATCH] More WinCE mods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 1 + include/wx/msw/wince/setup.h | 2 +- src/msw/app.cpp | 13 +++++++++++-- src/msw/bitmap.cpp | 7 +++++++ src/msw/clipbrd.cpp | 10 +++------- src/msw/utils.cpp | 4 ++++ 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 61415505d4..51e07843f8 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -566,6 +566,7 @@ enum wxWIN32S, // Windows 32S API wxWIN95, // Windows 95 wxWIN386, // Watcom 32-bit supervisor modus + wxWINDOWS_CE, // Windows CE wxMGL_UNIX, // MGL with direct hardware access wxMGL_X, // MGL on X wxMGL_WIN32, // MGL on Win32 diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index 1c92f84b07..766ec52701 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -643,7 +643,7 @@ #define wxUSE_DIB_FOR_BITMAP 0 // Set this to 1 to enable wxDIB -#define wxUSE_WXDIB 1 +#define wxUSE_WXDIB 0 // ---------------------------------------------------------------------------- // common dialogs diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 8a3a74a420..bcd5771bd1 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -270,7 +270,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // program under Win9x w/o MSLU emulation layer - if so, abort right now // as it has no chance to work #if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU - if ( wxGetOsVersion() != wxWINDOWS_NT ) + if ( wxGetOsVersion() != wxWINDOWS_NT && wxGetOsVersion() != wxWINDOWS_CE ) { // note that we can use MessageBoxW() as it's implemented even under // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs @@ -278,7 +278,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) ::MessageBox ( NULL, - _T("This program uses Unicode and requires Windows NT/2000/XP.\nProgram aborted."), + _T("This program uses Unicode and requires Windows NT/2000/XP/CE.\nProgram aborted."), _T("wxWindows Fatal Error"), MB_ICONERROR | MB_OK ); @@ -302,9 +302,14 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #if wxUSE_OLE // we need to initialize OLE library +#ifdef __WXWINCE__ + if ( FAILED(::CoInitializeEx(NULL, COINIT_MULTITHREADED)) ) + wxLogError(_("Cannot initialize OLE")); +#else if ( FAILED(::OleInitialize(NULL)) ) wxLogError(_("Cannot initialize OLE")); #endif +#endif #endif // wxUSE_OLE @@ -510,7 +515,11 @@ void wxApp::CleanUp() ::DeleteObject( wxDisableButtonBrush ); #if wxUSE_OLE +#ifdef __WXWINCE__ + ::CoUninitialize(); +#else ::OleUninitialize(); +#endif #endif // for an EXE the classes are unregistered when it terminates but DLL may diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 650e66e27e..dbb6114bee 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -506,6 +506,7 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) HBITMAP hbmp; +#if wxUSE_WXDIB if ( wxShouldCreateDIB(w, h, d, hdc) ) { if ( d == -1 ) @@ -525,6 +526,7 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) GetBitmapData()->m_depth = d; } else // create a DDB +#endif { if ( d == -1 ) d = wxDisplayDepth(); @@ -776,6 +778,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc ) { +#if wxUSE_WXDIB wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ); UnRef(); @@ -835,6 +838,10 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc ) } return TRUE; +#else + // FIXME: wxWinCE doesn't support wxDIB yet + return FALSE; +#endif } wxImage wxBitmap::ConvertToImage() const diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 6cb5db6cc0..fd07c1ffa6 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -68,7 +68,7 @@ #include "wx/dataobj.h" #endif -#if wxUSE_OLE +#if wxUSE_OLE && !defined(__WXWINCE__) // use OLE clipboard #define wxUSE_OLE_CLIPBOARD 1 #else // !wxUSE_DATAOBJ @@ -80,10 +80,6 @@ #include #endif // wxUSE_OLE_CLIPBOARD -#ifdef __WIN16__ - #define memcpy hmemcpy -#endif - // =========================================================================== // implementation // =========================================================================== @@ -686,7 +682,7 @@ bool wxClipboard::AddData( wxDataObject *data ) // This didn't compile, of course // return wxSetClipboardData(data); // TODO - wxLogError("Not implemented."); + wxLogError(wxT("Not implemented.")); return FALSE; } } @@ -878,7 +874,7 @@ bool wxClipboard::GetData( wxDataObject& data ) if ( !s ) return FALSE; - textDataObject.SetText(s); + textDataObject.SetText(wxString::FromAscii(s)); delete [] s; return TRUE; diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 9b79bec3a8..aec073c7e5 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1028,6 +1028,10 @@ int wxAppTraits::GetOSVersion(int *verMaj, int *verMin) case VER_PLATFORM_WIN32_NT: s_ver = wxWINDOWS_NT; break; + + case VER_PLATFORM_WIN32_CE: + s_ver = wxWINDOWS_CE; + break; } } } -- 2.47.2