X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65fd5cb0124e62ab1fc41f93382a205d95b00e75..150c8d89c7f5e04045e55391b34167f2c4165b8b:/src/msw/curico.cpp diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 5bd16e67a0..572b231f7f 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -16,7 +16,9 @@ #pragma hdrstop #endif -#include +#ifndef __UNIX__ + #include +#endif #include #if defined(__MWERKS__) @@ -24,10 +26,8 @@ #include #endif -#ifndef __TWIN32__ -#if defined (__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) -#include "wx/msw/gnuwin32/extra.h" -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif #include "wx/wxchar.h" @@ -90,7 +90,7 @@ HICON CursorToIcon( wxChar *szFileName, HINSTANCE hInst, 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, + UINT cbHead, cbRes, cbBits; // Used for reading in file int hFile; // File handle @@ -101,7 +101,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER)); cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES)); ++nDirEntries; @@ -177,7 +177,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) //* bitmaps. So, no need to convert the AND bitmask. * //* 7) Since a DIB is stored upside down, flip the monochrome AND bits* //* by scanlines. * -//* 8) Use the XOR and AND bits and create an icon with CreateIcon. * +//* 8) Use the XOR and AND bits and create an icon with CreateIcon. * //***************************************************************************** HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) @@ -218,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( _T("DISPLAY"), NULL, NULL, NULL); + hDC = CreateDC( wxT("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader), @@ -255,8 +255,8 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) szFlip[(k - 1) - j] = *(DWORD FAR *)lpANDbits; // 8) Use the XOR and AND bits and create an icon with CreateIcon. - hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, bmpXor.bmPlanes, - bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB); + hIcon = CreateIcon( hInst, bmpXor.bmWidth, bmpXor.bmHeight, (BYTE)bmpXor.bmPlanes, + (BYTE)bmpXor.bmBitsPixel, (const BYTE *)szFlip, (const BYTE *)lpXorDDB); // Clean up before exiting. DeleteObject( hbmXor); @@ -337,7 +337,7 @@ HCURSOR IconToCursor( wxChar *szFileName, HINSTANCE hInst, int XHot, int YHot, HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) { CURFILEHEADER curFileHead; // CURSOR file header structure CURFILERES curFileRes; // CURSOR file resource - WORD cbHead, + UINT cbHead, cbRes, cbBits; // Used for reading in file LPBITMAPINFO lpDIB; // Pointer to DIB memory @@ -348,7 +348,7 @@ HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER)); cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); ++nDirEntries; @@ -579,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( _T("DISPLAY"), NULL, NULL, NULL); + hDC = CreateDC( wxT("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth, @@ -646,9 +646,9 @@ WORD PaletteSize( LPSTR pv) NumColors = DIBNumColors((LPSTR )lpbi); if(lpbi->biSize == sizeof( BITMAPCOREHEADER)) // OS/2 style DIBs - return NumColors * sizeof( RGBTRIPLE); + return (WORD)(NumColors * sizeof( RGBTRIPLE)); else - return NumColors * sizeof( RGBQUAD); + return (WORD)(NumColors * sizeof( RGBQUAD)); } //***************************************************************************** @@ -674,7 +674,7 @@ WORD DIBNumColors ( LPSTR pv) // is in biClrUsed, whereas in the BITMAPCORE - style headers, it // is dependent on the bits per pixel ( = 2 raised to the power of // bits/pixel). - + if(lpbi->biSize != sizeof( BITMAPCOREHEADER)) { if(lpbi->biClrUsed != 0) @@ -845,7 +845,7 @@ HCURSOR MakeCursorFromBitmap(HINSTANCE hInst, HBITMAP hBitmap, POINT *pPoint) /* * This doesn't work: just gives us a grey square. Ideas, anyone? */ - + HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap) { HDC hDCColor, hDCMono;