Ejemplo 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);
}
CRect CXTPControlScrollBar::GetScrollBarRect()
{
	CRect rcItem(GetRect());
	rcItem.DeflateRect(2, 2, 2, 2);

	if (m_pParent->GetType() == xtpBarTypePopup && m_pParent->GetPosition() == xtpBarPopup)
	{
		CXTPPaintManager* pPaintManager = GetPaintManager();
		rcItem.left += pPaintManager->GetPopupBarGripperWidth(GetParent())
			+ pPaintManager->m_nPopupBarTextPadding - 2;
	}

	return rcItem;
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
void CGalleryItemThemeFonts::Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked)
{
	CXTPPaintManager* pPaintManager = pGallery->GetPaintManager();
	pPaintManager->DrawRectangle(pDC, rcItem, bSelected, bPressed, bEnabled, bChecked, FALSE, xtpBarTypeNormal, xtpBarPopup);

	CRect rcPreview(rcItem.left + 6, rcItem.top + 6, rcItem.left + 6 + 43, rcItem.bottom - 6);
	pDC->Draw3dRect(rcPreview, RGB(97, 108, 129), RGB(97, 108, 129));
	rcPreview.DeflateRect(1, 1);
	pDC->Draw3dRect(rcPreview, RGB(255, 255, 255), RGB(255, 255, 255));
	rcPreview.DeflateRect(1, 1);
	pDC->Draw3dRect(rcPreview, RGB(195, 200, 213), RGB(195, 200, 213));
	rcPreview.DeflateRect(1, 1);
	pDC->FillSolidRect(rcPreview, RGB(243, 243, 244));
	
	pDC->SetTextColor(0);

	const FONTPREVIEW& fontPreview = themeFonts[GetID()];

	CFont fntBody;
	fntBody.CreatePointFont(130, fontPreview.lpszBody);
	
	CFont fntHeadings;
	fntHeadings.CreatePointFont(120, fontPreview.lpszHeadings);

	CRect rcFontPreviewBody(rcPreview.left + 5, rcPreview.top, rcPreview.right, rcPreview.bottom - 5);
	CXTPFontDC fnt(pDC, &fntBody);
	pDC->DrawText(_T("A"), rcFontPreviewBody, DT_BOTTOM | DT_SINGLELINE);

	CRect rcFontPreviewBodyText(rcItem.left + 70, rcItem.top + 17, rcItem.right, rcItem.bottom);
	pDC->DrawText(fontPreview.lpszBody, rcFontPreviewBodyText, DT_TOP | DT_SINGLELINE);

	CRect rcFontPreviewHeadings(rcPreview.left + 20, rcPreview.top, rcPreview.right, rcPreview.bottom - 5);
	fnt.SetFont(&fntHeadings);
	pDC->DrawText(_T("a"), rcFontPreviewHeadings, DT_BOTTOM | DT_SINGLELINE);

	CRect rcFontPreviewHeadingsText(rcItem.left + 70, rcItem.top + 37, rcItem.right, rcItem.bottom);
	pDC->DrawText(fontPreview.lpszHeadings, rcFontPreviewHeadingsText, DT_TOP | DT_SINGLELINE);

}
Ejemplo n.º 5
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);
}