X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57c208c5759da71a637f0f0f5b7d3dc3eda09c02..0ae2df30524bb07bcca824bd0a842bd54a305ff3:/src/msw/curico.cpp diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 4811882fac..5bd16e67a0 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -19,14 +19,21 @@ #include #include +#if defined(__MWERKS__) +#include +#include +#endif + #ifndef __TWIN32__ -#ifdef __GNUWIN32__ +#if defined (__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) #include "wx/msw/gnuwin32/extra.h" #endif #endif +#include "wx/wxchar.h" #include "wx/msw/curicop.h" #include "wx/msw/curico.h" +#include "wx/string.h" //***************************************************************************** //* Function : ReadIconFile() * @@ -37,7 +44,7 @@ //* be created for any reason. * //***************************************************************************** -HICON ReadIconFile( char *szFileName, HINSTANCE hInst, int *W, int *H) +HICON ReadIconFile( wxChar *szFileName, HINSTANCE hInst, int *W, int *H) { HICON hIcon; HANDLE hDIB; @@ -60,7 +67,7 @@ HICON ReadIconFile( char *szFileName, HINSTANCE hInst, int *W, int *H) //* monochrome. * //***************************************************************************** -HICON CursorToIcon( char *szFileName, HINSTANCE hInst, int *W, int *H) +HICON CursorToIcon( wxChar *szFileName, HINSTANCE hInst, int *W, int *H) { HANDLE hDIB; // Handle to DIB memory HICON hIcon; // Handle to Icon @@ -80,7 +87,7 @@ HICON CursorToIcon( char *szFileName, HINSTANCE hInst, int *W, int *H) //* is corrupt or if memory cannot be allocated for the DIB info. * //***************************************************************************** -HANDLE ReadIcon( char *szFileName, int *W, int *H) +HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) { ICONFILEHEADER iconFileHead; // ICON file header structure ICONFILERES iconFileRes; // ICON file resource WORD cbHead, @@ -94,7 +101,7 @@ HANDLE ReadIcon( char *szFileName, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( szFileName, OF_READ); + hFile = _lopen( wxFNCONV(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER)); cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES)); ++nDirEntries; @@ -211,7 +218,7 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) lpDIB->bmiHeader.biBitCount))); // Get a hDC so we can create a bitmap compatible with it - hDC = CreateDC( "DISPLAY", NULL, NULL, NULL); + hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader), @@ -272,7 +279,7 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) //* be created for any reason. * //***************************************************************************** -HCURSOR ReadCursorFile( char *szFileName, HINSTANCE hInst, int *W, int *H, +HCURSOR ReadCursorFile( wxChar *szFileName, HINSTANCE hInst, int *W, int *H, int *XHot, int *YHot) { HANDLE hDIB; // Handle to DIB memory HCURSOR hCursor; @@ -301,7 +308,7 @@ HCURSOR ReadCursorFile( char *szFileName, HINSTANCE hInst, int *W, int *H, //* monochrome. * //***************************************************************************** -HCURSOR IconToCursor( char *szFileName, HINSTANCE hInst, int XHot, int YHot, +HCURSOR IconToCursor( wxChar *szFileName, HINSTANCE hInst, int XHot, int YHot, int *W, int *H) { HCURSOR hCursor; HANDLE hDIB; @@ -327,7 +334,7 @@ HCURSOR IconToCursor( char *szFileName, HINSTANCE hInst, int XHot, int YHot, //* is corrupt or if memory cannot be allocated for the DIB info. * //***************************************************************************** -HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) +HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) { CURFILEHEADER curFileHead; // CURSOR file header structure CURFILERES curFileRes; // CURSOR file resource WORD cbHead, @@ -341,7 +348,7 @@ HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( szFileName, OF_READ); + hFile = _lopen( wxFNCONV(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER)); cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); ++nDirEntries; @@ -572,7 +579,7 @@ HCURSOR MakeCursor( HANDLE hDIB, LPPOINT lpptHotSpot, HINSTANCE hInst) lpDIB->bmiHeader.biBitCount))); // Get a hDC so we can create a bitmap compatible with it - hDC = CreateDC( "DISPLAY", NULL, NULL, NULL); + hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth, @@ -693,7 +700,7 @@ WORD DIBNumColors ( LPSTR pv) #if 0 // ****************************************************************** -BOOL fGetXPixmap( BOOL fIsIcon, char *szFileName, HINSTANCE hInst, +BOOL fGetXPixmap( BOOL fIsIcon, wxChar *szFileName, HINSTANCE hInst, char cData[], int &width, int &height) { HDC hdc, hdcMemory; @@ -815,10 +822,17 @@ HCURSOR MakeCursorFromBitmap(HINSTANCE hInst, HBITMAP hBitmap, POINT *pPoint) DeleteObject(hXorBmp); ReleaseDC(NULL, hDC); #ifndef __WIN32__ +#ifdef STRICT + LocalUnlock(LocalHandle((void NEAR*) andBits)); + LocalUnlock(LocalHandle((void NEAR*) xorBits)); + LocalFree(LocalHandle((void NEAR*) andBits)); + LocalFree(LocalHandle((void NEAR*) xorBits)); +#else LocalUnlock(LocalHandle((WORD) andBits)); LocalUnlock(LocalHandle((WORD) xorBits)); LocalFree(LocalHandle((WORD) andBits)); LocalFree(LocalHandle((WORD) xorBits)); +#endif #else LocalUnlock(LocalHandle((LPCVOID) andBits)); LocalUnlock(LocalHandle((LPCVOID) xorBits)); @@ -886,10 +900,17 @@ HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap) DeleteObject(hXorBmp); ReleaseDC((HWND) NULL, hDC); #ifndef __WIN32__ +#ifdef STRICT + LocalUnlock(LocalHandle((void NEAR*) andBits)); + LocalUnlock(LocalHandle((void NEAR*) xorBits)); + LocalFree(LocalHandle((void NEAR*) andBits)); + LocalFree(LocalHandle((void NEAR*) xorBits)); +#else LocalUnlock(LocalHandle((WORD) andBits)); LocalUnlock(LocalHandle((WORD) xorBits)); LocalFree(LocalHandle((WORD) andBits)); LocalFree(LocalHandle((WORD) xorBits)); +#endif #else LocalUnlock(LocalHandle((LPCVOID) andBits)); LocalUnlock(LocalHandle((LPCVOID) xorBits));