Applied patch #1396039 (Notebook tab bitmaps)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2006-01-03 16:52:50 +00:00
parent 224016a800
commit 59fb774d92
3 changed files with 79 additions and 1 deletions

View File

@@ -293,6 +293,7 @@ extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message
// OS/2 convention of the mask is opposed to the wxWidgets one, so we need
// to invert the mask each time we pass one/get one to/from Windows
extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
extern HBITMAP wxFlipBmp(HBITMAP hbmp, int w = 0, int h = 0);
// ---------------------------------------------------------------------------
// global data

View File

@@ -1620,3 +1620,80 @@ HBITMAP wxInvertMask(
return hBmpInvMask;
} // end of WxWinGdi_InvertMask
HBITMAP wxFlipBmp( HBITMAP hBmp, int nWidth, int nHeight )
{
wxCHECK_MSG( hBmp, 0, _T("invalid bitmap in wxFlipBmp") );
//
// Get width/height from the bitmap if not given
//
if (!nWidth || !nHeight)
{
BITMAPINFOHEADER2 vBmhdr;
vBmhdr.cbFix = 16;
::GpiQueryBitmapInfoHeader( hBmp,
&vBmhdr );
nWidth = (int)vBmhdr.cx;
nHeight = (int)vBmhdr.cy;
}
BITMAPINFOHEADER2 vBmih;
SIZEL vSize = {0, 0};
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
HDC hDCSrc = ::DevOpenDC( vHabmain,
OD_MEMORY,
"*",
5L,
(PDEVOPENDATA)&vDop,
NULLHANDLE );
HDC hDCDst = ::DevOpenDC( vHabmain,
OD_MEMORY,
"*",
5L,
(PDEVOPENDATA)&vDop,
NULLHANDLE );
HPS hPSSrc = ::GpiCreatePS( vHabmain,
hDCSrc,
&vSize,
PU_PELS | GPIA_ASSOC );
HPS hPSDst = ::GpiCreatePS( vHabmain,
hDCDst,
&vSize,
PU_PELS | GPIA_ASSOC );
POINTL vPoint[4] = { {0, nHeight},
{nWidth, 0},
{0, 0},
{nWidth, nHeight} };
memset(&vBmih, '\0', 16);
vBmih.cbFix = 16;
vBmih.cx = nWidth;
vBmih.cy = nHeight;
vBmih.cPlanes = 1;
vBmih.cBitCount = 24;
HBITMAP hInvBmp = ::GpiCreateBitmap( hPSDst,
&vBmih,
0L,
NULL,
NULL );
::GpiSetBitmap(hPSSrc, (HBITMAP) hBmp);
::GpiSetBitmap(hPSDst, (HBITMAP) hInvBmp);
::GpiBitBlt( hPSDst,
hPSSrc,
4L,
vPoint,
ROP_SRCCOPY,
BBO_IGNORE );
::GpiDestroyPS(hPSSrc);
::GpiDestroyPS(hPSDst);
::DevCloseDC(hDCSrc);
::DevCloseDC(hDCDst);
return hInvBmp;
} // end of wxFlipBmp

View File

@@ -318,7 +318,7 @@ bool wxNotebook::SetPageImage (
return (bool)::WinSendMsg( GetHWND()
,BKM_SETTABBITMAP
,MPFROMLONG((ULONG)m_alPageId[nPage])
,(MPARAM)vBitmap.GetHBITMAP()
,(MPARAM)wxFlipBmp(vBitmap.GetHBITMAP())
);
} // end of wxNotebook::SetPageImage