Esempio n. 1
0
void CGalleryItemStyleSet::Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked)
{
	CXTPPaintManager* pPaintManager = pGallery->GetPaintManager();

	COLORREF clrTextColor = pPaintManager->GetRectangleTextColor(bSelected, bPressed, bEnabled, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);

	pDC->SetTextColor(clrTextColor);
	CXTPFontDC font(pDC, pPaintManager->GetRegularFont());

	int cx = pPaintManager->GetPopupBarGripperWidth(pGallery->GetParent()) - 1;
	pPaintManager->DrawPopupBarGripper(pDC, rcItem.left - 1, rcItem.top, cx + 1, rcItem.Height());

	pPaintManager->DrawRectangle(pDC, rcItem, bSelected, bPressed, bEnabled, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);

	if (bChecked && bEnabled)
	{
		CRect rcCheck(rcItem.left + 1, rcItem.top + 1, rcItem.left + cx - 2, rcItem.bottom - 1);
		pPaintManager->DrawRectangle(pDC, rcCheck, bSelected, bPressed, bEnabled, TRUE, FALSE, xtpBarTypePopup, xtpBarPopup);
		
		pPaintManager->DrawCheckMark(pDC, rcCheck);
	}

	CRect rcText(rcItem);
	rcText.left += pPaintManager->m_nPopupBarTextPadding + cx;

	pDC->DrawText(m_strCaption, rcText, DT_END_ELLIPSIS|DT_SINGLELINE|DT_VCENTER);
}
Esempio n. 2
0
void CGalleryItemFontFace::Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL /*bPressed*/, BOOL bChecked)
{
	CXTPPaintManager* pPaintManager = pGallery->GetPaintManager();

	pPaintManager->DrawRectangle(pDC, rcItem, bSelected, FALSE, bEnabled, bChecked, FALSE, xtpBarTypePopup, xtpBarPopup);

	COLORREF clrTextColor = pPaintManager->GetRectangleTextColor(bSelected, FALSE, bEnabled, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);
	pDC->SetTextColor(clrTextColor);

	CFont fnt;
	fnt.CreatePointFont(150, m_strCaption);

	CXTPFontDC font(pDC, &fnt);

	CRect rcText(rcItem);
	rcText.left += 4;

	pDC->DrawText(m_strCaption, rcText, DT_END_ELLIPSIS|DT_SINGLELINE|DT_VCENTER);
}
Esempio n. 3
0
void CGalleryItemThemeColors::Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked)
{
	CXTPPaintManager* pPaintManager = pGallery->GetPaintManager();

	COLORREF clrTextColor = pPaintManager->GetRectangleTextColor(bSelected, bPressed, bEnabled, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);

	pDC->SetTextColor(clrTextColor);
	CXTPFontDC font(pDC, pPaintManager->GetRegularFont());

	pPaintManager->DrawRectangle(pDC, rcItem, bSelected, bPressed, bEnabled, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);

	CRect rcPreview(rcItem.left + 2, rcItem.top + 2, rcItem.left + 2 + 108, rcItem.bottom - 2);

	if (bChecked && bEnabled)
	{
		pPaintManager->DrawRectangle(pDC, rcPreview, bSelected, bPressed, bEnabled, TRUE, FALSE, xtpBarTypeNormal, xtpBarPopup);
	}

	CRect rcColor(rcPreview);
	rcColor.DeflateRect(2, 2);
	rcColor.right = rcColor.left + rcColor.Height();

	const COLORPREVIEW& clrPreview = themeColors[GetID()];
	int nOrder[] = {3, 2, 4, 5, 6, 7, 8, 9};

	for (int i = 0; i < _countof(nOrder); i++)
	{
		pDC->FillSolidRect(rcColor, clrPreview.rec[nOrder[i]].clr);
		pDC->Draw3dRect(rcColor, RGB(134, 134, 134), RGB(134, 134, 134));
		
		rcColor.OffsetRect(rcColor.Width() + 1, 0);
	}

	CRect rcText(rcItem);
	rcText.left += 120;
	pDC->DrawText(m_strCaption, rcText, DT_END_ELLIPSIS|DT_SINGLELINE|DT_VCENTER);
}