//-------------------------------------------------------------------------------//
void CBCGPAutoHideToolBar::DoPaint(CDC* pDC)
{
	ASSERT_VALID (pDC);

	CBCGPMemDC memDC (*pDC, this);
	
	CBCGPControlBar::DoPaint (&memDC.GetDC ());

	CBCGPAutoHideButton* pBtnTop = NULL;
	
	for (POSITION pos = m_lstAutoHideButtons.GetHeadPosition (); pos != NULL;)
	{
		CBCGPAutoHideButton* pBtn = (CBCGPAutoHideButton*) m_lstAutoHideButtons.GetNext (pos);
		ASSERT_VALID (pBtn);
		if (pBtn->IsTop ())
		{
			pBtnTop = pBtn;
		}
		else if (pBtn->IsVisible ())
		{
			pBtn->OnDraw (&memDC.GetDC ());
		}
	}

	if (pBtnTop != NULL && pBtnTop->IsVisible ())
	{
		pBtnTop->OnDraw (&memDC.GetDC ());
	}
}
Exemplo n.º 2
0
//*****************************************************************************
void CBCGPStatic::OnPaint() 
{
	if (!m_bVisualManagerStyle && !m_bOnGlass)
	{
		Default ();
		return;
	}

	const DWORD dwStyle = GetStyle ();

	if ((dwStyle & SS_ICON) == SS_ICON ||
		(dwStyle & SS_BLACKRECT) == SS_BLACKRECT ||
		(dwStyle & SS_GRAYRECT) == SS_GRAYRECT ||
		(dwStyle & SS_WHITERECT) == SS_WHITERECT ||
		(dwStyle & SS_BLACKFRAME) == SS_BLACKFRAME ||
		(dwStyle & SS_GRAYFRAME) == SS_GRAYFRAME ||
		(dwStyle & SS_WHITEFRAME) == SS_WHITEFRAME ||
		(dwStyle & SS_USERITEM) == SS_USERITEM ||
		(dwStyle & SS_ETCHEDHORZ) == SS_ETCHEDHORZ ||
		(dwStyle & SS_ETCHEDVERT) == SS_ETCHEDVERT)
	{
		Default ();
		return;
	}

	CPaintDC dc(this); // device context for painting

	CBCGPMemDC memDC (dc, this);
	CDC* pDC = &memDC.GetDC ();

	globalData.DrawParentBackground (this, pDC);
	DoPaint(pDC);
}
Exemplo n.º 3
0
//***********************************************************************************************************
void CBCGPBaseVisualCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	if (m_pGM == NULL)
	{
		m_pGM = CBCGPGraphicsManager::CreateInstance();
	}

	if (m_pGM == NULL)
	{
		return;
	}

	double dblMemDCScale = m_pGM->IsSupported(BCGP_GRAPHICS_MANAGER_SCALING) ? 1.0 : m_dblScale;
	
	CBCGPMemDC memDC (dc, this, 0, dblMemDCScale);
	CDC* pDC = &memDC.GetDC ();

	CRect rectClip(0, 0, 0, 0);
	if (!IsDirty())
	{
		dc.GetClipBox(rectClip);
	}

	DoPaint(pDC, rectClip);
}
void CBCGPSpinButtonCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CBCGPMemDC memDC (dc, this);

	OnDraw (&memDC.GetDC ());
}
Exemplo n.º 5
0
void CBCGPPopupDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CBCGPMemDC memDC (dc, this);
	CDC* pDC = &memDC.GetDC ();

	OnDraw (pDC);
}
Exemplo n.º 6
0
//**************************************************************************
void CBCGPProgressCtrl::OnPaint()
{
    CPaintDC dc(this); // device context for painting

    CBCGPMemDC memDC (dc, this);
    CDC* pDC = &memDC.GetDC ();

    DoPaint(pDC);
}
void CBCGPTextPreviewCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CBCGPMemDC memDC (dc, this);
	CDC* pDC = &memDC.GetDC ();

	CRect rect;
	GetClientRect(rect);

	pDC->FillRect (rect, &globalData.brWindow);

	if (m_pGM == NULL || m_pFormat == NULL)
	{
		return;
	}

	m_pGM->BindDC(pDC, rect);

	if (!m_pGM->BeginDraw())
	{
		return;
	}

	m_pGM->FillRectangle(rect, m_brFill);

	int nVertMargin = rect.Height() / 4;
	int nHorzMargin = rect.Width() / 4;

	switch (m_HorzAlign)
	{
	case CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING:
		rect.right -= nHorzMargin;
		break;

	case CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_TRAILING:
		rect.left += nHorzMargin;
		break;
	}

	switch (m_VertAlign)
	{
	case CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_LEADING:
		rect.bottom -= nVertMargin;
		break;

	case CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_TRAILING:
		rect.top += nVertMargin;
		break;
	}

	m_pGM->DrawText(m_strText, rect, *m_pFormat, m_brText);

	m_pGM->EndDraw();
}
//----------------------------------------------------------------------------------//
void CBCGPAutoHideDockBar::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CBCGPMemDC memDC (dc, this);

	CRect rectClient;
	GetClientRect (rectClient);

	CBCGPVisualManager::GetInstance ()->OnFillBarBackground (&memDC.GetDC (), this,
		rectClient, rectClient);
}
Exemplo n.º 9
0
void CBCGPMSMCaptionBar::DoPaint (CDC* pDCPaint)
{
	ASSERT_VALID(this);
	ASSERT_VALID(pDCPaint);

	CRect rectClip;
	pDCPaint->GetClipBox (rectClip);

	CRect rect;
	GetClientRect(rect);

	CBCGPMemDC memDC (*pDCPaint, this);
	CDC* pDC = &memDC.GetDC ();

	CBCGPVisualManager::GetInstance ()->OnFillBarBackground (pDC, this,
		rect, rectClip);

	HGDIOBJ  hOldFont    = pDC->SelectObject (GetCaptionFont());

	int      nOldMode    = pDC->SetBkMode    (TRANSPARENT);
	COLORREF crTextColor = pDC->SetTextColor (GetCaptionTextColor());
	COLORREF crBkColor   = pDC->SetBkColor   (globalData.clrBtnFace);

	if (m_hIcon != NULL && m_szIcon != CSize (0, 0))
	{
		CRect rectIcon (0, 0, m_SystemHeight, rect.Height ());

		int x = max (0, (rectIcon.Width ()  - m_szIcon.cx) / 2);
		int y = max (0, (rectIcon.Height () - m_szIcon.cy) / 2);

		::DrawIconEx (pDC->GetSafeHdc (), x, y, m_hIcon, m_szIcon.cx, m_szIcon.cy,
					  0, NULL, DI_NORMAL);

		rect.left  += m_SystemHeight;

		CRect rt;
		m_BtnMinimize.GetWindowRect (rt);
		ScreenToClient (rt);

		rect.right = rt.left - 1;
	}

	if (!m_strCaption.IsEmpty ())
	{
		pDC->DrawText (m_strCaption, rect, DT_END_ELLIPSIS | DT_SINGLELINE | DT_VCENTER);
	}

	pDC->SetTextColor (crTextColor);
	pDC->SetBkColor   (crBkColor);
	pDC->SetBkMode    (nOldMode);

	pDC->SelectObject (hOldFont);
}
Exemplo n.º 10
0
//*****************************************************************************
void CBCGPCaptionBar::OnPaint() 
{
	CPaintDC dcPaint (this);
	CBCGPMemDC memDC (dcPaint, this);
	CDC& dc = memDC.GetDC ();

	CRect rectClient;
	GetClientRect(rectClient);

	OnDrawBackground (&dc, rectClient);

	int nOldBkMode = dc.SetBkMode (TRANSPARENT);
	COLORREF clrOldText = 
		dc.SetTextColor (m_clrBarText != (COLORREF) -1 ? m_clrBarText : 
		CBCGPVisualManager::GetInstance ()->GetCaptionBarTextColor (this));

	CFont* pOldFont = dc.SelectObject (
		m_hFont == NULL ? &globalData.fontRegular : CFont::FromHandle (m_hFont));

	CRect rectButton = m_rectButton;
	rectButton.top = max(rectClient.top + 1, rectButton.top);
	rectButton.bottom = min(rectClient.bottom - 1, rectButton.bottom);

	OnDrawButton (&dc, rectButton, m_strBtnText, m_bBtnEnabled);
	OnDrawText (&dc, m_rectDrawText, m_strText);

	if (!m_rectImage.IsRectEmpty ())
	{
		OnDrawImage (&dc, m_rectImage);
	}

	if (!m_rectClose.IsRectEmpty ())
	{
		COLORREF clrText = CBCGPVisualManager::GetInstance ()->OnFillCaptionBarButton (&dc, this,
			m_rectClose, m_bIsCloseBtnPressed, m_bIsCloseBtnHighlighted, FALSE,
			FALSE, TRUE);

		CBCGPVisualManager::GetInstance ()->OnDrawCaptionBarCloseButton(&dc, this, 
			m_rectClose, m_bIsCloseBtnPressed, m_bIsCloseBtnHighlighted, clrText);

		CBCGPVisualManager::GetInstance ()->OnDrawCaptionBarButtonBorder (&dc, this,
			m_rectClose, m_bIsCloseBtnPressed, m_bIsCloseBtnHighlighted, FALSE,
			FALSE, TRUE);
	}

	dc.SelectObject (pOldFont);
	dc.SetTextColor (clrOldText);
	dc.SetBkMode (nOldBkMode);
}
Exemplo n.º 11
0
void CBCGPMSMoneyDemoView::OnDraw(CDC* pDCView)
{
	CBCGPMemDC memDC (*pDCView, this);
	CDC* pDC = &memDC.GetDC ();

	CBCGPMSMoneyDemoDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	CRect rectClient;
	GetClientRect (rectClient);

	pDC->FillSolidRect (rectClient, RGB (255, 255, 255));

	pDC->DrawState (m_ptOffset, m_sizeImage, &m_Image, DSS_NORMAL);
}
Exemplo n.º 12
0
//*************************************************************************************
void CBCGPToolBoxPage::DoPaint(CDC* pDCPaint)
{
	ASSERT_VALID(this);
	ASSERT_VALID(pDCPaint);

	CBCGPMemDC memDC (*pDCPaint, this);
	CDC* pDC = &memDC.GetDC ();

	CRect rectClient;
	GetClientRect (rectClient);

	CBCGPVisualManager::GetInstance ()->OnFillBarBackground (pDC, this,
		rectClient, rectClient);

	m_Images.SetTransparentColor (globalData.clrBtnFace);

	CSize sizeImageDest (-1, -1);
	if (globalData.GetRibbonImageScale () != 1.)
	{
		double dblImageScale = globalData.GetRibbonImageScale ();
		sizeImageDest = m_Images.GetImageSize ();
		sizeImageDest = CSize ((int)(.5 + sizeImageDest.cx * dblImageScale), (int)(.5 + sizeImageDest.cy * dblImageScale));
	}

#ifndef _BCGSUITE_
	CBCGPDrawState ds(CBCGPVisualManager::GetInstance()->IsAutoGrayscaleImages());
#else
	CBCGPDrawState ds;
#endif
	m_Images.PrepareDrawImage (ds, sizeImageDest);

	pDC->SetBkMode (TRANSPARENT);
	pDC->SetTextColor (globalData.clrWindowText);

	CFont* pOldFont = pDC->SelectObject (&globalData.fontRegular);
	ASSERT(pOldFont != NULL);

	for (int i = 0; i < m_arButtons.GetSize (); i++)
	{
		CBCGPToolBoxButton* pButton = m_arButtons [i];
		ASSERT_VALID (pButton);

		pButton->OnDraw (pDC);
	}

	m_Images.EndDrawImage (ds);
	pDC->SelectObject (pOldFont);
}
Exemplo n.º 13
0
void CBCGPRibbonKeyTip::OnPaint() 
{
	ASSERT_VALID (m_pElement);

	CPaintDC dc(this); // device context for painting

	CBCGPMemDC memDC (dc, this);
	CDC* pDC = &memDC.GetDC ();

	CFont* pOldFont = pDC->SelectObject (&globalData.fontRegular);
	ASSERT (pOldFont != NULL);

	pDC->SetBkMode (TRANSPARENT);

	CRect rect;
	GetClientRect (rect);

	m_pElement->OnDrawKeyTip (pDC, rect, m_bIsMenu);

	pDC->SelectObject (pOldFont);
}
Exemplo n.º 14
0
void CKofBCGPFontComboBox::OnPaint()
{
	if ((GetStyle () & 0x0003L) == CBS_SIMPLE)
	{
		Default ();
		return;
	}

	if (!m_bVisualManagerStyle && !m_bOnGlass)
	{
		Default ();
		return;
	}

	CPaintDC dc(this); // device context for painting
	BYTE alpha = 0;
	if (m_bOnGlass)
	{
		alpha = 255;
	}
	CBCGPMemDC memDC (dc, this, alpha);
	CDC* pDC = &memDC.GetDC ();

	CRect rectClient;
	GetClientRect (rectClient);

	CBCGPDrawManager dm (*pDC);
	dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);
