]> git.saurik.com Git - wxWidgets.git/commitdiff
More WinCE mods
authorJulian Smart <julian@anthemion.co.uk>
Fri, 11 Jul 2003 21:50:07 +0000 (21:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 11 Jul 2003 21:50:07 +0000 (21:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

69 files changed:
src/common/fmapbase.cpp
src/common/string.cpp
src/common/utilscmn.cpp
src/common/valtext.cpp
src/common/wxchar.cpp
src/common/xpmdecod.cpp
src/generic/dirctrlg.cpp
src/generic/grid.cpp
src/generic/logg.cpp
src/generic/scrlwing.cpp
src/msw/app.cpp
src/msw/bitmap.cpp
src/msw/bmpbuttn.cpp
src/msw/brush.cpp
src/msw/button.cpp
src/msw/checklst.cpp
src/msw/clipbrd.cpp
src/msw/colordlg.cpp
src/msw/combobox.cpp
src/msw/control.cpp
src/msw/dc.cpp
src/msw/dcprint.cpp
src/msw/dib.cpp
src/msw/dir.cpp
src/msw/dirdlg.cpp
src/msw/dragimag.cpp
src/msw/fdrepdlg.cpp
src/msw/filedlg.cpp
src/msw/fontdlg.cpp
src/msw/fontenum.cpp
src/msw/frame.cpp
src/msw/gdiimage.cpp
src/msw/gdiobj.cpp
src/msw/imaglist.cpp
src/msw/listbox.cpp
src/msw/main.cpp
src/msw/menu.cpp
src/msw/menuitem.cpp
src/msw/msgdlg.cpp
src/msw/nativdlg.cpp
src/msw/ole/automtn.cpp
src/msw/ole/dataobj.cpp
src/msw/ole/dropsrc.cpp
src/msw/ole/droptgt.cpp
src/msw/ole/oleutils.cpp
src/msw/pen.cpp
src/msw/popupwin.cpp
src/msw/radiobox.cpp
src/msw/region.cpp
src/msw/registry.cpp
src/msw/scrolbar.cpp
src/msw/settings.cpp
src/msw/slider95.cpp
src/msw/statbmp.cpp
src/msw/statbox.cpp
src/msw/statbr95.cpp
src/msw/statline.cpp
src/msw/tabctrl.cpp
src/msw/taskbar.cpp
src/msw/textctrl.cpp
src/msw/thread.cpp
src/msw/timer.cpp
src/msw/toplevel.cpp
src/msw/utils.cpp
src/msw/utilsexc.cpp
src/msw/utilsgui.cpp
src/msw/wave.cpp
src/msw/wince/time.cpp
src/msw/window.cpp

index fa6dcd0d65eb693774c2c590cea1f6861060ee82..83e91e70161ed271d2f13acbce03ee66c8c8130a 100644 (file)
@@ -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() )
index 29d51e71b88755766e1644c39355683ac6fd656c..37bda6581efd58627a2e807d921fdb7de5fa38b9 100644 (file)
@@ -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;
index 3a131a372fd6c2b688bfa4c24d6a1aeede5da984..ff9c48807c6c3d026b21ba1be0c0f39a79a26410 100644 (file)
 #include "wx/process.h"
 #include "wx/txtstrm.h"
 
+#if defined(__WXWINCE__) && wxUSE_DATETIME
+#include "wx/datetime.h"
+#endif
+
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "wx/msw/wince/time.h"
 #endif
 
-#ifndef __MWERKS__
+#if !defined(__MWERKS__) && !defined(__WXWINCE__)
     #include <sys/types.h>
     #include <sys/stat.h>
 #endif
 
-#ifdef __SALFORDC__
-    #include <clib.h>
-#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()
index 16dadf77a581ab3e802feef8d759cf4038bf1a9b..c90e197703d1fea5dd874c4574e44a8eff8d3e15 100644 (file)
@@ -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)
 {
 /*
index eaa2b5b4e71e3ab8f06b5b16d431abdd100daf5e..02ca10af2f37b128f870e4a88c4fc7b5853bdb7e 100644 (file)
@@ -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
 
index f3cd26aa0be35fbbc85e4f8400a2d3da69b10a6a..b97af0c98b6d13711c27690fd290733f19247999 100644 (file)
@@ -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...
index 08e424f7d78dbf2c35c611381763dbca1b06a00a..2389927c24fcb469f80e41476203177580cd4285 100644 (file)
@@ -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__
 
index 4b9fbf995852ddbd8ed7703f405e859035a22dac..f689374935024fa5b92e4299655b30bf8124a496 100644 (file)
@@ -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;
         }
     }
index b56c4ef1cde886d3d8030bd6a893c3d917fda3f1..67bd5716b97a3e7c5e07590ca026b1a8ca8058f1 100644 (file)
 // 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;
   }
 }
index 9ab5ebe316878f4320484e4ba50ad4679a321a30..a138011f0e4a56f2cc5951310b2dabd413965fb8 100644 (file)
@@ -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;
 }
index ebacad3d1b462d488b88c1adb14d14522a3e4583..8a3a74a420e7dcc810b378d8d584987c35fae57a 100644 (file)
 
 #if _WIN32_IE >= 0x0300 && \
     (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \
-    !defined(__CYGWIN__)
+    !defined(__CYGWIN__) && !defined(__WXWINCE__)
     #include <shlwapi.h>
 #endif
 
 // ---------------------------------------------------------------------------
 
 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
index e6419cac7e3bf4cabbe49beec854dea486aa5ad9..650e66e27ec128888da510fa767cf2dfafaeab23 100644 (file)
@@ -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; i<height; i++ )
+    {
+        for( j=0; j<width; j++ )
+        {
+            *(ptdata++) = *(ptbits+2);
+            *(ptdata++) = *(ptbits+1);
+            *(ptdata++) = *(ptbits  );
+            ptbits += 3;
+        }
+        ptbits += padding;
+    }
+
+    // TODO
+#if 0
+    // similarly, set data according to the possible mask bitmap
+    if( GetMask() && GetMask()->GetMaskBitmap() )
+    {
+        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<height; i++ )
+        {
+            for( j=0; j<width; j++ )
+            {
+                // is this pixel transparent?
+                if ( *ptbits != 0 )
+                {
+                    if ( (ptdata[0] == MASK_RED) &&
+                            (ptdata[1] == MASK_GREEN) &&
+                                (ptdata[2] == MASK_BLUE) )
+                    {
+                        // we have to fudge the colour a bit to prevent this
+                        // pixel from appearing transparent
+                        ptdata[2] = MASK_BLUE_REPLACEMENT;
+                    }
+                    ptdata += 3;
+                }
+                else // masked pixel
+                {
+                    *(ptdata++)  = MASK_RED;
+                    *(ptdata++)  = MASK_GREEN;
+                    *(ptdata++)  = MASK_BLUE;
+                }
+                ptbits += 3;
+            }
+            ptbits += padding;
+        }
+
+        image.SetMaskColour( MASK_RED, MASK_GREEN, MASK_BLUE );
+        image.SetMask( TRUE );
+    }
+    else
+#endif
+    {
+        image.SetMask( FALSE );
+    }
+
+    // free allocated resources
+    ::ReleaseDC(NULL, hdc);
+    free(lpDIBh);
+
+    // Delete the DIB section
+    ::DeleteObject(hBitmapSection);
+
+    return image;
+#else
     // 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;
@@ -968,6 +1172,7 @@ wxImage wxBitmap::ConvertToImage() const
     free(lpBits);
 
     return image;
+#endif
 }
 
 #endif // wxUSE_IMAGE
@@ -1211,6 +1416,7 @@ void wxBitmap::SetQuality(int WXUNUSED(quality))
 #ifdef wxHAVE_RAW_BITMAP
 void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
 {
+#if wxUSE_WXDIB
     if ( !Ok() )
     {
         // no bitmap, no data (raw or otherwise)
@@ -1277,10 +1483,14 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
     }
 
     return bits;
+#else
+    return NULL;
+#endif
 }
 
 void wxBitmap::UngetRawData(wxPixelDataBase& dataBase)
 {
+#if wxUSE_WXDIB
     if ( !Ok() )
         return;
 
@@ -1338,6 +1548,7 @@ void wxBitmap::UngetRawData(wxPixelDataBase& dataBase)
             delete dib;
         }
     }
+#endif
 }
 #endif // #ifdef wxHAVE_RAW_BITMAP
 
index f150ee844b97448e8a2f39699e5ed00d6cc2e628..c249267f04bc8d1e1fd9daf5d2f40639c98fab2d 100644 (file)
@@ -119,7 +119,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 
 bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
 {
-#if defined(__WIN95__)
+#ifndef __WXWINCE__
     long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
     if (style & BS_BITMAP)
     {
@@ -249,20 +249,21 @@ void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int botto
 
     // draw the border
     oldp = (HPEN) SelectObject( (HDC) dc, sel? penDkShadow : penHiLight);
-    MoveToEx((HDC) dc, left, top, NULL); LineTo((HDC) dc, right-1, top);
-    MoveToEx((HDC) dc, left, top+1, NULL); LineTo((HDC) dc, left, bottom-1);
+
+    wxDrawLine((HDC) dc, left, top, right-1, top);
+    wxDrawLine((HDC) dc, left, top+1, left, bottom-1);
 
     SelectObject( (HDC) dc, sel? penShadow : penLight);
-    MoveToEx((HDC) dc, left+1, top+1, NULL); LineTo((HDC) dc, right-2, top+1);
-    MoveToEx((HDC) dc, left+1, top+2, NULL); LineTo((HDC) dc, left+1, bottom-2);
+    wxDrawLine((HDC) dc, left+1, top+1, right-2, top+1);
+    wxDrawLine((HDC) dc, left+1, top+2, left+1, bottom-2);
 
     SelectObject( (HDC) dc, sel? penLight : penShadow);
-    MoveToEx((HDC) dc, left+1, bottom-2, NULL); LineTo((HDC) dc, right-1, bottom-2);
-    MoveToEx((HDC) dc, right-2, bottom-3, NULL); LineTo((HDC) dc, right-2, top);
+    wxDrawLine((HDC) dc, left+1, bottom-2, right-1, bottom-2);
+    wxDrawLine((HDC) dc, right-2, bottom-3, right-2, top);
 
     SelectObject( (HDC) dc, sel? penHiLight : penDkShadow);
-    MoveToEx((HDC) dc, left, bottom-1, NULL); LineTo((HDC) dc, right+2, bottom-1);
-    MoveToEx((HDC) dc, right-1, bottom-2, NULL); LineTo((HDC) dc, right-1, top-1);
+    wxDrawLine((HDC) dc, left, bottom-1, right+2, bottom-1);
+    wxDrawLine((HDC) dc, right-1, bottom-2, right-1, top-1);
 
     // delete allocated resources
     SelectObject((HDC) dc,oldp);
index 9f44181943b9ad86569adbf47eaea6b741e75656..f1109f4633f645a716f062dfa698dd05ac407640 100644 (file)
@@ -151,26 +151,30 @@ void wxBrushRefData::Free()
 
 static int TransllateHatchStyle(int style)
 {
+#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
     switch ( style )
     {
-#ifndef __WXMICROWIN__
         case wxBDIAGONAL_HATCH: return HS_BDIAGONAL;
         case wxCROSSDIAG_HATCH: return HS_DIAGCROSS;
         case wxFDIAGONAL_HATCH: return HS_FDIAGONAL;
         case wxCROSS_HATCH:     return HS_CROSS;
         case wxHORIZONTAL_HATCH:return HS_HORIZONTAL;
         case wxVERTICAL_HATCH:  return HS_VERTICAL;
-#endif // __WXMICROWIN__
         default:                return -1;
     }
+#else // __WXMICROWIN__
+    return -1;
+#endif
 }
 
 HBRUSH wxBrushRefData::GetHBRUSH()
 {
     if ( !m_hBrush )
     {
+#ifndef __WXWINCE__
         int hatchStyle = TransllateHatchStyle(m_style);
         if ( hatchStyle == -1 )
+#endif
         {
             switch ( m_style )
             {
@@ -196,10 +200,12 @@ HBRUSH wxBrushRefData::GetHBRUSH()
                     break;
             }
         }
+#ifndef __WXWINCE__
         else // create a hatched brush
         {
             m_hBrush = ::CreateHatchBrush(hatchStyle, m_colour.GetPixel());
         }
+#endif
 
         if ( !m_hBrush )
         {
index 2763c945b07dc6b5171c3e7dea6147fc51b3a494..52dbe0b5bd07b45d7324b92873ef199f9fe1d0d5 100644 (file)
@@ -424,11 +424,10 @@ static void DrawButtonText(HDC hdc,
 
 static void DrawRect(HDC hdc, const RECT& r)
 {
-    MoveToEx(hdc, r.left, r.top, NULL);
-    LineTo(hdc, r.right, r.top);
-    LineTo(hdc, r.right, r.bottom);
-    LineTo(hdc, r.left, r.bottom);
-    LineTo(hdc, r.left, r.top);
+    wxDrawLine(hdc, r.left, r.top, r.right, r.top);
+    wxDrawLine(hdc, r.right, r.top, r.right, r.bottom);
+    wxDrawLine(hdc, r.right, r.bottom, r.left, r.bottom);
+    wxDrawLine(hdc, r.left, r.bottom, r.left, r.top);
 }
 
 void wxButton::MakeOwnerDrawn()
@@ -542,24 +541,20 @@ static void DrawButtonFrame(HDC hdc, const RECT& rectBtn,
             InflateRect(&r, -1, -1);
         }
 
-        MoveToEx(hdc, r.left, r.bottom, NULL);
-        LineTo(hdc, r.right, r.bottom);
-        LineTo(hdc, r.right, r.top - 1);
+        wxDrawLine(hdc, r.left, r.bottom, r.right, r.bottom);
+        wxDrawLine(hdc, r.right, r.bottom, r.right, r.top - 1);
 
         (void)SelectObject(hdc, hpenWhite);
-        MoveToEx(hdc, r.left, r.bottom - 1, NULL);
-        LineTo(hdc, r.left, r.top);
-        LineTo(hdc, r.right, r.top);
+        wxDrawLine(hdc, r.left, r.bottom - 1, r.left, r.top);
+        wxDrawLine(hdc, r.left, r.top, r.right, r.top);
 
         (void)SelectObject(hdc, hpenLightGr);
-        MoveToEx(hdc, r.left + 1, r.bottom - 2, NULL);
-        LineTo(hdc, r.left + 1, r.top + 1);
-        LineTo(hdc, r.right - 1, r.top + 1);
+        wxDrawLine(hdc, r.left + 1, r.bottom - 2, r.left + 1, r.top + 1);
+        wxDrawLine(hdc, r.left + 1, r.top + 1, r.right - 1, r.top + 1);
 
         (void)SelectObject(hdc, hpenGrey);
-        MoveToEx(hdc, r.left + 1, r.bottom - 1, NULL);
-        LineTo(hdc, r.right - 1, r.bottom - 1);
-        LineTo(hdc, r.right - 1, r.top);
+        wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1);
+        wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top);
     }
 
     (void)SelectObject(hdc, hpenOld);
index c6b37213541e4a5f9f9b1788347ace58ec30983b..4274114bf99489537bbcaf4f7b02ec4fe8788c3b 100644 (file)
@@ -50,6 +50,8 @@
 #include <windows.h>
 #include <windowsx.h>
 
+#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,
index bfb991866d677280273bb248a9f79863a783915b..6cb5db6cc0c70620e75117598f4e927a2f1d5683 100644 (file)
@@ -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;
             }
index 706e220ae7ec369f353e751df76f2980d5b3b7c7..84ad0389ec7f1c7e02b4bf0ee1299dcb6faf4fe0 100644 (file)
 
 #include <windows.h>
 
-#if !defined(__WIN32__) || defined(__SALFORDC__)
-    #include <commdlg.h>
-#endif
-
 #include "wx/msw/private.h"
 #include "wx/colordlg.h"
 #include "wx/cmndata.h"
 
+#if !defined(__WIN32__) || defined(__WXWINCE__)
+    #include <commdlg.h>
+#endif
+
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
index f7c9e312e57bce7ec44959319806b66f0bee2594..e296bf6ca6a536ffb6a94a69f6042d297dc89db2 100644 (file)
@@ -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;
 
index 94cc8a9dc25155446a5cfd65f67f62174d2b59b4..81f642c81cb35d7dd5e102440c2578aebd5bf964 100644 (file)
@@ -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),
index e0a2166aea69ef8e4b2fe1133a3699c73ef8e223..7d596522decef19bf1fa4e34cad2d355c2d63c50 100644 (file)
@@ -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);
index 51f6c9c01e982c3e2e9355e845c66b8210f873b6..aac533377b575177fdc24c21ff9b33bf1379b6a2 100644 (file)
 #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,
index 9aa457995aa5eed14c0754a7a2e28ad6dc2c2ef0..3b42e9c0f7089b16150897835572c5fca7adf54c 100644 (file)
@@ -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
+    
index 724625bf1ad4b7130c09b07e33ae7209882743e0..514c4c3c89e3b8b9f08eed7cc0fa410083ed97e8 100644 (file)
 #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
 // ----------------------------------------------------------------------------
         return (attr & (_A_SYSTEM | _A_HIDDEN)) != 0;
     }
 #else // Win32
-    #include <windows.h>
-
     typedef WIN32_FIND_DATA FIND_STRUCT;
     typedef HANDLE FIND_DATA;
     typedef DWORD FIND_ATTR;
index 0c61464260741c4cfe7eb57b53f1d1ffa20318b4..5f9006fa2bd89ce5168763e1267a65d8eeaef390 100644 (file)
 
 #include "wx/msw/private.h"
 
+#ifdef __WXWINCE__
+#include <winreg.h>
+#include <objbase.h>
+#include <shlguid.h>
+#endif
 #include <shlobj.h> // 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:
index 7bb4c4def18ceb84482684bc6748bf2702892018..9427d3af72bd8300f14d3319ceda66cc9433067c 100644 (file)
@@ -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;
index cc2b94299d417b11f1c110ff992b266e83440ed7..76c85f3c8a9bb7a39156668d641ad2e89522e2e5 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "wx/msw/private.h"
 
-#if !defined(__WIN32__) || defined(__SALFORDC__)
+#if !defined(__WIN32__) || defined(__WXWINCE__)
     #include <commdlg.h>
 #endif
 
index 1e033933994393466fdf8a1994e5ed17aa03b97c..e3064ea425507db936796aaf2f2ffc3f0410b444 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "wx/msw/private.h"
 
-#if !defined(__WIN32__) || defined(__SALFORDC__)
+#if !defined(__WIN32__) || defined(__WXWINCE__)
     #include <commdlg.h>
 #endif
 
index 43f96242e81649932269c09618462bfe4399afe1..34ff09c2dd8267004c43fb3d1499e0602dca57da 100644 (file)
 #endif
 
 #include "wx/fontdlg.h"
+#include "wx/msw/private.h"
 
-#if !defined(__WIN32__) || defined(__SALFORDC__)
-#include <windows.h>
+#if !defined(__WIN32__) || defined(__WXWINCE__)
 #include <commdlg.h>
 #endif
 
-#include "wx/msw/private.h"
 #include "wx/cmndata.h"
 #include "wx/log.h"
 
index 8ed53278ae36c7edc86ee71836c42b4766fd726c..c732ae56930d0e4021d6b2b591ce0a18ee5e8861 100644 (file)
   #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));
index 76bba0ef4b8bc592a88add4332833ebcf2399041..3455129a19d7c5bd28bf5b028a2ef19c73a012e5 100644 (file)
 
 #include "wx/msw/private.h"
 
+#ifdef __WXWINCE__
+#include <commctrl.h>
+#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;
index 2bf6f0bce07ebdfd1b17e555930c8edc1afff53f..9ac518a0657c7618ea177fc99a12fc8c6b4a60db 100644 (file)
 
 #include "wx/bitmap.h"
 #include "wx/msw/gdiimage.h"
+
+#if wxUSE_WXDIB
 #include "wx/msw/dib.h"
+#endif
+
+#ifdef __WXWINCE__
+#include <winreg.h>
+#include <shellapi.h>
+#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;
 }
 
index 7078a1d946384e0881409b115a790b96cbfc495c..8a2e9e16fa05d29bd688690ad757af1c9ade60a3 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "wx/gdiobj.h"
 #include "wx/msw/private.h"
-#include "assert.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
 
index d9526df4ed04b55ce42a7a56fbd492f594735a76..342b7da070d45af37fa5e616513777f59e55328a 100644 (file)
@@ -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;
index 8a3588b32c2b0e4a7110372171fcccda3b16d3f7..c84ead3a3ba126f42ce9ac9557ea6f8bc0ff338d 100644 (file)
@@ -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);
index 6ad79060fc1bbd96b8d80f0d294db452fe2312e7..5617b1f15caa3ae57d0da7ee14457a0aeee6463b 100644 (file)
@@ -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
 
index 761bd75da688df04f6affdaa9036af01433b52ba..f1a7bb4a2c43a7b3fc5223d4118f6a17131f72b0 100644 (file)
@@ -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();
 }
index 887b57f94469ea0c599d7e1d6f8bea88e1a568fb..e55b17d3341cccdc3988854ee69a0e7e181297f4 100644 (file)
 
 #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
     }
 }
 
index e5e4eb07bbf91efd1b000ad5dc0e8140841275b7..3b5517b828914592bdb5f51821ca7a27743cb323 100644 (file)
@@ -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);
index 778cd6094149e48dfc21a7e96c3ba63ccb53635d..ed6efcdd49829699b3212819875dde91fdd4e461 100644 (file)
@@ -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)
index 4b2b77b108f9b11c3f1c86e2e807fe069a6c9f27..095c6e0119977ce200a76754a8664ee2c3b7bc0f 100644 (file)
 
 #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 <math.h>
+
+#ifdef __WXWINCE__
+#include "wx/msw/wince/time.h"
+#else
 #include <time.h>
+#endif
 
 #include <wtypes.h>
 #include <unknwn.h>
+
 #include <ole2.h>
 #define _huge
+
+#ifndef __WXWINCE__
 #include <ole2ver.h>
+#endif
+
 #include <oleauto.h>
 
 // Verifies will fail if the needed buffer size is too large
index 9e7b0363d15babf4de340b87745a23119863d0e9..b7dee87332966221b42a191ce081e0cf01d99058 100644 (file)
 
 #include "wx/msw/private.h"         // includes <windows.h>
 
+#ifdef __WXWINCE__
+#include <winreg.h>
+#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 <ole2.h>
 #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
 }
 
 // ----------------------------------------------------------------------------
index 45260de525601ed4c0368c7ee1e9c587144085d3..c0ea44375205e3895ad43d6bbc4a2bbe8c07e166 100644 (file)
 #include "wx/log.h"
 #include "wx/dnd.h"
 
-#include <windows.h>
+#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 <ole2.h>
 #endif
 
index e7982fb23741981549e7a8e983ea504632d27b94..8d8f6fbf1cd460a8cffb15ef8fc08c5380833be9 100644 (file)
 
 #if wxUSE_OLE && wxUSE_DRAG_AND_DROP
 
+#include "wx/msw/private.h"
 #include "wx/log.h"
 
+#ifdef __WXWINCE__
+    #include <winreg.h>
+    #include <ole2.h>
+#endif
+
 #ifdef __WIN32__
     #if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS
         #if wxCHECK_W32API_VERSION( 1, 0 )
 
 #include "wx/dnd.h"
 
-#ifndef __WIN32__
-    #include <ole2.h>
-    #include <olestd.h>
-#endif
-
 #include "wx/msw/ole/oleutils.h"
 
 // ----------------------------------------------------------------------------
index 1a0966bfd9103c316b28de29cf362962f8f08086..c54de1c5d97c736c092ef7bd1b40d902a08d4d4a 100644 (file)
 
 #ifndef __CYGWIN10__
 
-#include <windows.h>
+#include "wx/msw/private.h"
+
+#ifdef __WXWINCE__
+    #include <winreg.h>
+    #include <ole2.h>
+
+    #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)
index a7dc903a5df20282ef0947e6c0804c1acd9a2af5..959a6dc44df849f46048b754969647e1145c3eb4 100644 (file)
@@ -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)
index eb811168db18a0d2824a7d4c08915619d986e644..b47741145cf4d9e3723b52bee1b20f7fd805afd5 100644 (file)
@@ -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)
index 3718821eba32e3a1de0b7cdae1e0e3c23eff11ab..124ffdf6982617a9b7348cb6b5d247919e7c9a36 100644 (file)
@@ -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;
 
index 1e6e76fab0e52c31db8509c088bc3ce771752223..e6651489cc7b7a1be86ab290558131dc76d80d66 100644 (file)
@@ -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
index 620ff86358aab22d42711c9ab27557e4e8b38e82..7d8a62aca13ca32c58dbd84010e063d89aab04d1 100644 (file)
 
 #include  <windows.h>
 
+#ifdef __WXWINCE__
+#include "wx/msw/private.h"
+#include <winbase.h>
+#include <winreg.h>
+#endif
+
 // other std headers
 #include  <stdlib.h>      // 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;
   }
index fccc82bb709e3b3abab6ece0a7080892f232f930..9f7c9ce1467a57d2039461688a59520bc59bac9a 100644 (file)
@@ -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,
index 268cdd874ed2e41dc9f08aab596cbe9b0e273eaa..1c5c52d6729235f7ff9c2c510ab126429652c2b3 100644 (file)
@@ -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
index 3e07c77a938ed791e5bb56b2e3ba91baa76a4790..c6d402a15a4544875d24ccdd192a783530599407 100644 (file)
@@ -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);
 }
index d4a9711d9d0bafc775daa463af576b87d08d1806..07f6dfe1a9cb6ee30a8b148d1f7f754771400b78 100644 (file)
@@ -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);
 }
index 80c77ce5ce534c930abb8e03cdfa0f6846a67575..2689d61fc99f8213da107669bc2c9d8575e8856e 100644 (file)
@@ -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
index d28a6b8ae85c9c5a8f4583087472fbb7992cd26b..16fa083f6d4d11babf70ec863c86da88dc0fd3b9 100644 (file)
@@ -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,
index 65906af29803c57e39552b1618411ef9a888275a..510292b1517c2098806c94c6a38c969edc19b00b 100644 (file)
@@ -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
index 12562fa5f754191294352087500de56b54256ff4..4f3e3ab4c0c502b03d38a83f77fde292a74925ff 100644 (file)
@@ -30,7 +30,7 @@
 #include "malloc.h"
 #endif
 
-#include <windows.h>
+#include "wx/msw/private.h"
 
 #if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
     #include <commctrl.h>
@@ -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);
     }
index 4a76e3e01814bab2a55b9cb6e0fa9757cc3cfce0..cc2b9bc9c52edf7672433dcab67c609f5dd5b02f 100644 (file)
 
 #if defined(__WIN95__)
 
-#include <windows.h>
-
+#include "wx/msw/private.h"
 #include "wx/msw/winundef.h"
 
 #include <string.h>
 #include "wx/taskbar.h"
-#include "wx/msw/private.h"
 
 #ifdef __GNUWIN32_OLD__
     #include "wx/msw/gnuwin32/extra.h"
 #endif
 
-#ifdef __SALFORDC__
+#ifdef __WXWINCE__
+    #include <winreg.h>
     #include <shellapi.h>
 #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
index ba253ef85b484126d7aeea2784b8f35581add939..05df7e86d299124d2adcc028d3ae79b4ee27a0c9 100644 (file)
 
 #include <string.h>
 #include <stdlib.h>
+
+#ifndef __WXWINCE__
 #include <sys/types.h>
+#endif
 
 #if wxUSE_RICHEDIT
 
index d59a960162dfcd9362937eff88ed2bc1d6fd93e5..976c7412d683b887b2f9c33adde2282502275ad5 100644 (file)
     (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 <process.h>
@@ -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;
 }
 
index 14c53817f0eadd70eefed8de5027a2b70f83cd3e..3781b06f2b040e765fdb84c258eaa59c6196d847 100644 (file)
@@ -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
index d0ae7e02c36e029c4eaefd63a31e57f299c76467..961cd90c52989723b0181b633318bb2344bfb7da 100644 (file)
 #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
 }
 
 // ----------------------------------------------------------------------------
index 3850a53d1040f9c9a74e73e029c4b25a37a02f62..9b79bec3a89f83ca32a59fd3b1a6e7cf23f1289e 100644 (file)
@@ -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 <direct.h>
 
     #ifndef __MWERKS__
@@ -74,7 +74,7 @@
     #include <lm.h>
 #endif // USE_NET_API
 
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
     #ifndef __UNIX__
         #include <io.h>
     #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
index aca3e0336c8eaec2ff4b9f1ed3ebc2b166003c78..e1e0d9dc989341829f5f633a68df2497b4aba801 100644 (file)
@@ -46,7 +46,7 @@
 
 #include <ctype.h>
 
-#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__)
+#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
     #include <direct.h>
 #ifndef __MWERKS__
     #include <dos.h>
@@ -58,7 +58,7 @@
     #include <sys/stat.h>
 #endif
 
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
 #ifndef __UNIX__
     #include <io.h>
 #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
index 00cb07b33b5c69ea36ff51e298a9f9ab3092bb08..9b14ea38ac413831d2b49a05e37cb75594280e83 100644 (file)
@@ -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
+}
+
 
index d3ff52853b366692760a584ed2cbc0158e33d64c..083a7abc84f0db879435b15e895db46d60fecc37 100644 (file)
@@ -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;
index afd4aa4b936fcd1ee8d69a19e615d5e0ebbe2e5c..99814647fa924f93c7a64126c166e2e0650af138 100644 (file)
@@ -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;
index abdcc7dac160cf78ba010f5a96d22b91d637bbcf..01bca8a3f5c25e687001710234f1ee2d2e58e3ff 100644 (file)
@@ -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,