From 4676948b6814c97b93c431a8cbcd8c0352c87ba9 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 11 Jul 2003 21:50:07 +0000 Subject: [PATCH] More WinCE mods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fmapbase.cpp | 11 +- src/common/string.cpp | 4 + src/common/utilscmn.cpp | 19 +++- src/common/valtext.cpp | 4 + src/common/wxchar.cpp | 11 +- src/common/xpmdecod.cpp | 6 ++ src/generic/dirctrlg.cpp | 19 ++-- src/generic/grid.cpp | 8 +- src/generic/logg.cpp | 9 ++ src/generic/scrlwing.cpp | 2 + src/msw/app.cpp | 13 +-- src/msw/bitmap.cpp | 215 ++++++++++++++++++++++++++++++++++++++- src/msw/bmpbuttn.cpp | 19 ++-- src/msw/brush.cpp | 10 +- src/msw/button.cpp | 29 +++--- src/msw/checklst.cpp | 6 ++ src/msw/clipbrd.cpp | 27 ++--- src/msw/colordlg.cpp | 8 +- src/msw/combobox.cpp | 2 + src/msw/control.cpp | 6 ++ src/msw/dc.cpp | 73 +++++++++++-- src/msw/dcprint.cpp | 8 ++ src/msw/dib.cpp | 5 + src/msw/dir.cpp | 6 +- src/msw/dirdlg.cpp | 11 ++ src/msw/dragimag.cpp | 8 ++ src/msw/fdrepdlg.cpp | 2 +- src/msw/filedlg.cpp | 2 +- src/msw/fontdlg.cpp | 5 +- src/msw/fontenum.cpp | 9 +- src/msw/frame.cpp | 44 ++++++-- src/msw/gdiimage.cpp | 26 ++++- src/msw/gdiobj.cpp | 1 - src/msw/imaglist.cpp | 4 + src/msw/listbox.cpp | 6 +- src/msw/main.cpp | 10 ++ src/msw/menu.cpp | 49 ++++++++- src/msw/menuitem.cpp | 21 ++++ src/msw/msgdlg.cpp | 2 + src/msw/nativdlg.cpp | 6 +- src/msw/ole/automtn.cpp | 12 ++- src/msw/ole/dataobj.cpp | 26 ++++- src/msw/ole/dropsrc.cpp | 4 +- src/msw/ole/droptgt.cpp | 11 +- src/msw/ole/oleutils.cpp | 17 +++- src/msw/pen.cpp | 7 +- src/msw/popupwin.cpp | 6 ++ src/msw/radiobox.cpp | 17 +++- src/msw/region.cpp | 4 +- src/msw/registry.cpp | 39 ++++++- src/msw/scrolbar.cpp | 20 +++- src/msw/settings.cpp | 26 ++++- src/msw/slider95.cpp | 6 +- src/msw/statbmp.cpp | 2 + src/msw/statbox.cpp | 10 +- src/msw/statbr95.cpp | 2 + src/msw/statline.cpp | 7 +- src/msw/tabctrl.cpp | 8 +- src/msw/taskbar.cpp | 10 +- src/msw/textctrl.cpp | 3 + src/msw/thread.cpp | 11 +- src/msw/timer.cpp | 15 ++- src/msw/toplevel.cpp | 39 ++++++- src/msw/utils.cpp | 43 ++++++-- src/msw/utilsexc.cpp | 34 ++++--- src/msw/utilsgui.cpp | 14 +++ src/msw/wave.cpp | 18 ++-- src/msw/wince/time.cpp | 10 +- src/msw/window.cpp | 1 + 69 files changed, 953 insertions(+), 195 deletions(-) diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index fa6dcd0d65..83e91e7016 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -43,7 +43,8 @@ #include "wx/apptrait.h" #include "wx/module.h" -#if wxUSE_CONFIG +// wxMemoryConfig uses wxFileConfig +#if wxUSE_CONFIG && wxUSE_FILECONFIG #include "wx/config.h" #include "wx/memconf.h" #endif @@ -197,7 +198,7 @@ wxFontMapper *wxFontMapperBase::sm_instance = NULL; wxFontMapperBase::wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG m_config = NULL; m_configIsDummy = FALSE; #endif // wxUSE_CONFIG @@ -205,7 +206,7 @@ wxFontMapperBase::wxFontMapperBase() wxFontMapperBase::~wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG if ( m_configIsDummy ) delete m_config; #endif // wxUSE_CONFIG @@ -244,7 +245,7 @@ wxFontMapper *wxFontMapperBase::Set(wxFontMapper *mapper) return old; } -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG // ---------------------------------------------------------------------------- // config usage customisation @@ -365,7 +366,7 @@ wxFontMapperBase::CharsetToEncoding(const wxString& charset, // we're going to modify it, make a copy wxString cs = charset; -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG // first try the user-defined settings wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH); if ( path.IsOk() ) diff --git a/src/common/string.cpp b/src/common/string.cpp index 29d51e71b8..37bda6581e 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1013,6 +1013,10 @@ wxString::Replace(const wxChar *szOld, const wxChar *szNew, bool bReplaceAll) return uiCount; } +#ifdef __WXWINCE__ +inline int isascii(wxChar c) { return (c >= 0) && (c <=127); } +#endif + bool wxString::IsAscii() const { const wxChar *s = (const wxChar*) *this; diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 3a131a372f..ff9c48807c 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -54,6 +54,10 @@ #include "wx/process.h" #include "wx/txtstrm.h" +#if defined(__WXWINCE__) && wxUSE_DATETIME +#include "wx/datetime.h" +#endif + #include #include #include @@ -79,15 +83,11 @@ #include "wx/msw/wince/time.h" #endif -#ifndef __MWERKS__ +#if !defined(__MWERKS__) && !defined(__WXWINCE__) #include #include #endif -#ifdef __SALFORDC__ - #include -#endif - #ifdef __WXMSW__ #include "wx/msw/private.h" #endif @@ -263,10 +263,19 @@ wxString wxDecToHex(int dec) // Return the current date/time wxString wxNow() { +#ifdef __WXWINCE__ +#if wxUSE_DATETIME + wxDateTime now = wxDateTime::Now(); + return now.Format(); +#else + return wxEmptyString; +#endif +#else time_t now = time((time_t *) NULL); char *date = ctime(&now); date[24] = '\0'; return wxString::FromAscii(date); +#endif } const wxChar *wxGetInstallPrefix() diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 16dadf77a5..c90e197703 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -229,6 +229,10 @@ void wxTextValidator::SetExcludeList(const wxStringList& list) m_excludeList = list; } +#ifdef __WXWINCE__ +inline int isascii(wxChar c) { return (c >= 0) && (c <=127); } +#endif + void wxTextValidator::OnChar(wxKeyEvent& event) { /* diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index eaa2b5b4e7..02ca10af2f 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -1260,7 +1260,16 @@ WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath) #ifndef wxAtof double WXDLLEXPORT wxAtof(const wxChar *psz) { - return atof(wxConvLocal.cWX2MB(psz)); +#ifdef __WXWINCE__ + double d; + wxString str(psz); + if (str.ToDouble(& d)) + return d; + else + return 0.0; +#else + return atof(wxConvLocal.cWX2MB(psz)); +#endif } #endif diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index f3cd26aa0b..b97af0c98b 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -551,7 +551,13 @@ static bool GetRGBFromName(const char *inname, bool *isNone, return TRUE; } +#ifdef __WXWINCE__ + // TODO: is this right? How come it compiles on other + // platforms? + name = (char*) wxStrdup((wxChar*) inname); +#else name = wxStrdup(inname); +#endif // theRGBRecords[] has no names with spaces, and no grey, but a // lot of gray... diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 08e424f7d7..2389927c24 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -112,7 +112,12 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI { #if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__) -#ifdef __WIN32__ +#ifdef __WXWINCE__ + // No logical drives; return "\" + paths.Add(wxT("\\")); + names.Add(wxT("\\")); + return 1; +#elif defined(__WIN32__) wxChar driveBuffer[256]; size_t n = (size_t) GetLogicalDriveStrings(255, driveBuffer); size_t i = 0; @@ -292,7 +297,9 @@ bool wxIsDriveAvailable(const wxString& dirName) int setdrive(int drive) { -#if defined(__GNUWIN32__) && \ +#ifdef __WXWINCE__ + return 0; +#elif defined(__GNUWIN32__) && \ (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) return _chdrive(drive); #else @@ -304,11 +311,7 @@ int setdrive(int drive) newdrive[1] = wxT(':'); newdrive[2] = wxT('\0'); #if defined(__WXMSW__) -#ifdef __WIN16__ - if (wxSetWorkingDirectory(newdrive)) -#else if (::SetCurrentDirectory(newdrive)) -#endif #else // VA doesn't know what LPSTR is and has its own set if (DosSetCurrentDir((PSZ)newdrive)) @@ -321,6 +324,9 @@ int setdrive(int drive) bool wxIsDriveAvailable(const wxString& dirName) { +#ifdef __WXWINCE__ + return FALSE; +#else #ifdef __WIN32__ UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif @@ -350,6 +356,7 @@ bool wxIsDriveAvailable(const wxString& dirName) #endif return success; +#endif } #endif // __WINDOWS__ || __WXPM__ diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4b9fbf9958..f689374935 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -911,7 +911,7 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event) return TRUE; default: - if ( (keycode < 128) && isdigit(keycode) ) + if ( (keycode < 128) && wxIsdigit(keycode) ) return TRUE; } } @@ -924,7 +924,7 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event) if ( !HasRange() ) { int keycode = event.GetKeyCode(); - if ( isdigit(keycode) || keycode == '+' || keycode == '-' + if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-' || keycode == WXK_NUMPAD0 || keycode == WXK_NUMPAD1 || keycode == WXK_NUMPAD2 @@ -1064,7 +1064,7 @@ void wxGridCellFloatEditor::Reset() void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event) { int keycode = event.GetKeyCode(); - if ( isdigit(keycode) || keycode == '+' || keycode == '-' || keycode == '.' + if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-' || keycode == '.' || keycode == WXK_NUMPAD0 || keycode == WXK_NUMPAD1 || keycode == WXK_NUMPAD2 @@ -1166,7 +1166,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) default: // additionally accept 'e' as in '1e+6' if ( (keycode < 128) && - (isdigit(keycode) || tolower(keycode) == 'e') ) + (wxIsdigit(keycode) || tolower(keycode) == 'e') ) return TRUE; } } diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index b56c4ef1cd..67bd5716b9 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -86,6 +86,10 @@ // allows to exclude the usage of wxDateTime static wxString TimeStamp(const wxChar *format, time_t t) { +#ifdef __WXWINCE__ + // FIXME + return wxEmptyString; +#else wxChar buf[4096]; if ( !wxStrftime(buf, WXSIZEOF(buf), format, localtime(&t)) ) { @@ -93,6 +97,7 @@ static wxString TimeStamp(const wxChar *format, time_t t) wxFAIL_MSG(_T("strftime() failed")); } return wxString(buf); +#endif } @@ -198,7 +203,11 @@ void wxVLogStatus(wxFrame *pFrame, const wxChar *szFormat, va_list argptr) wxASSERT( gs_pFrame == NULL ); // should be reset! gs_pFrame = pFrame; +#ifdef __WXWINCE__ + wxLog::OnLog(wxLOG_Status, msg, 0); +#else wxLog::OnLog(wxLOG_Status, msg, time(NULL)); +#endif gs_pFrame = (wxFrame *) NULL; } } diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 9ab5ebe316..a138011f0e 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -1263,11 +1263,13 @@ wxGenericScrolledWindow::MSWWindowProc(WXUINT nMsg, { long rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam); +#ifndef __WXWINCE__ // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) { rc |= DLGC_WANTARROWS; } +#endif return rc; } diff --git a/src/msw/app.cpp b/src/msw/app.cpp index ebacad3d1b..8a3a74a420 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -111,7 +111,7 @@ #if _WIN32_IE >= 0x0300 && \ (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \ - !defined(__CYGWIN__) + !defined(__CYGWIN__) && !defined(__WXWINCE__) #include #endif @@ -120,7 +120,8 @@ // --------------------------------------------------------------------------- extern wxList WXDLLEXPORT wxPendingDelete; -#ifndef __WXMICROWIN__ + +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) extern void wxSetKeyboardHook(bool doIt); #endif @@ -316,7 +317,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) RegisterWindowClasses(); -#ifndef __WXMICROWIN__ +#if defined(__WXMICROWIN__) && !defined(__WXWINCE__) // Create the brush for disabling bitmap buttons LOGBRUSH lb; @@ -344,7 +345,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) if (wxDummyChar) wxDummyChar++; #endif -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(TRUE); #endif @@ -497,7 +498,7 @@ bool wxApp::UnregisterWindowClasses() void wxApp::CleanUp() { -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(FALSE); #endif @@ -877,7 +878,7 @@ typedef HRESULT (CALLBACK* WXADLLGETVERSIONPROC)(WXADLLVERSIONINFO *); /* static */ int wxApp::GetComCtl32Version() { -#ifdef __WXMICROWIN__ +#if defined(__WXMICROWIN__) || defined(__WXWINCE__) return 0; #else // cache the result diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index e6419cac7e..650e66e27e 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -43,7 +43,7 @@ #include "wx/msw/private.h" #include "wx/log.h" -#if !defined(__WXMICROWIN__) +#if wxUSE_WXDIB #include "wx/msw/dib.h" #endif @@ -102,10 +102,12 @@ public: wxDC *m_selectedInto; #endif // __WXDEBUG__ +#if wxUSE_WXDIB // when GetRawData() is called for a DDB we need to convert it to a DIB // first to be able to provide direct access to it and we cache that DIB // here and convert it back to DDB when UngetRawData() is called wxDIB *m_dib; +#endif // true if we have alpha transparency info and can be drawn using // AlphaBlend() @@ -141,6 +143,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) // decide whether we should create a DIB or a DDB for the given parameters static bool wxShouldCreateDIB(int w, int h, int d, WXHDC hdc) { +#if wxUSE_WXDIB // here is the logic: // // (a) if hdc is specified, the caller explicitly wants DDB @@ -160,6 +163,9 @@ static bool wxShouldCreateDIB(int w, int h, int d, WXHDC hdc) (d >= 24 || (d == -1 && wxDIB::GetLineSize(w, wxDisplayDepth())*h > 16*1024*1024)); +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -174,7 +180,9 @@ wxBitmapRefData::wxBitmapRefData() m_bitmapMask = NULL; m_hBitmap = (WXHBITMAP) NULL; +#if wxUSE_WXDIB m_dib = NULL; +#endif m_isDIB = m_hasAlpha = FALSE; @@ -185,7 +193,9 @@ void wxBitmapRefData::Free() wxASSERT_MSG( !m_selectedInto, wxT("deleting bitmap still selected into wxMemoryDC") ); +#if wxUSE_WXDIB wxASSERT_MSG( !m_dib, _T("forgot to call wxBitmap::UngetRawData()!") ); +#endif if ( m_hBitmap) { @@ -218,7 +228,7 @@ wxGDIImageRefData *wxBitmap::CreateData() const bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) { -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) // it may be either HICON or HCURSOR HICON hicon = (HICON)icon.GetHandle(); @@ -322,6 +332,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) #endif // Win16/Win32 } +#if wxUSE_WXDIB bool wxBitmap::CopyFromDIB(const wxDIB& dib) { wxCHECK_MSG( dib.IsOk(), FALSE, _T("invalid DIB in CopyFromDIB") ); @@ -353,6 +364,7 @@ bool wxBitmap::CopyFromDIB(const wxDIB& dib) return TRUE; } +#endif wxBitmap::~wxBitmap() { @@ -827,6 +839,198 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc ) wxImage wxBitmap::ConvertToImage() const { + // FIXME: this is untested code for WinCE, and + // the mask is not yet handled. + // For tips, see: + // http://www.codeproject.com/bitmap/dibsection.asp?print=true + +#ifdef __WXWINCE__ + // the colour used as transparent one in wxImage and the one it is replaced + // with when it really occurs in the bitmap + static const int MASK_RED = 1; + static const int MASK_GREEN = 2; + static const int MASK_BLUE = 3; + static const int MASK_BLUE_REPLACEMENT = 2; + + wxImage image; + + wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); + + // create an wxImage object + int width = GetWidth(); + int height = GetHeight(); + image.Create( width, height ); + unsigned char *data = image.GetData(); + if( !data ) + { + wxFAIL_MSG( wxT("could not allocate data for image") ); + return wxNullImage; + } + + // calc the number of bytes per scanline and padding in the DIB + int bytePerLine = width*3; + int sizeDWORD = sizeof( DWORD ); + int lineBoundary = bytePerLine % sizeDWORD; + int padding = 0; + if( lineBoundary > 0 ) + { + padding = sizeDWORD - lineBoundary; + bytePerLine += padding; + } + + // create a DIB header + int headersize = sizeof(BITMAPINFOHEADER); + BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize ); + if( !lpDIBh ) + { + wxFAIL_MSG( wxT("could not allocate data for DIB header") ); + free( data ); + return wxNullImage; + } + // Fill in the DIB header + lpDIBh->bmiHeader.biSize = headersize; + lpDIBh->bmiHeader.biWidth = width; + lpDIBh->bmiHeader.biHeight = -height; + lpDIBh->bmiHeader.biSizeImage = bytePerLine * height; + lpDIBh->bmiHeader.biPlanes = 1; + lpDIBh->bmiHeader.biBitCount = 24; + lpDIBh->bmiHeader.biCompression = BI_RGB; + lpDIBh->bmiHeader.biClrUsed = 0; + // These seem not really needed for our purpose here. + lpDIBh->bmiHeader.biClrImportant = 0; + lpDIBh->bmiHeader.biXPelsPerMeter = 0; + lpDIBh->bmiHeader.biYPelsPerMeter = 0; + + // memory for DIB data is allocated by CreateDIBSection + void *lpBits = NULL; + + // copy data from the device-dependent bitmap to the DIB + HDC hdc = ::GetDC(NULL); + HBITMAP hBitmap = (HBITMAP) GetHBITMAP(); + + HBITMAP hBitmapSection = ::CreateDIBSection( hdc, lpDIBh, DIB_RGB_COLORS, & lpBits, NULL, 0 ); + if (!hBitmapSection) + { + wxFAIL_MSG( wxT("could not create a DIB section") ); + return wxNullImage; + } + + // Copy the image from the DDB to the DIBSection + // Need to copy the supplied bitmap onto the newly created DIBsection + HDC hMemDC = CreateCompatibleDC(hdc); + HDC hCopyDC = CreateCompatibleDC(hdc); + + if (! hMemDC || ! hCopyDC) + { + wxFAIL_MSG( wxT("unable to create compatible DCs") ); + return wxNullImage; + } + +#if 0 + if (m_hPal) + { + SelectPalette(hMemDC, m_hPal, FALSE); RealizePalette(hMemDC); + SelectPalette(hCopyDC, m_hPal, FALSE); RealizePalette(hCopyDC); + } +#endif + + HBITMAP hOldMemBitmap = (HBITMAP) SelectObject(hMemDC, hBitmap); + HBITMAP hOldCopyBitmap = (HBITMAP) SelectObject(hCopyDC, hBitmapSection); + + BitBlt(hCopyDC, 0, 0, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY); + + SelectObject(hMemDC, hOldMemBitmap); + SelectObject(hCopyDC, hOldCopyBitmap); + DeleteDC(hMemDC); + DeleteDC(hCopyDC); + +#if 0 + if (m_hPal) + { + HGDIOBJ hObj = ::GetStockObject(DEFAULT_PALETTE); + SelectObject(hMemDC, hObj); + SelectObject(hCopyDC, hObj); + } +#endif + + ReleaseDC(NULL, hdc); + + // copy DIB data into the wxImage object + int i, j; + unsigned char *ptdata = data; + unsigned char *ptbits = (unsigned char*) lpBits; + for( i=0; iGetMaskBitmap() ) + { + hbitmap = (HBITMAP) GetMask()->GetMaskBitmap(); + // memory DC created, color set, data copied, and memory DC deleted + HDC memdc = ::CreateCompatibleDC( hdc ); + ::SetTextColor( memdc, RGB( 0, 0, 0 ) ); + ::SetBkColor( memdc, RGB( 255, 255, 255 ) ); + ::GetDIBits( memdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS ); + ::DeleteDC( memdc ); + ptdata = data; + ptbits = lpBits; + for( i=0; i #include +#include "wx/msw/private.h" + #if defined(__GNUWIN32_OLD__) #include "wx/msw/gnuwin32/extra.h" #endif @@ -161,7 +163,11 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, rect.right = nCheckWidth; rect.bottom = nCheckHeight; +#ifdef __WXWINCE__ + DrawFrameControl(hdcMem, &rect, DFC_BUTTON, DFCS_BUTTONCHECK); +#else DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK); +#endif // finally copy it to screen DC and clean up BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight, diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index bfb991866d..6cb5db6cc0 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -56,7 +56,7 @@ #include "wx/msw/private.h" -#ifndef __WXMICROWIN__ +#if wxUSE_WXDIB #include "wx/msw/dib.h" #endif @@ -164,7 +164,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) case CF_BITMAP: return ::IsClipboardFormatAvailable(CF_DIB) != 0; -#if wxUSE_ENH_METAFILE && !defined(__WIN16__) +#if wxUSE_ENH_METAFILE && !defined(__WIN16__) && !defined(__WXWINCE__) case CF_METAFILEPICT: return ::IsClipboardFormatAvailable(CF_ENHMETAFILE) != 0; #endif // wxUSE_ENH_METAFILE @@ -219,6 +219,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, break; } +#if wxUSE_WXDIB case wxDF_DIB: { wxBitmap *bitmap = (wxBitmap *)data; @@ -230,11 +231,12 @@ bool wxSetClipboardData(wxDataFormat dataFormat, } break; } +#endif // VZ: I'm told that this code works, but it doesn't seem to work for me - // and, anyhow, I'd be highly surprized if it did. So I leave it here + // and, anyhow, I'd be highly surprised if it did. So I leave it here // but IMNSHO it is completely broken. -#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) +#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) && !defined(__WXWINCE__) case wxDF_METAFILE: { wxMetafile *wxMF = (wxMetafile *)data; @@ -253,7 +255,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, } #endif // wxUSE_METAFILE -#if wxUSE_ENH_METAFILE && !defined(__WIN16__) +#if wxUSE_ENH_METAFILE && !defined(__WIN16__) && !defined(__WXWINCE__) case wxDF_ENHMETAFILE: { wxEnhMetaFile *emf = (wxEnhMetaFile *)data; @@ -391,6 +393,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) switch ( dataFormat ) { +#ifndef __WXWINCE__ case wxDF_BITMAP: { BITMAP bm; @@ -438,7 +441,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) retval = wxBM; break; } - +#endif case wxDF_METAFILE: case CF_SYLK: case CF_DIF: @@ -466,11 +469,11 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) if (!s) break; - LPSTR lpGlobalMemory = (LPSTR)::GlobalLock(hGlobalMemory); + LPSTR lpGlobalMemory = (LPSTR) GlobalLock(hGlobalMemory); memcpy(s, lpGlobalMemory, hsize); - ::GlobalUnlock(hGlobalMemory); + GlobalUnlock(hGlobalMemory); retval = s; break; @@ -490,11 +493,11 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) if ( !buf ) break; - LPSTR lpGlobalMemory = (LPSTR)::GlobalLock(hGlobalMemory); + LPSTR lpGlobalMemory = (LPSTR) GlobalLock(hGlobalMemory); memcpy(buf, lpGlobalMemory, size); - ::GlobalUnlock(hGlobalMemory); + GlobalUnlock(hGlobalMemory); retval = buf; break; @@ -810,7 +813,7 @@ bool wxClipboard::GetData( wxDataObject& data ) case CF_BITMAP: formatEtc.tymed = TYMED_GDI; break; - +#ifndef __WXWINCE__ case CF_METAFILEPICT: formatEtc.tymed = TYMED_MFPICT; break; @@ -818,7 +821,7 @@ bool wxClipboard::GetData( wxDataObject& data ) case CF_ENHMETAFILE: formatEtc.tymed = TYMED_ENHMF; break; - +#endif default: formatEtc.tymed = TYMED_HGLOBAL; } diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index 706e220ae7..84ad0389ec 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -46,14 +46,14 @@ #include -#if !defined(__WIN32__) || defined(__SALFORDC__) - #include -#endif - #include "wx/msw/private.h" #include "wx/colordlg.h" #include "wx/cmndata.h" +#if !defined(__WIN32__) || defined(__WXWINCE__) + #include +#endif + #include #include #include diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index f7c9e312e5..e296bf6ca6 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -312,8 +312,10 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT /* | WS_CLIPSIBLINGS */; if ( style & wxCB_READONLY ) msStyle |= CBS_DROPDOWNLIST; +#ifndef __WXWINCE__ else if ( style & wxCB_SIMPLE ) msStyle |= CBS_SIMPLE; // A list (shown always) and edit control +#endif else msStyle |= CBS_DROPDOWN; diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 94cc8a9dc2..81f642c81c 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -248,11 +248,17 @@ void wxControl::OnEraseBackground(wxEraseEvent& event) HBRUSH hBrush = ::CreateSolidBrush(wxColourToRGB(GetBackgroundColour())); HDC hdc = GetHdcOf((*event.GetDC())); + +#ifndef __WXWINCE__ int mode = ::SetMapMode(hdc, MM_TEXT); +#endif ::FillRect(hdc, &rect, hBrush); ::DeleteObject(hBrush); + +#ifndef __WXWINCE__ ::SetMapMode(hdc, mode); +#endif } WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index e0a2166aea..7d596522de 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -167,15 +167,19 @@ public: StretchBltModeChanger(HDC hdc, int mode) : m_hdc(hdc) { +#ifndef __WXWINCE__ m_modeOld = ::SetStretchBltMode(m_hdc, mode); if ( !m_modeOld ) wxLogLastError(_T("SetStretchBltMode")); +#endif } ~StretchBltModeChanger() { +#ifndef __WXWINCE__ if ( !::SetStretchBltMode(m_hdc, m_modeOld) ) wxLogLastError(_T("SetStretchBltMode")); +#endif } private: @@ -374,7 +378,7 @@ void wxDC::SetClippingHrgn(WXHRGN hrgn) // note that we combine the new clipping region with the existing one: this // is compatible with what the other ports do and is the documented // behaviour now (starting with 2.3.3) -#ifdef __WIN16__ +#if defined(__WIN16__) || defined(__WXWINCE__) RECT rectClip; if ( !::GetClipBox(GetHdc(), &rectClip) ) return; @@ -510,7 +514,9 @@ void wxDC::Clear() rect.bottom = m_selectedBitmap.GetHeight(); } +#ifndef __WXWINCE__ (void) ::SetMapMode(GetHdc(), MM_TEXT); +#endif DWORD colour = ::GetBkColor(GetHdc()); HBRUSH brush = ::CreateSolidBrush(colour); @@ -520,15 +526,22 @@ void wxDC::Clear() int width = DeviceToLogicalXRel(VIEWPORT_EXTENT)*m_signX, height = DeviceToLogicalYRel(VIEWPORT_EXTENT)*m_signY; +#ifndef __WXWINCE__ ::SetMapMode(GetHdc(), MM_ANISOTROPIC); + ::SetViewportExtEx(GetHdc(), VIEWPORT_EXTENT, VIEWPORT_EXTENT, NULL); ::SetWindowExtEx(GetHdc(), width, height, NULL); ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL); ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL); +#endif } bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) { +#ifdef __WXWINCE__ + return FALSE; +#else + #ifdef __WXMICROWIN__ if (!GetHDC()) return FALSE; #endif @@ -557,6 +570,7 @@ bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) CalcBoundingBox(x, y); return success; +#endif } bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const @@ -586,11 +600,8 @@ void wxDC::DoCrossHair(wxCoord x, wxCoord y) wxCoord x2 = x+VIEWPORT_EXTENT; wxCoord y2 = y+VIEWPORT_EXTENT; - (void)MoveToEx(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y), NULL); - (void)LineTo(GetHdc(), XLOG2DEV(x2), YLOG2DEV(y)); - - (void)MoveToEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y1), NULL); - (void)LineTo(GetHdc(), XLOG2DEV(x), YLOG2DEV(y2)); + wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y)); + wxDrawLine(GetHdc(), XLOG2DEV(x), YLOG2DEV(y1), XLOG2DEV(x), YLOG2DEV(y2)); CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); @@ -602,8 +613,7 @@ void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) if (!GetHDC()) return; #endif - (void)MoveToEx(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), NULL); - (void)LineTo(GetHdc(), XLOG2DEV(x2), YLOG2DEV(y2)); + wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2)); CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); @@ -615,6 +625,10 @@ void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) { +#ifdef __WXWINCE__ + // FIXME: emulate Arc +#else + #ifdef __WXMICROWIN__ if (!GetHDC()) return; #endif @@ -662,6 +676,7 @@ void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, CalcBoundingBox(xc - r, yc - r); CalcBoundingBox(xc + r, yc + r); +#endif } void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, @@ -681,7 +696,11 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, rect.right = x2; rect.bottom = y2; +#ifdef __WXWINCE__ + DrawFrameControl(GetHdc(), &rect, DFC_BUTTON, DFCS_BUTTONCHECK); +#else DrawFrameControl(GetHdc(), &rect, DFC_MENU, DFCS_MENUCHECK); +#endif #else // Win16 // In WIN16, draw a cross HPEN blackPen = ::CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); @@ -740,9 +759,13 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffs CalcBoundingBox(cpoints[i].x, cpoints[i].y); } +#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); +#endif (void)Polygon(GetHdc(), cpoints, n); +#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); +#endif delete[] cpoints; } else @@ -751,9 +774,13 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffs for (i = 0; i < n; i++) CalcBoundingBox(points[i].x, points[i].y); +#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); +#endif (void)Polygon(GetHdc(), (POINT*) points, n); +#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); +#endif } } @@ -889,6 +916,10 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) // Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { +#ifdef __WXWINCE__ + // FIXME +#else + #ifdef __WXMICROWIN__ if (!GetHDC()) return; #endif @@ -932,6 +963,7 @@ void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,d CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); +#endif } void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) @@ -1122,11 +1154,19 @@ void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT : OPAQUE); +#ifdef __WXWINCE__ + if ( ::ExtTextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), 0, NULL, + text.c_str(), text.length(), NULL) == 0 ) + { + wxLogLastError(wxT("TextOut")); + } +#else if ( ::TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), text.c_str(), text.length()) == 0 ) { wxLogLastError(wxT("TextOut")); } +#endif // restore the old parameters (text foreground colour may be left because // it never is set to anything else, but background should remain @@ -1617,6 +1657,7 @@ void wxDC::SetMapMode(int mode) // VZ: it seems very wasteful to always use MM_ANISOTROPIC when in 99% of // cases we could do with MM_TEXT and in the remaining 0.9% with // MM_ISOTROPIC (TODO!) +#ifndef __WXWINCE__ ::SetMapMode(GetHdc(), MM_ANISOTROPIC); int width = DeviceToLogicalXRel(VIEWPORT_EXTENT)*m_signX, @@ -1627,6 +1668,7 @@ void wxDC::SetMapMode(int mode) ::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL); ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL); +#endif } void wxDC::SetUserScale(double x, double y) @@ -1635,6 +1677,7 @@ void wxDC::SetUserScale(double x, double y) if (!GetHDC()) return; #endif +#ifndef __WXWINCE__ if ( x == m_userScaleX && y == m_userScaleY ) return; @@ -1642,6 +1685,7 @@ void wxDC::SetUserScale(double x, double y) m_userScaleY = y; SetMapMode(m_mappingMode); +#endif } void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) @@ -1650,6 +1694,7 @@ void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) if (!GetHDC()) return; #endif +#ifndef __WXWINCE__ int signX = xLeftRight ? 1 : -1, signY = yBottomUp ? -1 : 1; @@ -1660,6 +1705,7 @@ void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) SetMapMode(m_mappingMode); } +#endif } void wxDC::SetSystemScale(double x, double y) @@ -1668,6 +1714,7 @@ void wxDC::SetSystemScale(double x, double y) if (!GetHDC()) return; #endif +#ifndef __WXWINCE__ if ( x == m_scaleX && y == m_scaleY ) return; @@ -1675,6 +1722,7 @@ void wxDC::SetSystemScale(double x, double y) m_scaleY = y; SetMapMode(m_mappingMode); +#endif } void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y) @@ -1683,6 +1731,7 @@ void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y) if (!GetHDC()) return; #endif +#ifndef __WXWINCE__ if ( x == m_logicalOriginX && y == m_logicalOriginY ) return; @@ -1690,6 +1739,7 @@ void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y) m_logicalOriginY = y; ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL); +#endif } void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y) @@ -1698,6 +1748,7 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y) if (!GetHDC()) return; #endif +#ifndef __WXWINCE__ if ( x == m_deviceOriginX && y == m_deviceOriginY ) return; @@ -1705,6 +1756,7 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y) m_deviceOriginY = y; ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL); +#endif } // --------------------------------------------------------------------------- @@ -1950,6 +2002,9 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, { // if we already have a DIB, draw it using StretchDIBits(), otherwise // use StretchBlt() if available and finally fall back to BitBlt() + + // FIXME: use appropriate WinCE functions +#ifndef __WXWINCE__ const int caps = ::GetDeviceCaps(GetHdc(), RASTERCAPS); if ( bmpSrc.Ok() && (caps & RC_STRETCHDIB) ) { @@ -2022,6 +2077,8 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, success = TRUE; } } +#endif + // __WXWINCE__ } ::SetTextColor(GetHdc(), old_textground); diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 51f6c9c01e..aac533377b 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -38,7 +38,11 @@ #if wxUSE_PRINTING_ARCHITECTURE #include "wx/msw/private.h" + +#if wxUSE_WXDIB #include "wx/msw/dib.h" +#endif + #include "wx/dcprint.h" #include "math.h" @@ -341,6 +345,7 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc, const wxBitmap& bmp, wxCoord x, wxCoord y) { +#if wxUSE_WXDIB wxDIB dib(bmp); if ( !dib.IsOk() ) return FALSE; @@ -373,6 +378,9 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc, } return TRUE; +#else + return FALSE; +#endif } void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp, diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 9aa457995a..3b42e9c0f7 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -35,6 +35,8 @@ #include "wx/log.h" #endif //WX_PRECOMP +#if wxUSE_WXDIB + #include "wx/bitmap.h" #include "wx/intl.h" #include "wx/file.h" @@ -606,3 +608,6 @@ bool wxDIB::Create(const wxImage& image) #endif // wxUSE_IMAGE +#endif + // wxUSE_WXDIB + diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp index 724625bf1a..514c4c3c89 100644 --- a/src/msw/dir.cpp +++ b/src/msw/dir.cpp @@ -41,6 +41,10 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() +#ifdef __WXMSW__ + #include "wx/msw/private.h" +#endif + // ---------------------------------------------------------------------------- // define the types and functions used for file searching // ---------------------------------------------------------------------------- @@ -130,8 +134,6 @@ return (attr & (_A_SYSTEM | _A_HIDDEN)) != 0; } #else // Win32 - #include - typedef WIN32_FIND_DATA FIND_STRUCT; typedef HANDLE FIND_DATA; typedef DWORD FIND_ATTR; diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 0c61464260..5f9006fa2b 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -42,6 +42,11 @@ #include "wx/msw/private.h" +#ifdef __WXWINCE__ +#include +#include +#include +#endif #include // Win95 shell // ---------------------------------------------------------------------------- @@ -135,7 +140,11 @@ int wxDirDialog::ShowModal() bi.hwndOwner = parent ? GetHwndOf(parent) : NULL; bi.pidlRoot = NULL; bi.pszDisplayName = NULL; +#ifdef __WXWINCE__ + bi.lpszTitle = m_message.mb_str(); +#else bi.lpszTitle = m_message.c_str(); +#endif bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = BrowseCallbackProc; bi.lParam = (LPARAM)m_path.c_str(); // param for the callback @@ -217,7 +226,9 @@ BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) // initial selection here // // wParam = TRUE => lParam is a string and not a PIDL +#ifndef __WXWINCE__ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); +#endif break; case BFFM_SELCHANGED: diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index 7bb4c4def1..9427d3af72 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -117,6 +117,9 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) m_hImageList = 0; UINT flags = 0 ; +#ifdef __WXWINCE__ + flags = ILC_COLOR; +#else if (image.GetDepth() <= 4) flags = ILC_COLOR4; else if (image.GetDepth() <= 8) @@ -127,6 +130,7 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) flags = ILC_COLOR24; else flags = ILC_COLOR32; +#endif bool mask = (image.GetMask() != 0); @@ -170,6 +174,9 @@ bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) m_hImageList = 0; UINT flags = 0 ; +#ifdef __WXWINCE__ + flags = ILC_COLOR; +#else if (image.GetDepth() <= 4) flags = ILC_COLOR4; else if (image.GetDepth() <= 8) @@ -180,6 +187,7 @@ bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) flags = ILC_COLOR24; else flags = ILC_COLOR32; +#endif bool mask = TRUE; if ( mask ) flags |= ILC_MASK; diff --git a/src/msw/fdrepdlg.cpp b/src/msw/fdrepdlg.cpp index cc2b94299d..76c85f3c8a 100644 --- a/src/msw/fdrepdlg.cpp +++ b/src/msw/fdrepdlg.cpp @@ -37,7 +37,7 @@ #include "wx/msw/private.h" -#if !defined(__WIN32__) || defined(__SALFORDC__) +#if !defined(__WIN32__) || defined(__WXWINCE__) #include #endif diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 1e03393399..e3064ea425 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -43,7 +43,7 @@ #include "wx/msw/private.h" -#if !defined(__WIN32__) || defined(__SALFORDC__) +#if !defined(__WIN32__) || defined(__WXWINCE__) #include #endif diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp index 43f96242e8..34ff09c2dd 100644 --- a/src/msw/fontdlg.cpp +++ b/src/msw/fontdlg.cpp @@ -37,13 +37,12 @@ #endif #include "wx/fontdlg.h" +#include "wx/msw/private.h" -#if !defined(__WIN32__) || defined(__SALFORDC__) -#include +#if !defined(__WIN32__) || defined(__WXWINCE__) #include #endif -#include "wx/msw/private.h" #include "wx/cmndata.h" #include "wx/log.h" diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index 8ed53278ae..c732ae5693 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -34,12 +34,12 @@ #include "wx/font.h" #endif +#include "wx/msw/private.h" + #include "wx/fontutil.h" #include "wx/fontenum.h" #include "wx/fontmap.h" -#include "wx/msw/private.h" - // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -159,7 +159,10 @@ void wxFontEnumeratorHelper::DoEnumerate() #ifndef __WXMICROWIN__ HDC hDC = ::GetDC(NULL); -#ifdef __WIN32__ +#ifdef __WXWINCE__ + ::EnumFontFamilies(hDC, m_facename, (wxFONTENUMPROC)wxFontEnumeratorProc, + (LPARAM)this) ; +#elif defined(__WIN32__) LOGFONT lf; lf.lfCharSet = m_charset; wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName)); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 76bba0ef4b..3455129a19 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -42,6 +42,10 @@ #include "wx/msw/private.h" +#ifdef __WXWINCE__ +#include +#endif + #if wxUSE_STATUSBAR #include "wx/statusbr.h" #include "wx/generic/statusbr.h" @@ -102,6 +106,9 @@ void wxFrame::Init() #if wxUSE_TOOLTIPS m_hwndToolTip = 0; #endif +#ifdef __WXWINCE__ + m_commandBar = 0; +#endif // Data to save/restore when calling ShowFullScreen m_fsStatusBarFields = 0; @@ -132,8 +139,15 @@ bool wxFrame::Create(wxWindow *parent, wxFrame::~wxFrame() { m_isBeingDeleted = TRUE; - DeleteAllBars(); +#ifdef __WXWINCE__ + if (m_commandBar) + { + ::DestroyWindow((HWND) m_commandBar); + m_commandBar = NULL; + } +#endif + } // ---------------------------------------------------------------------------- @@ -283,7 +297,21 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) void wxFrame::InternalSetMenuBar() { -#ifndef __WXMICROWIN__ +#ifdef __WXMICROWIN__ + // Nothing +#elif defined(__WXWINCE__) + if (!m_commandBar) + { + // TODO: what identifer shall we use? + // TODO: eventually have a wxCommandBar class + m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), GetHwnd(), 999); + } + if (m_commandBar) + { + CommandBar_InsertMenubarEx((HWND) m_commandBar, wxGetInstance(), + (LPTSTR) (HMENU) m_hMenu, 0); + } +#else if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) { wxLogLastError(wxT("SetMenu")); @@ -334,7 +362,8 @@ bool wxFrame::ShowFullScreen(bool show, long style) } #endif // wxUSE_TOOLBAR -#ifndef __WXMICROWIN__ + // TODO: make it work for WinCE +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); #endif @@ -381,7 +410,8 @@ bool wxFrame::ShowFullScreen(bool show, long style) } #endif // wxUSE_STATUSBAR -#ifndef __WXMICROWIN__ + // TODO: make it work for WinCE +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); #endif @@ -540,7 +570,7 @@ bool wxFrame::HandlePaint() RECT rect; if ( GetUpdateRect(GetHwnd(), &rect, FALSE) ) { -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if ( m_iconized ) { const wxIcon& icon = GetIcon(); @@ -590,7 +620,7 @@ bool wxFrame::HandlePaint() bool wxFrame::HandleSize(int x, int y, WXUINT id) { bool processed = FALSE; -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) switch ( id ) { @@ -748,7 +778,7 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = HandlePaint(); break; -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) case WM_MENUSELECT: { WXWORD item, flags; diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 2bf6f0bce0..9ac518a065 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -39,7 +39,15 @@ #include "wx/bitmap.h" #include "wx/msw/gdiimage.h" + +#if wxUSE_WXDIB #include "wx/msw/dib.h" +#endif + +#ifdef __WXWINCE__ +#include +#include +#endif #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxGDIImageHandlerList); @@ -345,11 +353,15 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { +#if wxUSE_WXDIB wxCHECK_MSG( bitmap, false, _T("NULL bitmap in LoadFile") ); wxDIB dib(name); return dib.IsOk() && bitmap->CopyFromDIB(dib); +#else + return FALSE; +#endif } bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, @@ -357,11 +369,15 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, int WXUNUSED(type), const wxPalette * WXUNUSED(pal)) { +#if wxUSE_WXDIB wxCHECK_MSG( bitmap, false, _T("NULL bitmap in SaveFile") ); wxDIB dib(*bitmap); return dib.Save(name); +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -415,7 +431,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, } else #endif - // were we asked for a large icon? + // were we asked for a large icon? if ( desiredWidth == ::GetSystemMetrics(SM_CXICON) && desiredHeight == ::GetSystemMetrics(SM_CYICON) ) { @@ -442,11 +458,13 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, } //else: not standard size, load below +#ifndef __WXWINCE__ if ( !hicon ) { // take any size icon from the file by index hicon = ::ExtractIcon(wxGetInstance(), nameReal, iconIndex); } +#endif if ( !hicon ) { @@ -508,6 +526,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, } // next check if it's not a standard icon +#ifndef __WXWINCE__ if ( !hicon && !hasSize ) { static const struct @@ -530,6 +549,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, } } } +#endif wxSize size = wxGetHiconSize(hicon); icon->SetSize(size.x, size.y); @@ -546,7 +566,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, wxSize wxGetHiconSize(HICON hicon) { wxSize size(32, 32); // default - +#ifndef __WXWINCE__ if ( hicon && wxGetOsVersion() != wxWIN32S ) { ICONINFO info; @@ -571,7 +591,7 @@ wxSize wxGetHiconSize(HICON hicon) ::DeleteObject(info.hbmColor); } } - +#endif return size; } diff --git a/src/msw/gdiobj.cpp b/src/msw/gdiobj.cpp index 7078a1d946..8a2e9e16fa 100644 --- a/src/msw/gdiobj.cpp +++ b/src/msw/gdiobj.cpp @@ -30,7 +30,6 @@ #include "wx/gdiobj.h" #include "wx/msw/private.h" -#include "assert.h" IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index d9526df4ed..342b7da070 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -86,11 +86,15 @@ bool wxImageList::Create(int width, int height, bool mask, int initial) // set appropriate color depth int dd = wxDisplayDepth(); +#ifdef __WXWINCE__ + flags |= ILC_COLOR; +#else if (dd <= 4) flags |= ILC_COLOR; // 16 color else if (dd <= 8) flags |= ILC_COLOR8; // 256 color else if (dd <= 16) flags |= ILC_COLOR16; // 64k hi-color else if (dd <= 24) flags |= ILC_COLOR24; // 16m truecolor else if (dd <= 32) flags |= ILC_COLOR32; // 16m truecolor +#endif if ( mask ) flags |= ILC_MASK; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 8a3588b32c..c84ead3a3b 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -145,7 +145,7 @@ bool wxListBox::Create(wxWindow *parent, if (m_windowStyle & wxLB_SORT) wstyle |= LBS_SORT; -#if wxUSE_OWNER_DRAWN +#if wxUSE_OWNER_DRAWN && !defined(__WXWINCE__) if ( m_windowStyle & wxLB_OWNERDRAW ) { // we don't support LBS_OWNERDRAWVARIABLE yet wstyle |= LBS_OWNERDRAWFIXED; @@ -703,7 +703,11 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; +#ifdef __WXWINCE__ + HDC hdc = GetDC(NULL); +#else HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0); +#endif wxDC dc; dc.SetHDC((WXHDC)hdc); diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 6ad79060fc..5617b1f15c 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -100,6 +100,15 @@ extern "C" #if !defined(_WINDLL) +#ifdef __WXWINCE__ +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPWSTR lpCmdLine, + int nCmdShow) +{ + return wxEntry(hInstance, hPrevInstance, (char*) lpCmdLine, nCmdShow); +} +#else int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, @@ -107,6 +116,7 @@ int PASCAL WinMain(HINSTANCE hInstance, { return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); } +#endif #else // _WINDLL diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 761bd75da6..f1a7bb4a2c 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -67,6 +67,7 @@ static const int idMenuTitle = -2; // make the given menu item default static void SetDefaultMenuItem(HMENU hmenu, UINT id) { +#ifndef __WXWINCE__ MENUITEMINFO mii; wxZeroMemory(mii); mii.cbSize = sizeof(MENUITEMINFO); @@ -77,7 +78,21 @@ static void SetDefaultMenuItem(HMENU hmenu, UINT id) { wxLogLastError(wxT("SetMenuItemInfo")); } +#endif +} + +#ifdef __WXWINCE__ +UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) +{ + MENUITEMINFO info; + wxZeroMemory(info); + info.cbSize = sizeof(info); + info.fMask = MIIM_STATE; + if ( !GetMenuItemInfo(hMenu, id, flags & MF_BYCOMMAND ? FALSE : TRUE, & info) ) + wxLogLastError(wxT("GetMenuItemInfo")); + return info.fState; } +#endif // ============================================================================ // implementation @@ -467,12 +482,26 @@ void wxMenu::SetTitle(const wxString& label) else { // modify the title +#ifdef __WXWINCE__ + MENUITEMINFO info; + wxZeroMemory(info); + info.cbSize = sizeof(info); + info.fMask = MIIM_TYPE; + info.fType = MFT_STRING; + info.cch = m_title.Length(); + info.dwTypeData = (LPTSTR) m_title.c_str(); + if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) ) + { + wxLogLastError(wxT("SetMenuItemInfo")); + } +#else if ( !ModifyMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING, (unsigned)idMenuTitle, m_title) ) { wxLogLastError(wxT("ModifyMenu")); } +#endif } } @@ -500,7 +529,8 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id) // useless anyhow (as it could be retrieved using GetId()) and // uncompatible with wxGTK, so now we use the command int instead // to pass the checked status - SendEvent(id, ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) & MF_CHECKED); + UINT menuState = ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) ; + SendEvent(id, menuState & MF_CHECKED); } return TRUE; @@ -656,11 +686,26 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label) id = pos; } +#ifdef __WXWINCE__ + MENUITEMINFO info; + wxZeroMemory(info); + info.cbSize = sizeof(info); + info.fMask = MIIM_TYPE; + info.fType = MFT_STRING; + info.cch = label.Length(); + info.dwTypeData = (LPTSTR) label.c_str(); + if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, & info) ) + { + wxLogLastError(wxT("SetMenuItemInfo")); + } + +#else if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld, - id, label) == (int)0xFFFFFFFF ) + id, label) == (int)0xFFFFFFFF ) { wxLogLastError(wxT("ModifyMenu")); } +#endif Refresh(); } diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index 887b57f944..e55b17d334 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -50,6 +50,11 @@ #include "wx/msw/private.h" +#ifdef __WXWINCE__ +// Implemented in menu.cpp +UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) ; +#endif + // --------------------------------------------------------------------------- // macro // --------------------------------------------------------------------------- @@ -342,12 +347,28 @@ void wxMenuItem::SetText(const wxString& text) data = (wxChar*) text.c_str(); } +#ifdef __WXWINCE__ + // FIXME: complete this, applying the old + // flags + MENUITEMINFO info; + wxZeroMemory(info); + info.cbSize = sizeof(info); + info.fMask = MIIM_TYPE; + info.fType = MFT_STRING; + info.cch = text.Length(); + info.dwTypeData = (LPTSTR) data ; + if ( !SetMenuItemInfo(hMenu, id, FALSE, & info) ) + { + wxLogLastError(wxT("SetMenuItemInfo")); + } +#else if ( ::ModifyMenu(hMenu, id, MF_BYCOMMAND | flagsOld, id, data) == (int)0xFFFFFFFF ) { wxLogLastError(wxT("ModifyMenu")); } +#endif } } diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index e5e4eb07bb..3b5517b828 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -104,8 +104,10 @@ int wxMessageDialog::ShowModal() if (hWnd) msStyle |= MB_APPLMODAL; +#ifndef __WXWINCE__ else msStyle |= MB_TASKMODAL; +#endif // do show the dialog int msAns = MessageBox(hWnd, m_message.c_str(), m_caption.c_str(), msStyle); diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index 778cd60941..ed6efcdd49 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -269,7 +269,11 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { int style1 = (style & 0xFF); - if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) || (style1 == SS_SIMPLE)) + if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) +#ifndef __WXWINCE__ + || (style1 == SS_SIMPLE) +#endif + ) win = new wxStaticText; #if wxUSE_STATBMP #if defined(__WIN32__) && defined(BS_BITMAP) diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 4b2b77b108..095c6e0119 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -28,18 +28,28 @@ #define _FORCENAMELESSUNION #include "wx/log.h" +#include "wx/msw/private.h" #include "wx/msw/ole/oleutils.h" #include "wx/msw/ole/automtn.h" -#include "wx/msw/private.h" #include + +#ifdef __WXWINCE__ +#include "wx/msw/wince/time.h" +#else #include +#endif #include #include + #include #define _huge + +#ifndef __WXWINCE__ #include +#endif + #include // Verifies will fail if the needed buffer size is too large diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 9e7b0363d1..b7dee87332 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -39,8 +39,12 @@ #include "wx/msw/private.h" // includes +#ifdef __WXWINCE__ +#include +#endif + // for some compilers, the entire ole2.h must be included, not only oleauto.h -#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) +#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) || defined(__WXWINCE__) #include #endif @@ -299,6 +303,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) pmedium->tymed = TYMED_ENHMF; break; +#ifndef __WXWINCE__ case wxDF_METAFILE: pmedium->hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(METAFILEPICT)); @@ -308,7 +313,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) } pmedium->tymed = TYMED_MFPICT; break; - +#endif default: // alloc memory size_t size = m_pDataObject->GetDataSize(format); @@ -472,11 +477,13 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, break; #endif case CF_BITMAP: +#ifndef __WXWINCE__ case CF_HDROP: // these formats don't use size at all, anyhow (but // pass data by handle, which is always a single DWORD) size = 0; break; +#endif case CF_DIB: // the handler will calculate size itself (it's too @@ -484,10 +491,11 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, size = 0; break; +#ifndef __WXWINCE__ case CF_METAFILEPICT: size = sizeof(METAFILEPICT); break; - +#endif default: { // we suppose that the size precedes the data @@ -956,6 +964,7 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format, bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) { +#ifndef __WXWINCE__ m_filenames.Empty(); // the documentation states that the first member of DROPFILES structure is @@ -989,6 +998,9 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) } return TRUE; +#else + return FALSE; +#endif } void wxFileDataObject::AddFile(const wxString& file) @@ -1001,6 +1013,7 @@ void wxFileDataObject::AddFile(const wxString& file) size_t wxFileDataObject::GetDataSize() const { +#ifndef __WXWINCE__ // size returned will be the size of the DROPFILES structure, // plus the list of filesnames (null byte separated), plus // a double null at the end @@ -1020,10 +1033,14 @@ size_t wxFileDataObject::GetDataSize() const } return sz; +#else + return 0; +#endif } bool wxFileDataObject::GetDataHere(void *pData) const { +#ifndef __WXWINCE__ // pData points to an externally allocated memory block // created using the size returned by GetDataSize() @@ -1060,6 +1077,9 @@ bool wxFileDataObject::GetDataHere(void *pData) const *pbuf = wxT('\0'); return TRUE; +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- diff --git a/src/msw/ole/dropsrc.cpp b/src/msw/ole/dropsrc.cpp index 45260de525..c0ea443752 100644 --- a/src/msw/ole/dropsrc.cpp +++ b/src/msw/ole/dropsrc.cpp @@ -38,10 +38,10 @@ #include "wx/log.h" #include "wx/dnd.h" -#include +#include "wx/msw/private.h" // for some compilers, the entire ole2.h must be included, not only oleauto.h -#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) +#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) || defined(__WXWINCE__) #include #endif diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp index e7982fb237..8d8f6fbf1c 100644 --- a/src/msw/ole/droptgt.cpp +++ b/src/msw/ole/droptgt.cpp @@ -32,8 +32,14 @@ #if wxUSE_OLE && wxUSE_DRAG_AND_DROP +#include "wx/msw/private.h" #include "wx/log.h" +#ifdef __WXWINCE__ + #include + #include +#endif + #ifdef __WIN32__ #if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS #if wxCHECK_W32API_VERSION( 1, 0 ) @@ -47,11 +53,6 @@ #include "wx/dnd.h" -#ifndef __WIN32__ - #include - #include -#endif - #include "wx/msw/ole/oleutils.h" // ---------------------------------------------------------------------------- diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index 1a0966bfd9..c54de1c5d9 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -35,10 +35,21 @@ #ifndef __CYGWIN10__ -#include +#include "wx/msw/private.h" + +#ifdef __WXWINCE__ + #include + #include + + #define GUID_DEFINED + #define UUID_DEFINED +#endif // OLE +#ifndef __WXWINCE__ #include "wx/msw/ole/uuid.h" +#endif + #include "wx/msw/ole/oleutils.h" #if defined(__VISUALC__) && (__VISUALC__ > 1000) @@ -169,9 +180,13 @@ static wxString GetIidName(REFIID riid) } } +#ifndef __WXWINCE__ // unknown IID, just transform to string Uuid uuid(riid); return wxString((const wxChar *)uuid); +#else + return wxEmptyString; +#endif } void wxLogQueryInterface(const wxChar *szInterface, REFIID riid) diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index a7dc903a5d..959a6dc44d 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -30,7 +30,6 @@ #endif #include "wx/msw/private.h" -#include "assert.h" IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) @@ -149,7 +148,7 @@ bool wxPen::RealizeResource() // Join style, Cap style, Pen Stippling only on Win32. // Currently no time to find equivalent on Win3.1, sorry // [if such equiv exist!!] -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if (M_PENDATA->m_join==wxJOIN_ROUND && M_PENDATA->m_cap==wxCAP_ROUND && M_PENDATA->m_style!=wxUSER_DASH && @@ -397,7 +396,7 @@ int wx2msPenStyle(int wx_style) int cstyle; switch (wx_style) { -#if !defined(__WXMICROWIN__) +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) case wxDOT: cstyle = PS_DOT; break; @@ -417,7 +416,7 @@ int wx2msPenStyle(int wx_style) #endif case wxUSER_DASH: -#if !defined(__WXMICROWIN__) +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #ifdef __WIN32__ // Win32s doesn't have PS_USERSTYLE if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95) diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index eb811168db..b47741145c 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -84,7 +84,13 @@ WXHWND wxPopupWindow::MSWGetParent() const // WS_CHILD but then showing a popup would deactivate the parent which // is ugly and working around this, although possible, is even more // ugly + // GetDesktopWindow() is not always supported on WinCE, and if + // it is, it often returns NULL. +#ifdef __WXWINCE__ + return 0; +#else return (WXHWND)::GetDesktopWindow(); +#endif } bool wxPopupWindow::Show(bool show) diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 3718821eba..124ffdf698 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -953,15 +953,24 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, bool processed = TRUE; + // HELPINFO doesn't seem to be supported on WinCE. +#ifndef __WXWINCE__ HELPINFO* info = (HELPINFO*) lParam; // Don't yet process menu help events, just windows if (info->iContextType == HELPINFO_WINDOW) +#endif { wxWindow* subjectOfHelp = radiobox; bool eventProcessed = FALSE; while (subjectOfHelp && !eventProcessed) { - wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), wxPoint(info->MousePos.x, info->MousePos.y) ) ; // info->iCtrlId); + wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), +#ifdef __WXWINCE__ + wxPoint(0, 0) +#else + wxPoint(info->MousePos.x, info->MousePos.y) +#endif + ) ; // info->iCtrlId); helpEvent.SetEventObject(radiobox); eventProcessed = radiobox->GetEventHandler()->ProcessEvent(helpEvent); @@ -970,14 +979,16 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, } processed = eventProcessed; } +#ifndef __WXWINCE__ else if (info->iContextType == HELPINFO_MENUITEM) { wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ; helpEvent.SetEventObject(radiobox); processed = radiobox->GetEventHandler()->ProcessEvent(helpEvent); } - else processed = FALSE; - + else + processed = FALSE; +#endif if (processed) return 0; diff --git a/src/msw/region.cpp b/src/msw/region.cpp index 1e6e76fab0..e6651489cc 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -50,7 +50,7 @@ public: wxRegionRefData(const wxRegionRefData& data) { -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(data.m_region, noBytes, rgnData); @@ -122,7 +122,7 @@ wxRegion::wxRegion(const wxRect& rect) wxRegion::wxRegion(size_t n, const wxPoint *points, int fillStyle) { -#ifdef __WXMICROWIN__ +#if defined(__WXMICROWIN__) || defined(__WXWINCE__) m_refData = NULL; M_REGION = NULL; #else diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 620ff86358..7d8a62aca1 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -38,6 +38,12 @@ #include +#ifdef __WXWINCE__ +#include "wx/msw/private.h" +#include +#include +#endif + // other std headers #include // for _MAX_PATH @@ -71,10 +77,12 @@ aStdKeys[] = { HKEY_CURRENT_USER, wxT("HKEY_CURRENT_USER"), wxT("HKCU") }, { HKEY_LOCAL_MACHINE, wxT("HKEY_LOCAL_MACHINE"), wxT("HKLM") }, { HKEY_USERS, wxT("HKEY_USERS"), wxT("HKU") }, // short name? +#ifndef __WXWINCE__ { HKEY_PERFORMANCE_DATA, wxT("HKEY_PERFORMANCE_DATA"), wxT("HKPD") }, -#if WINVER >= 0x0400 +#endif +#if WINVER >= 0x0400 && !defined(__WXWINCE__) { HKEY_CURRENT_CONFIG, wxT("HKEY_CURRENT_CONFIG"), wxT("HKCC") }, -#ifndef __GNUWIN32__ +#if !defined(__GNUWIN32__) && !defined(__WXWINCE__) { HKEY_DYN_DATA, wxT("HKEY_DYN_DATA"), wxT("HKDD") }, // short name? #endif //GNUWIN32 #endif //WINVER >= 4.0 @@ -372,7 +380,8 @@ bool wxRegKey::Open() return TRUE; HKEY tmpKey; - m_dwLastError = RegOpenKey((HKEY) m_hRootKey, m_strKey, &tmpKey); + m_dwLastError = RegOpenKeyEx((HKEY) m_hRootKey, m_strKey, + 0, 0, &tmpKey); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"), GetName().c_str()); @@ -397,7 +406,19 @@ bool wxRegKey::Create(bool bOkIfExists) return TRUE; HKEY tmpKey; +#ifdef __WXWINCE__ + DWORD disposition; + m_dwLastError = RegCreateKeyEx((HKEY) m_hRootKey, m_strKey, + NULL, // reserved + NULL, // class string + 0, + 0, + NULL, + &tmpKey, + &disposition); +#else m_dwLastError = RegCreateKey((HKEY) m_hRootKey, m_strKey, &tmpKey); +#endif if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"), GetName().c_str()); @@ -856,6 +877,7 @@ bool wxRegKey::QueryValue(const wxChar *szValue, strValue.UngetWriteBuf(); // expand the var expansions in the string unless disabled +#ifndef __WXWINCE__ if ( (dwType == REG_EXPAND_SZ) && !raw ) { DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0); @@ -878,6 +900,8 @@ bool wxRegKey::QueryValue(const wxChar *szValue, wxLogLastError(_T("ExpandEnvironmentStrings")); } } +#endif + // __WXWINCE__ } if ( m_dwLastError == ERROR_SUCCESS ) { @@ -1012,7 +1036,14 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const return FALSE; wxChar szKeyName[_MAX_PATH + 1]; + +#ifdef __WXWINCE__ + DWORD sizeName = WXSIZEOF(szKeyName); + m_dwLastError = RegEnumKeyEx((HKEY) m_hKey, lIndex++, szKeyName, & sizeName, + 0, NULL, NULL, NULL); +#else m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName)); +#endif if ( m_dwLastError != ERROR_SUCCESS ) { if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) { @@ -1057,7 +1088,7 @@ bool KeyExists(WXHKEY hRootKey, const wxChar *szKey) return TRUE; HKEY hkeyDummy; - if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) { + if ( RegOpenKeyEx( (HKEY) hRootKey, szKey, 0, 0, &hkeyDummy) == ERROR_SUCCESS ) { RegCloseKey(hkeyDummy); return TRUE; } diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index fccc82bb70..9f7c9ce146 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -127,10 +127,11 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, int position, maxPos, trackPos = pos; -#ifdef __WIN32__ // when we're dragging the scrollbar we can't use pos parameter because it // is limited to 16 bits - if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK ) + // JACS: now always using GetScrollInfo, since there's no reason + // not to +// if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK ) { SCROLLINFO scrollInfo; wxZeroMemory(scrollInfo); @@ -150,13 +151,14 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, position = scrollInfo.nPos; maxPos = scrollInfo.nMax; } +#if 0 else -#endif // Win32 { position = ::GetScrollPos((HWND) control, SB_CTL); int minPos; ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos); } +#endif #if defined(__WIN95__) // A page size greater than one has the effect of reducing the effective @@ -265,7 +267,17 @@ void wxScrollBar::SetThumbPosition(int viewStart) int wxScrollBar::GetThumbPosition(void) const { - return ::GetScrollPos((HWND)m_hWnd, SB_CTL); + SCROLLINFO scrollInfo; + wxZeroMemory(scrollInfo); + scrollInfo.cbSize = sizeof(SCROLLINFO); + scrollInfo.fMask = SIF_POS; + + if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) ) + { + wxLogLastError(_T("GetScrollInfo")); + } + return scrollInfo.nPos; +// return ::GetScrollPos((HWND)m_hWnd, SB_CTL); } void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 268cdd874e..1c5c52d672 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -279,7 +279,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) static const int gs_metricsMap[] = { -1, // wxSystemMetric enums start at 1, so give a dummy value for pos 0. -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXWINCE__) SM_CMOUSEBUTTONS, #else -1, @@ -297,17 +297,25 @@ static const int gs_metricsMap[] = SM_CXEDGE, SM_CYEDGE, #else - -1, -1, -1, -1 + -1, -1, -1, -1, #endif SM_CXHSCROLL, SM_CYHSCROLL, +#ifdef SM_CXHTHUMB SM_CXHTHUMB, +#else + -1, +#endif SM_CXICON, SM_CYICON, SM_CXICONSPACING, SM_CYICONSPACING, +#ifdef SM_CXHTHUMB SM_CXMIN, SM_CYMIN, +#else + -1, -1, +#endif SM_CXSCREEN, SM_CYSCREEN, @@ -317,13 +325,17 @@ static const int gs_metricsMap[] = SM_CXSMICON, SM_CYSMICON, #else - -1, -1, -1, -1 + -1, -1, -1, -1, #endif SM_CYHSCROLL, SM_CXVSCROLL, SM_CXVSCROLL, SM_CYVSCROLL, +#ifdef SM_CYVTHUMB SM_CYVTHUMB, +#else + -1, +#endif SM_CYCAPTION, SM_CYMENU, #if defined(__WIN32__) && defined(SM_NETWORK) @@ -331,13 +343,21 @@ static const int gs_metricsMap[] = #else -1, #endif +#ifdef SM_PENWINDOWS SM_PENWINDOWS, +#else + -1, +#endif #if defined(__WIN32__) && defined(SM_SHOWSOUNDS) SM_SHOWSOUNDS, #else -1, #endif +#ifdef SM_SWAPBUTTON SM_SWAPBUTTON, +#else + -1 +#endif }; // Get a system metric, e.g. scrollbar size diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 3e07c77a93..c6d402a15a 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -594,9 +594,13 @@ void wxSlider95::SetRange(int minValue, int maxValue) WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { +#ifndef __WXWINCE__ if ( nCtlColor == CTLCOLOR_SCROLLBAR ) return 0; - +#else + if ( nCtlColor != CTLCOLOR_STATIC ) + return 0; +#endif // Otherwise, it's a static return wxControl::OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); } diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index d4a9711d9d..07f6dfe1a9 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -269,10 +269,12 @@ long wxStaticBitmap::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { +#ifndef __WXWINCE__ // Ensure that static items get messages. Some controls don't like this // message to be intercepted (e.g. RichEdit), hence the tests. if ( nMsg == WM_NCHITTEST ) return (long)HTCLIENT; +#endif return wxWindow::MSWWindowProc(nMsg, wParam, lParam); } diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 80c77ce5ce..2689d61fc9 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -76,7 +76,12 @@ bool wxStaticBox::Create(wxWindow *parent, // after removing WS_EX_TRANSPARENT bit) and so let's use it until // we fix the real underlying problem if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX, pos, size, label, - WS_EX_TRANSPARENT) ) +#ifdef __WXWINCE__ + 0 +#else + WS_EX_TRANSPARENT +#endif + ) ) return FALSE; // to be transparent we should have the same colour as the parent as well @@ -103,6 +108,7 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { switch ( nMsg ) { +#ifndef __WXWINCE__ case WM_NCHITTEST: // FIXME: this hack is specific to dialog ed, shouldn't it be // somehow disabled during normal operation? @@ -118,7 +124,7 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) return (long)HTCLIENT; } break; - +#endif case WM_ERASEBKGND: // prevent wxControl from processing this message because it will // erase the background incorrectly and there is no way for us to diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index d28a6b8ae8..16fa083f6d 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -96,9 +96,11 @@ bool wxStatusBar95::Create(wxWindow *parent, } else { +#ifndef __WXWINCE__ // may be some versions of comctl32.dll do need it - anyhow, it won't // do any harm wstyle |= SBARS_SIZEGRIP; +#endif } m_hWnd = (WXHWND)CreateStatusWindow(wstyle, diff --git a/src/msw/statline.cpp b/src/msw/statline.cpp index 65906af298..510292b151 100644 --- a/src/msw/statline.cpp +++ b/src/msw/statline.cpp @@ -76,7 +76,12 @@ WXDWORD wxStaticLine::MSWGetStyle(long style, WXDWORD *exstyle) const WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle); // add our default styles - return msStyle | SS_GRAYRECT | SS_SUNKEN | SS_NOTIFY | WS_CLIPSIBLINGS; + msStyle |= SS_SUNKEN | SS_NOTIFY | WS_CLIPSIBLINGS; +#ifndef __WXWINCE__ + msStyle |= SS_GRAYRECT ; +#endif + + return msStyle ; } #endif // wxUSE_STATLINE diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index 12562fa5f7..4f3e3ab4c0 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -30,7 +30,7 @@ #include "malloc.h" #endif -#include +#include "wx/msw/private.h" #if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__)) #include @@ -40,7 +40,6 @@ #include "wx/tabctrl.h" #include "wx/app.h" -#include "wx/msw/private.h" #include "wx/msw/imaglist.h" IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) @@ -101,7 +100,9 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons if (m_windowStyle & wxBORDER) tabStyle |= WS_BORDER; +#ifndef __WXWINCE__ tabStyle |= TCS_TOOLTIPS; +#endif // Create the toolbar control. HWND hWndTabCtrl = CreateWindowEx(0L, // No extended styles. @@ -144,13 +145,14 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_TAB_SEL_CHANGING; break; +#ifndef __WXWINCE__ case TTN_NEEDTEXT: { // TODO // if (tool->m_shortHelpString != "") // ttText->lpszText = (char *) (const char *)tool->m_shortHelpString; } - +#endif default : return wxControl::MSWOnNotify(idCtrl, lParam, result); } diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 4a76e3e018..cc2b9bc9c5 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -31,19 +31,18 @@ #if defined(__WIN95__) -#include - +#include "wx/msw/private.h" #include "wx/msw/winundef.h" #include #include "wx/taskbar.h" -#include "wx/msw/private.h" #ifdef __GNUWIN32_OLD__ #include "wx/msw/gnuwin32/extra.h" #endif -#ifdef __SALFORDC__ +#ifdef __WXWINCE__ + #include #include #endif @@ -151,7 +150,8 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) if ( !tooltip.empty() ) { notifyData.uFlags |= NIF_TIP; - lstrcpyn(notifyData.szTip, tooltip.c_str(), WXSIZEOF(notifyData.szTip)); +// lstrcpyn(notifyData.szTip, tooltip.c_str(), WXSIZEOF(notifyData.szTip)); + wxStrncpy(notifyData.szTip, tooltip.c_str(), WXSIZEOF(notifyData.szTip)); } bool ok = Shell_NotifyIcon(m_iconAdded ? NIM_MODIFY diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index ba253ef85b..05df7e86d2 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -55,7 +55,10 @@ #include #include + +#ifndef __WXWINCE__ #include +#endif #if wxUSE_RICHEDIT diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index d59a960162..976c7412d6 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -64,10 +64,13 @@ (defined(__GNUG__) && defined(__MSVCRT__)) || \ defined(__WATCOMC__) || defined(__MWERKS__) +#ifndef __WXWINCE__ #undef wxUSE_BEGIN_THREAD #define wxUSE_BEGIN_THREAD #endif +#endif + #ifdef wxUSE_BEGIN_THREAD // this is where _beginthreadex() is declared #include @@ -292,6 +295,7 @@ private: wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) { +#ifndef __WXWINCE__ if ( maxcount == 0 ) { // make it practically infinite @@ -305,7 +309,7 @@ wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) maxcount, NULL // no name ); - +#endif if ( !m_semaphore ) { wxLogLastError(_T("CreateSemaphore()")); @@ -344,7 +348,9 @@ wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds) wxSemaError wxSemaphoreInternal::Post() { +#ifndef __WXWINCE__ if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) ) +#endif { wxLogLastError(_T("ReleaseSemaphore")); @@ -952,6 +958,7 @@ unsigned long wxThread::GetCurrentId() bool wxThread::SetConcurrency(size_t level) { +#ifndef __WXWINCE__ wxASSERT_MSG( IsMain(), _T("should only be called from the main thread") ); // ok only for the default one @@ -1041,7 +1048,7 @@ bool wxThread::SetConcurrency(size_t level) return FALSE; } - +#endif return TRUE; } diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 14c53817f0..3781b06f2b 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -48,7 +48,8 @@ WX_DECLARE_HASH_MAP( long, wxTimerMap ); wxTimerMap wxTimerList; -UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); + +void WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); // ---------------------------------------------------------------------------- // macros @@ -95,11 +96,16 @@ bool wxTimer::Start(int milliseconds, bool oneShot) wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeour") ); +#ifdef __WXWINCE__ + m_id = ::SetTimer(NULL, (UINT)(m_id ? m_id : 1), + (UINT)m_milli, (void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)) wxTimerProc); +#else TIMERPROC wxTimerProcInst = (TIMERPROC) MakeProcInstance((FARPROC)wxTimerProc, wxGetInstance()); m_id = ::SetTimer(NULL, (UINT)(m_id ? m_id : 1), (UINT)m_milli, wxTimerProcInst); +#endif if ( m_id > 0 ) { @@ -143,17 +149,16 @@ void wxProcessTimer(wxTimer& timer) timer.Notify(); } -UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) +void WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) { wxTimerMap::iterator node = wxTimerList.find((long)idTimer); - wxCHECK_MSG( node != wxTimerList.end(), 0, - wxT("bogus timer id in wxTimerProc") ); + wxASSERT_MSG( node != wxTimerList.end(), wxT("bogus timer id in wxTimerProc") ); wxProcessTimer(*(node->second)); - return 0; + // return 0; } #endif // wxUSE_TIMER diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index d0ae7e02c3..961cd90c52 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -41,6 +41,11 @@ #include "wx/module.h" #include "wx/msw/private.h" +#include "wx/msw/winundef.h" + +#ifdef CreateDialog +#undef CreateDialog +#endif #include "wx/display.h" @@ -155,7 +160,11 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const // border and caption styles if ( style & wxRESIZE_BORDER ) + { +#ifndef __WXWINCE__ msflags |= WS_THICKFRAME; +#endif + } else if ( !(style & wxBORDER_NONE) ) msflags |= WS_BORDER; else @@ -173,10 +182,12 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const msflags |= WS_MAXIMIZEBOX; if ( style & wxSYSTEM_MENU ) msflags |= WS_SYSMENU; +#ifndef __WXWINCE__ if ( style & wxMINIMIZE ) msflags |= WS_MINIMIZE; if ( style & wxMAXIMIZE ) msflags |= WS_MAXIMIZE; +#endif // Keep this here because it saves recoding this function in wxTinyFrame #if wxUSE_ITSY_BITSY && !defined(__WIN32__) @@ -212,11 +223,13 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const // The second one is solved here by using WS_EX_APPWINDOW flag, the // first one is dealt with in our MSWGetParent() method // implementation +#ifndef __WXWINCE__ if ( !(style & wxFRAME_NO_TASKBAR) && GetParent() ) { // need to force the frame to appear in the taskbar *exflags |= WS_EX_APPWINDOW; } +#endif //else: nothing to do [here] } #endif // !Win16 @@ -580,7 +593,11 @@ void wxTopLevelWindowMSW::Maximize(bool maximize) bool wxTopLevelWindowMSW::IsMaximized() const { +#ifdef __WXWINCE__ + return FALSE; +#else return ::IsZoomed(GetHwnd()) != 0; +#endif } void wxTopLevelWindowMSW::Iconize(bool iconize) @@ -590,10 +607,14 @@ void wxTopLevelWindowMSW::Iconize(bool iconize) bool wxTopLevelWindowMSW::IsIconized() const { +#ifdef __WXWINCE__ + return FALSE; +#else // also update the current state ((wxTopLevelWindowMSW *)this)->m_iconized = ::IsIconic(GetHwnd()) != 0; return m_iconized; +#endif } void wxTopLevelWindowMSW::Restore() @@ -633,7 +654,12 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) LONG offFlags = 0; if (style & wxFULLSCREEN_NOBORDER) - offFlags |= WS_BORDER | WS_THICKFRAME; + { + offFlags |= WS_BORDER; +#ifndef __WXWINCE__ + offFlags |= WS_THICKFRAME; +#endif + } if (style & wxFULLSCREEN_NOCAPTION) offFlags |= WS_CAPTION | WS_SYSMENU; @@ -653,8 +679,11 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) else // fall back to the main desktop #else // wxUSE_DISPLAY { + // FIXME: implement for WinCE +#ifndef __WXWINCE__ // resize to the size of the desktop wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect); +#endif } #endif // wxUSE_DISPLAY @@ -727,9 +756,9 @@ void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons) bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) { -#ifndef __WXMICROWIN__ +#if !defined(__WXMICROWIN__) // get system (a.k.a. window) menu - HMENU hmenu = ::GetSystemMenu(GetHwnd(), FALSE /* get it */); + HMENU hmenu = GetSystemMenu(GetHwnd(), FALSE /* get it */); if ( !hmenu ) { // no system menu at all -- ok if we want to remove the close button @@ -760,6 +789,9 @@ bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) bool wxTopLevelWindowMSW::SetShape(const wxRegion& region) { +#ifdef __WXWINCE__ + return FALSE; +#else wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); @@ -800,6 +832,7 @@ bool wxTopLevelWindowMSW::SetShape(const wxRegion& region) return FALSE; } return TRUE; +#endif } // ---------------------------------------------------------------------------- diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 3850a53d10..9b79bec3a8 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -44,7 +44,7 @@ #include "wx/timer.h" -#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) +#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #include #ifndef __MWERKS__ @@ -74,7 +74,7 @@ #include #endif // USE_NET_API -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #ifndef __UNIX__ #include #endif @@ -123,7 +123,9 @@ static const wxChar eUSERID[] = wxT("UserId"); // Get hostname only (without domain name) bool wxGetHostName(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WXWINCE__) + return FALSE; +#elif defined(__WIN32__) && !defined(__WXMICROWIN__) DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { @@ -203,7 +205,9 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) // Get user ID e.g. jacs bool wxGetUserId(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__win32s__) && !defined(__WXMICROWIN__) +#if defined(__WXWINCE__) + return FALSE; +#elif defined(__WIN32__) && !defined(__win32s__) && !defined(__WXMICROWIN__) DWORD nSize = maxSize; if ( ::GetUserName(buf, &nSize) == 0 ) { @@ -241,7 +245,9 @@ bool wxGetUserId(wxChar *buf, int maxSize) // Get user name e.g. Julian Smart bool wxGetUserName(wxChar *buf, int maxSize) { -#ifdef USE_NET_API +#if defined(__WXWINCE__) + return FALSE; +#elif defined(USE_NET_API) CHAR szUserName[256]; if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) ) return FALSE; @@ -329,7 +335,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) { wxString& strDir = *pstr; - #if defined(__UNIX__) +#if defined(__UNIX__) const wxChar *szHome = wxGetenv("HOME"); if ( szHome == NULL ) { // we're homeless... @@ -349,7 +355,9 @@ const wxChar* wxGetHomeDir(wxString *pstr) cygwin_conv_to_full_win32_path(strDir, windowsPath); strDir = windowsPath; #endif - #else // Windows +#elif defined(__WXWINCE__) + // Nothing +#else #ifdef __WIN32__ strDir.clear(); @@ -415,7 +423,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) // extract the dir name wxSplitPath(strPath, &strDir, NULL, NULL); - #endif // UNIX/Win +#endif // UNIX/Win return strDir.c_str(); } @@ -458,6 +466,9 @@ bool wxDirExists(const wxString& dir) bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) { +#ifdef __WXWINCE__ + return FALSE; +#else if ( path.empty() ) return FALSE; @@ -557,6 +568,8 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) } return TRUE; +#endif + // __WXWINCE__ } // ---------------------------------------------------------------------------- @@ -565,7 +578,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) bool wxGetEnv(const wxString& var, wxString *value) { -#ifdef __WIN16__ +#ifdef __WXWINCE__ + return FALSE; +#elif defined(__WIN16__) const wxChar* ret = wxGetenv(var); if ( !ret ) return FALSE; @@ -599,7 +614,7 @@ bool wxSetEnv(const wxString& var, const wxChar *value) { // some compilers have putenv() or _putenv() or _wputenv() but it's better // to always use Win32 function directly instead of dealing with them -#if defined(__WIN32__) +#if defined(__WIN32__) && !defined(__WXWINCE__) if ( !::SetEnvironmentVariable(var, value) ) { wxLogLastError(_T("SetEnvironmentVariable")); @@ -811,6 +826,9 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc) // Execute a program in an Interactive Shell bool wxShell(const wxString& command) { +#ifdef __WXWINCE__ + return FALSE; +#else wxChar *shell = wxGetenv(wxT("COMSPEC")); if ( !shell ) shell = (wxChar*) wxT("\\COMMAND.COM"); @@ -828,12 +846,15 @@ bool wxShell(const wxString& command) } return wxExecute(cmd, wxEXEC_SYNC) == 0; +#endif } // Shutdown or reboot the PC bool wxShutdown(wxShutdownFlags wFlags) { -#ifdef __WIN32__ +#ifdef __WXWINCE__ + return FALSE; +#elif defined(__WIN32__) bool bOK = TRUE; if ( wxGetOsVersion(NULL, NULL) == wxWINDOWS_NT ) // if is NT or 2K diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index aca3e0336c..e1e0d9dc98 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -46,7 +46,7 @@ #include -#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) +#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #include #ifndef __MWERKS__ #include @@ -58,7 +58,7 @@ #include #endif -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #ifndef __UNIX__ #include #endif @@ -124,7 +124,7 @@ public: bool state; // set to FALSE when the process finishes }; -#if defined(__WIN32__) && wxUSE_STREAMS +#if defined(__WIN32__) && wxUSE_STREAMS && !defined(__WXWINCE__) // ---------------------------------------------------------------------------- // wxPipeStreams @@ -329,7 +329,7 @@ LRESULT APIENTRY _EXPORT wxExecuteWindowCbk(HWND hWnd, UINT message, // implementation of IO redirection support classes // ============================================================================ -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) // ---------------------------------------------------------------------------- // wxPipeInputStreams @@ -596,7 +596,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) // the IO redirection is only supported with wxUSE_STREAMS BOOL redirect = FALSE; -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) wxPipe pipeIn, pipeOut, pipeErr; // we'll save here the copy of pipeIn[Write] @@ -624,7 +624,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) wxZeroMemory(si); si.cb = sizeof(si); -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) if ( redirect ) { si.dwFlags = STARTF_USESTDHANDLES; @@ -667,7 +667,10 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) #endif // wxUSE_STREAMS PROCESS_INFORMATION pi; - DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED; + DWORD dwFlags = CREATE_SUSPENDED; +#ifndef __WXWINCE__ + dwFlags |= CREATE_DEFAULT_ERROR_MODE ; +#endif bool ok = ::CreateProcess ( @@ -684,7 +687,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) &pi // process info ) != 0; -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) // we can close the pipe ends used by child anyhow if ( redirect ) { @@ -696,7 +699,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) if ( !ok ) { -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) // close the other handles too if ( redirect ) { @@ -710,7 +713,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) return flags & wxEXEC_SYNC ? -1 : 0; } -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) // the input buffer bufOut is connected to stdout, this is why it is // called bufOut and not bufIn wxStreamTempInputBuffer bufOut, @@ -752,10 +755,17 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) // create a hidden window to receive notification about process // termination +#ifdef __WXWINCE__ + HWND hwnd = ::CreateWindow(gs_classForHiddenWindow, NULL, + WS_OVERLAPPED, + 0, 0, 0, 0, NULL, + (HMENU)NULL, wxGetInstance(), 0); +#else HWND hwnd = ::CreateWindow(gs_classForHiddenWindow, NULL, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, (HMENU)NULL, wxGetInstance(), 0); +#endif wxASSERT_MSG( hwnd, wxT("can't create a hidden window for wxExecute") ); // Alloc data @@ -809,7 +819,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) ::CloseHandle(hThread); -#if wxUSE_IPC +#if wxUSE_IPC && !defined(__WXWINCE__) // second part of DDE hack: now establish the DDE conversation with the // just launched process if ( !ddeServer.empty() ) @@ -860,7 +870,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) // wait until the child process terminates while ( data->state ) { -#if wxUSE_STREAMS +#if wxUSE_STREAMS && !defined(__WXWINCE__) bufOut.Update(); bufErr.Update(); #endif // wxUSE_STREAMS diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 00cb07b33b..9b14ea38ac 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -443,4 +443,18 @@ extern void HIMETRICToPixel(LONG *x, LONG *y) *y /= (iHeightMM * 100); } +void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) +{ +#ifdef __WXWINCE__ + POINT points[2]; + points[0].x = x1; + points[0].y = y1; + points[1].x = x2; + points[1].y = y2; + Polyline(hdc, points, 2); +#else + MoveToEx(hdc, x1, y1, NULL); LineTo((HDC) hdc, x2, y2); +#endif +} + diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp index d3ff52853b..083a7abc84 100644 --- a/src/msw/wave.cpp +++ b/src/msw/wave.cpp @@ -102,7 +102,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)GlobalLock(GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; @@ -117,7 +117,7 @@ bool wxWave::Create(int size, const wxByte* data) Free(); m_isResource = FALSE; m_waveLength=size; - m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)GlobalLock(GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; @@ -143,20 +143,24 @@ bool wxWave::Free() { if (m_waveData) { -#ifdef __WIN32__ - HGLOBAL waveData = ::GlobalHandle(m_waveData); +#ifdef __WXWINCE__ + HGLOBAL waveData = (HGLOBAL) m_waveData; +#elif defined(__WIN32__) + HGLOBAL waveData = GlobalHandle(m_waveData); #else HGLOBAL waveData = GlobalPtrHandle(m_waveData); #endif if (waveData) { - if (m_isResource) +#ifndef __WXWINCE__ + if (m_isResource) ::FreeResource(waveData); else +#endif { - ::GlobalUnlock(waveData); - ::GlobalFree(waveData); + GlobalUnlock(waveData); + GlobalFree(waveData); } m_waveData = NULL; diff --git a/src/msw/wince/time.cpp b/src/msw/wince/time.cpp index afd4aa4b93..99814647fa 100644 --- a/src/msw/wince/time.cpp +++ b/src/msw/wince/time.cpp @@ -39,7 +39,7 @@ long timezone = 0; // Hint: use GetSystemTime() -struct tm * localtime(const time_t *) +struct tm * __cdecl localtime(const time_t *) { // TODO return NULL; @@ -105,26 +105,26 @@ struct tm * localtime(const time_t *) #endif } -time_t time(time_t *) +time_t __cdecl time(time_t *) { // TODO return 0; } -size_t wcsftime(wchar_t *, size_t, const wchar_t *, +size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *) { // TODO return 0; } -time_t mktime(struct tm *) +time_t __cdecl mktime(struct tm *) { // TODO return 0; } -struct tm * gmtime(const time_t *) +struct tm * __cdecl gmtime(const time_t *) { // TODO return NULL; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index abdcc7dac1..01bca8a3f5 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -749,6 +749,7 @@ inline int GetScrollPosition(HWND hWnd, int wOrient) return ::GetScrollPosWX(hWnd, wOrient); #else SCROLLINFO scrollInfo; + scrollInfo.cbSize = sizeof(SCROLLINFO); scrollInfo.fMask = SIF_POS; if ( !::GetScrollInfo(hWnd, wOrient, -- 2.45.2