//  得注释掉这句话
// 	SendMessage (WM_PRINTCLIENT, (WPARAM) pDC->GetSafeHdc (), (LPARAM) PRF_CLIENT);
	const int cxDropDown = ::GetSystemMetrics (SM_CXVSCROLL) + 4;

	int nCurSel = GetCurSel();
	if (CB_ERR != nCurSel)
	{
		if (m_Images.GetSafeHandle () == NULL)
		{
			CBCGPLocalResource locaRes;
			m_Images.Create (IDB_BCGBARRES_FONT, nImageWidth, 0, RGB (255, 255, 255));
		}

		CFont fontSelected;
		CFont* pOldFont = NULL;
		CRect rc(rectClient);		
		rc.right -= cxDropDown;

		CBCGPFontDesc* pDesc = (CBCGPFontDesc*)GetItemDataPtr(nCurSel);
		if (pDesc != NULL)
		{			
			if (pDesc->m_nType & (DEVICE_FONTTYPE | TRUETYPE_FONTTYPE))
			{
				CPoint ptImage (rc.left + 3, rc.top + (rc.Height () - nImageHeight) / 2);
				m_Images.Draw (pDC, pDesc->GetImageIndex (), ptImage, ILD_NORMAL);
			}

			rc.left += nImageWidth + 9;

			if (m_bDrawUsingFont && pDesc->m_nCharSet != SYMBOL_CHARSET)
			{
				LOGFONT lf;
				globalData.fontRegular.GetLogFont (&lf);

				lstrcpy (lf.lfFaceName, pDesc->m_strName);

				if (pDesc->m_nCharSet != DEFAULT_CHARSET)
				{
					lf.lfCharSet = pDesc->m_nCharSet;
				}

				if (lf.lfHeight < 0)
				{
					lf.lfHeight -= 4;
				}
				else
				{
					lf.lfHeight += 4;
				}

				fontSelected.CreateFontIndirect (&lf);
				pOldFont = pDC->SelectObject (&fontSelected);
			}
		}

		CString strText;
		GetLBText (nCurSel, strText);

		pDC->DrawText (strText, rc, DT_SINGLELINE | DT_VCENTER);

		if (pOldFont != NULL)
		{
			pDC->SelectObject (pOldFont);
		}
	}

	m_rectBtn = rectClient;
	m_rectBtn.left = m_rectBtn.right - cxDropDown;

	m_rectBtn.DeflateRect (2, 2);

	CBCGPDrawOnGlass dog (m_bOnGlass);

	CKofBCGPToolbarComboBoxButton buttonDummy;
