//***************************************************************************** void CMacStyle::DrawNcBtn (CDC* pDC, const CRect& rect, UINT nButton, BCGBUTTON_STATE state, BOOL bActive) { ASSERT_VALID (pDC); CBCGPToolBarImages* pImage = NULL; if (nButton == SC_CLOSE) { pImage = &m_SysBtnClose; } else if (nButton == SC_MINIMIZE) { pImage = &m_SysBtnMinimize; } else if (nButton == SC_MAXIMIZE) { pImage = &m_SysBtnMaximize; } else if (nButton == SC_RESTORE) { pImage = &m_SysBtnRestore; } else { return; } CBCGPToolBarImages::ImageAlignHorz horz = CBCGPToolBarImages::ImageAlignHorzCenter; CBCGPToolBarImages::ImageAlignVert vert = CBCGPToolBarImages::ImageAlignVertCenter; CRect rtBtnImage (CPoint (0, 0), pImage->GetImageSize ()); if (!bActive) { rtBtnImage.OffsetRect (0, pImage->GetImageSize ().cy); } int index = 0; if (!bActive) { index = 3; } else if (state != ButtonsIsRegular) { if (state == ButtonsIsPressed) { index = 2; } else { index = 1; } } m_ctrlSysBtnBack.Draw (pDC, rect, index); pImage->DrawEx (pDC, rect, 0, horz, vert, rtBtnImage); }
void CVisualManager::DrawNcBtn (CDC* pDC, const CRect& rect, UINT nButton, BCGBUTTON_STATE state, BOOL /*bSmall*/, BOOL bActive, BOOL /*bMDI*/) { ASSERT_VALID (pDC); CBCGPToolBarImages* pImage = NULL; int nIndex = 1; if (nButton == SC_CLOSE) { pImage = &m_SysBtnClose; nIndex = 3; } else if (nButton == SC_MINIMIZE) { pImage = &m_SysBtnMinimize; nIndex = 1; } else if (nButton == SC_MAXIMIZE) { pImage = &m_SysBtnMaximize; nIndex = 2; } else if (nButton == SC_RESTORE) { pImage = &m_SysBtnRestore; nIndex = 2; } else { return; } if (bActive) { if (state != ButtonsIsRegular) { m_SysBtnBack[nIndex].DrawEx (pDC, rect, state == ButtonsIsHighlighted ? 0 : 1, CBCGPToolBarImages::ImageAlignHorzLeft, CBCGPToolBarImages::ImageAlignVertTop); } } pImage->DrawEx (pDC, rect, 0, CBCGPToolBarImages::ImageAlignHorzCenter, CBCGPToolBarImages::ImageAlignVertTop); }
void BCGPResizeImage32 ( CBCGPToolBarImages& imageSrc, CBCGPToolBarImages& imageDst, int index, CBCGPToolBarImages::ImageAlignHorz horz, CBCGPToolBarImages::ImageAlignVert vert, CBCGPZoomKernel::XFilterType ft ) { CSize sizeSrc (imageSrc.GetImageSize ()); CSize sizeDst (imageDst.GetImageSize ()); imageDst.Clear (); imageDst.SetPreMultiplyAutoCheck (TRUE); imageDst.SetTransparentColor ((COLORREF) -1); imageDst.SetImageSize (sizeDst); if (sizeSrc != sizeDst) { CSize size (sizeDst); if (horz == CBCGPToolBarImages::ImageAlignHorzStretch) { size.cx = sizeSrc.cx; } if (vert == CBCGPToolBarImages::ImageAlignVertStretch) { size.cy = sizeSrc.cy; } int nStart = 0; int nEnd = imageSrc.GetCount (); if (index != -1) { nStart = index; nEnd = nStart + 1; } for (int i = nStart; i < nEnd; i++) { CMemoryDC dc; dc.SetSize (size); CBitmap* bmpImage = &dc.GetBitmap (); imageSrc.DrawEx (&dc.GetDC (), CRect (CPoint (0, 0), size), i, horz, vert); CMemoryDC dcImage; if (horz == CBCGPToolBarImages::ImageAlignHorzStretch || vert == CBCGPToolBarImages::ImageAlignVertStretch) { dcImage.SetSize (sizeDst); bmpImage = &dcImage.GetBitmap (); CBCGPScanlinerBitmap ms; ms.Attach ((HBITMAP) dc.GetBitmap ()); CBCGPScanlinerBitmap md; md.Attach ((HBITMAP) dcImage.GetBitmap ()); BCGPResizeImage32 (md, sizeDst.cx, sizeDst.cy, ms, size.cx, size.cy, ft); } CBitmap bitmap; bitmap.Attach (CBCGPDrawManager::CreateBitmap_32 (*bmpImage)); imageDst.AddImage (bitmap, TRUE); } } else { imageDst.AddImage (imageSrc, index); } }