BOOL CBCGPMSMToolBar::DrawButton(CDC* pDC, CBCGPToolbarButton* pButton, CBCGPToolBarImages* pImages, BOOL bHighlighted, BOOL bDrawDisabledImages) { ASSERT_VALID (pDC); ASSERT_VALID (pButton); CBCGPToolBarImages* pNewImages = pImages; CBCGPDrawState ds; if (!m_bMenuMode && (pButton->m_nStyle & (TBBS_PRESSED)) && m_PressedImages.GetCount () > 0) { pNewImages = &m_PressedImages; pNewImages->SetTransparentColor (globalData.clrBtnFace); pNewImages->PrepareDrawImage (ds, GetImageSize (), FALSE); } if (!CBCGPToolBar::DrawButton (pDC, pButton, pNewImages, bHighlighted, bDrawDisabledImages)) { return FALSE; } if (pNewImages != pImages) { pNewImages->EndDrawImage (ds); } return TRUE; }
//******************************************************************* void CButtonAppearanceDlg::OnPaint() { CPaintDC dc(this); // device context for painting if (m_pUserTool != NULL) { m_pUserTool->DrawToolIcon (&dc, m_rectDefaultImage); return; } if (m_pButton->IsLocked ()) { BOOL bText = m_pButton->m_bText; BOOL bImage = m_pButton->m_bImage; m_pButton->m_bText = FALSE; m_pButton->m_bImage = TRUE; m_pButton->OnDraw (&dc, m_rectDefaultImage, NULL, TRUE, FALSE, FALSE, FALSE, FALSE); m_pButton->m_bText = bText; m_pButton->m_bImage = bImage; return; } int iImage = CBCGPToolBar::GetDefaultImage (m_pButton->m_nID); if (iImage < 0 || !m_bImage) { return; } CBCGPToolBarImages* pImages = CBCGPToolBar::GetImages (); ASSERT (pImages != NULL); CBCGPDrawState ds(CBCGPVisualManager::GetInstance()->IsAutoGrayscaleImages()); pImages->PrepareDrawImage (ds, m_rectDefaultImage.Size ()); pImages->Draw (&dc, m_rectDefaultImage.left, m_rectDefaultImage.top, iImage); pImages->EndDrawImage (ds); }
//********************************************************************** BOOL CBCGPToolTipCtrl::OnDrawIcon (CDC* pDC, CRect rectImage) { ASSERT_VALID (pDC); #ifndef BCGP_EXCLUDE_RIBBON if (m_pRibbonButton != NULL) { ASSERT_VALID (m_pRibbonButton); m_pRibbonButton->OnDrawTooltipImage(pDC, (CBCGPBaseRibbonElement::RibbonImageType) m_nRibbonImageType, rectImage); return TRUE; } #endif if (m_pHotButton == NULL) { return FALSE; } ASSERT_VALID (m_pHotButton); CBCGPToolBarImages* pImages = m_pToolBarImages; CBCGPToolBar* pToolBar = DYNAMIC_DOWNCAST(CBCGPToolBar, m_pHotButton->GetParentWnd()); if (pToolBar != NULL) { ASSERT_VALID(pToolBar); pToolBar->CheckForButtonImages(m_pHotButton, &pImages); } if (pImages == NULL) { return FALSE; } ASSERT_VALID(pImages); CBCGPDrawState ds(CBCGPVisualManager::GetInstance()->IsAutoGrayscaleImages()); pImages->PrepareDrawImage (ds); UINT nSaveStyle = m_pHotButton->m_nStyle; BOOL bSaveText = m_pHotButton->m_bText; BOOL bSaveImage = m_pHotButton->m_bImage; BOOL bSaveLargeIcons = CBCGPToolBar::m_bLargeIcons; CBCGPToolBar::m_bLargeIcons = FALSE; m_pHotButton->m_bText = FALSE; m_pHotButton->m_bImage = TRUE; m_pHotButton->m_nStyle = 0; m_pHotButton->CBCGPToolbarButton::OnDraw (pDC, rectImage, pImages); m_pHotButton->m_nStyle = nSaveStyle; m_pHotButton->m_bText = bSaveText; m_pHotButton->m_bImage = bSaveImage; CBCGPToolBar::m_bLargeIcons = bSaveLargeIcons; pImages->EndDrawImage (ds); return TRUE; }