#ifndef _BCGSUITE_
	buttonDummy.m_bIsCtrl = TRUE;

	CBCGPVisualManager::GetInstance ()->OnDrawComboDropButton (
		pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
		m_bIsButtonHighlighted,
		&buttonDummy);
#else
	CMFCVisualManager::GetInstance ()->OnDrawComboDropButton (
		pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
		m_bIsButtonHighlighted,
		&buttonDummy);
#endif

	dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrBarShadow);
	rectClient.DeflateRect (1, 1);
	dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrWindow);
}
Exemplo n.º 15
0
void CBCGPToolTipCtrl::OnPaint() 
{
	if (m_Params.m_bBallonTooltip)
	{
		CToolTipCtrl::OnPaint ();
		return;
	}

	CPaintDC dcPaint(this); // device context for painting
	
	CBCGPMemDC memDC (dcPaint, this);
	CDC* pDC = &memDC.GetDC ();

	CRect rect;
	GetClientRect (rect);

	CRect rectMargin;
	GetMargin (rectMargin);

	CRect rectText = rect;

	rectText.DeflateRect (rectMargin);
	rectText.DeflateRect (m_ptMargin.x, m_ptMargin.y);

	COLORREF clrLine = m_Params.m_clrBorder == (COLORREF)-1 ?
		::GetSysColor (COLOR_INFOTEXT) : m_Params.m_clrBorder;

	COLORREF clrText = m_Params.m_clrText == (COLORREF)-1 ?
		::GetSysColor (COLOR_INFOTEXT) : m_Params.m_clrText;

	//-----------------
	// Fill background:
	//-----------------
	OnFillBackground (pDC, rect, clrText, clrLine);

	CPen penLine (PS_SOLID, 1, clrLine);
	CPen* pOldPen = pDC->SelectObject (&penLine);

	//-------------
	// Draw border:
	//-------------
	OnDrawBorder (pDC, rect, clrLine);

	//-----------
	// Draw icon:
	//-----------
	if (m_sizeImage != CSize (0, 0) && m_Params.m_bDrawIcon)
	{
		CRect rectImage = rectText;
		rectImage.right = rectImage.left + m_sizeImage.cx;
		rectImage.bottom = rectImage.top + m_sizeImage.cy;

		OnDrawIcon (pDC, rectImage);

		rectText.left += m_sizeImage.cx + m_ptMargin.x;
	}

	pDC->SetBkMode (TRANSPARENT);
	pDC->SetTextColor (clrText);

	//------------
	// Draw label:
	//------------
	int nTextHeight = OnDrawLabel (pDC, rectText, FALSE).cy;

	//------------------------------
	// Draw separator + description:
	//------------------------------
	if (!m_strDescription.IsEmpty () && m_Params.m_bDrawDescription)
	{
		CRect rectDescr = rectText;
		rectDescr.top += nTextHeight + 3 * m_ptMargin.y / 2;

		if (m_Params.m_bDrawSeparator)
		{
			OnDrawSeparator (pDC, rectDescr.left,
				rectDescr.right, rectDescr.top - m_ptMargin.y / 2);
		}

		OnDrawDescription (pDC, rectDescr, FALSE);
	}

	pDC->SelectObject (pOldPen);
}
Exemplo n.º 16
0
//**************************************************************************
void CBCGPComboBox::OnPaint() 
{
#ifndef _BCGSUITE_
	if (globalData.bIsWindows9x)
	{
		Default();
		return;
	}
#endif

	if ((GetStyle () & 0x0003L) == CBS_SIMPLE)
	{
		Default ();
		return;
	}

	if (!m_bVisualManagerStyle && !m_bOnGlass)
	{
		Default ();
		return;
	}

	CPaintDC dc(this); // device context for painting

	BYTE alpha = 0;
	if (m_bOnGlass)
	{
		alpha = 255;
	}

	CBCGPMemDC memDC (dc, this, alpha);
	CDC* pDC = &memDC.GetDC ();
	
	CRect rectClient;
	GetClientRect (rectClient);

	CBCGPDrawManager dm (*pDC);
	dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);

	SendMessage (WM_PRINTCLIENT, (WPARAM) pDC->GetSafeHdc (), (LPARAM) PRF_CLIENT);

	const int cxDropDown = ::GetSystemMetrics (SM_CXVSCROLL) + 4;

	m_rectBtn = rectClient;
	m_rectBtn.left = m_rectBtn.right - cxDropDown;

	m_rectBtn.DeflateRect (2, 2);

	CBCGPDrawOnGlass dog (m_bOnGlass);

	CBCGPToolbarComboBoxButton buttonDummy;
#ifndef _BCGSUITE_
	buttonDummy.m_bIsCtrl = TRUE;

	CBCGPVisualManager::GetInstance ()->OnDrawComboDropButton (
		pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
		m_bIsButtonHighlighted,
		&buttonDummy);
#else
	CMFCVisualManager::GetInstance ()->OnDrawComboDropButton (
		pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
		m_bIsButtonHighlighted,
		&buttonDummy);
#endif

	dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrBarShadow);
	rectClient.DeflateRect (1, 1);
	dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrWindow);
}
Exemplo n.º 17
0
//*****************************************************************************************
void CBCGPSliderCtrl::OnDraw(CDC* pDCIn) 
{
	CBCGPMemDC memDC (*pDCIn, this);
	CDC* pDC = &memDC.GetDC ();

	if (!CBCGPVisualManager::GetInstance ()->OnFillParentBarBackground (this, pDC))
	{
		globalData.DrawParentBackground (this, pDC, NULL);
	}

	DWORD dwStyle = GetStyle ();
	BOOL bVert = (dwStyle & TBS_VERT);
	BOOL bLeftTop = (dwStyle & TBS_BOTH) || (dwStyle & TBS_LEFT);
	BOOL bRightBottom = (dwStyle & TBS_BOTH) || ((dwStyle & TBS_LEFT) == 0);
	BOOL bIsFocused = GetSafeHwnd () == ::GetFocus ();

	CRect rectChannel;
	GetChannelRect (rectChannel);

	if (bVert)
	{
		CRect rect = rectChannel;

		rectChannel.left = rect.top;
		rectChannel.right = rect.bottom;
		rectChannel.top = rect.left;
		rectChannel.bottom = rect.right;
	}

	CBCGPDrawOnGlass dog(m_bOnGlass);

	CBCGPVisualManager::GetInstance ()->OnDrawSliderChannel (pDC, this, bVert, rectChannel, m_bOnGlass);

	CRect rectThumb;
	GetThumbRect (rectThumb);

	int nTicSize = max(3, (bVert ? rectThumb.Height() : rectThumb.Width()) / 3);
	int nTicOffset = 2;

	int nNumTics = GetNumTics();
	for (int i = 0; i < nNumTics; i++)
	{
		int nTicPos = GetTicPos(i);

		if (nTicPos < 0)
		{
			if (i == nNumTics - 2)
			{
				if (bVert)
				{
					nTicPos = rectChannel.top + rectThumb.Height() / 2;
				}
				else
				{
					nTicPos = rectChannel.left + rectThumb.Width() / 2;
				}
			}
			else if (i == nNumTics - 1)
			{
				if (bVert)
				{
					nTicPos = rectChannel.bottom - rectThumb.Height() / 2 - 1;
				}
				else
				{
					nTicPos = rectChannel.right - rectThumb.Width() / 2 - 1;
				}
			}
		}

		if (nTicPos >= 0)
		{
			CRect rectTic1(0, 0, 0, 0);
			CRect rectTic2(0, 0, 0, 0);

			if (bVert)
			{
				if (bLeftTop)
				{
					rectTic1 = CRect(rectThumb.left - nTicOffset - nTicSize, nTicPos, rectThumb.left - nTicOffset, nTicPos + 1);
				}
				
				if (bRightBottom)
				{
					rectTic2 = CRect(rectThumb.right + nTicOffset, nTicPos, rectThumb.right + nTicOffset + nTicSize, nTicPos + 1);
				}
			}
			else
			{
				if (bLeftTop)
				{
					rectTic1 = CRect(nTicPos, rectThumb.top - nTicOffset - nTicSize, nTicPos + 1, rectThumb.top - nTicOffset);
				}

				if (bRightBottom)
				{
					rectTic2 = CRect(nTicPos, rectThumb.bottom + nTicOffset, nTicPos + 1, rectThumb.bottom + nTicOffset + nTicSize);
				}
			}

			if (!rectTic1.IsRectEmpty())
			{
				CBCGPVisualManager::GetInstance ()->OnDrawSliderTic(pDC, this, rectTic1, bVert, TRUE, m_bOnGlass);
			}

			if (!rectTic2.IsRectEmpty())
			{
				CBCGPVisualManager::GetInstance ()->OnDrawSliderTic(pDC, this, rectTic2, bVert, FALSE, m_bOnGlass);
			}
		}
	}

	CBCGPVisualManager::GetInstance ()->OnDrawSliderThumb (
		pDC, this, rectThumb, m_bIsThumbHighligted || bIsFocused,
		m_bIsThumPressed, !IsWindowEnabled (),
		bVert, bLeftTop, bRightBottom, m_bOnGlass);

	if (bIsFocused && m_bDrawFocus)
	{
		CRect rectFocus;
		GetClientRect (rectFocus);

		if (m_bOnGlass)
		{
			CBCGPDrawManager dm (*pDC);
			dm.DrawFocusRect(rectFocus);
		}
		else
		{
			pDC->DrawFocusRect (rectFocus);
		}
	}
}
Exemplo n.º 18
0
//***************************************************************************************
void CBCGPHeaderCtrl::OnPaint()
{
    CPaintDC dc(this); // device context for painting
    CBCGPMemDC memDC (dc, this);
    CDC* pDC = &memDC.GetDC ();

    CRect rectClip;
    dc.GetClipBox (rectClip);

    CRect rectClient;
    GetClientRect (rectClient);

    OnFillBackground (pDC);

    CFont* pOldFont = SelectFont (pDC);
    ASSERT_VALID (pOldFont);

    pDC->SetTextColor (globalData.clrBtnText);
    pDC->SetBkMode (TRANSPARENT);

    CRect rect;
    GetClientRect(rect);

    CRect rectItem;
    int nCount = GetItemCount ();

    int xMax = 0;

    for (int i = 0; i < nCount; i++)
    {
        //------------------
        // Is item pressed?
        //------------------
        CPoint ptCursor;
        ::GetCursorPos (&ptCursor);
        ScreenToClient (&ptCursor);

        HDHITTESTINFO hdHitTestInfo;
        hdHitTestInfo.pt = ptCursor;

        int iHit = (int) SendMessage (HDM_HITTEST, 0, (LPARAM) &hdHitTestInfo);

        BOOL bIsHighlighted = iHit == i && (hdHitTestInfo.flags & HHT_ONHEADER);
        BOOL bIsPressed = m_bIsMousePressed && bIsHighlighted;

        GetItemRect (i, rectItem);

        CRgn rgnClip;
        rgnClip.CreateRectRgnIndirect (&rectItem);
        pDC->SelectClipRgn (&rgnClip);

        //-----------
        // Draw item:
        //-----------
        OnDrawItem (pDC, i, rectItem, bIsPressed, m_nHighlightedItem == i);

        pDC->SelectClipRgn (NULL);

        xMax = max (xMax, rectItem.right);
    }

    //--------------------
    // Draw "tail border":
    //--------------------
    if (nCount == 0)
    {
        rectItem = rect;
        rectItem.right++;
    }
    else
    {
        rectItem.left = xMax;
        rectItem.right = rect.right + 1;
    }

    OnDrawItem (pDC, -1, rectItem, FALSE, FALSE);

    pDC->SelectObject (pOldFont);
}