void CXTPPopupThemeMSN::DrawBackground(CDC* pDC, CXTPPopupControl* pControl, CRect rcClient)
{
	if (pControl->GetBackgroundBitmap() > 0)
	{
		CXTPPopupPaintManager::DrawBackground(pDC, pControl, rcClient);
		return;
	}

	pDC->Draw3dRect(rcClient, RGB(166, 180, 207), RGB(69, 86, 144));
	rcClient.DeflateRect(1, 1);
	pDC->Draw3dRect(rcClient, RGB(255, 255, 255), RGB(207, 222, 244));
	rcClient.DeflateRect(1, 1);

	CRect rcBackground(rcClient.left, rcClient.top, rcClient.right, rcClient.top + 12);
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(207, 215, 236), RGB(255, 255, 255) , FALSE);

	rcBackground = CRect(rcClient.left, rcBackground.bottom, rcClient.right, rcClient.top + 23);
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(255, 255, 255), RGB(207, 221, 244), FALSE);

	rcBackground = CRect(rcClient.left, rcBackground.bottom, rcClient.right, rcClient.top + 40);
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(207, 221, 244), RGB(255, 255, 255), FALSE);

	rcBackground = CRect(rcClient.left, rcBackground.bottom, rcClient.right, rcClient.bottom);
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(255, 255, 255), RGB(207, 221, 244), FALSE);

	CRect rcFrame(rcClient.left, rcClient.top + 22, rcClient.right, rcClient.bottom);
	pDC->Draw3dRect(rcFrame, RGB(114, 142, 184), RGB(185, 201, 239));
}
void CXTPPopupThemeOffice2000::DrawBackground(CDC* pDC, CXTPPopupControl* pControl, CRect rcClient)
{
	if (pControl->GetBackgroundBitmap() > 0)
	{
		CXTPPopupPaintManager::DrawBackground(pDC, pControl, rcClient);
		return;
	}

	XTPDrawHelpers()->GradientFill(pDC, rcClient, m_clrBackground, FALSE);
	pDC->Draw3dRect(rcClient, m_clrFrame.clrLight, m_clrFrame.clrDark);
	rcClient.DeflateRect(1, 1);

	//rcClient.DeflateRect(2, 2);
	CRect rcBackground(rcClient.left, rcClient.top, rcClient.right, rcClient.top + 22);
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(0, 0, 128), RGB(24, 180, 192), TRUE);

	rcClient.DeflateRect(1, 1);
	rcBackground = CRect(rcClient.left, rcBackground.top + 23 , rcClient.right, rcClient.bottom);
	pDC->Draw3dRect(rcBackground, m_clrFrame.clrDark, m_clrFrame.clrLight);

	rcBackground.DeflateRect(1, 1);
	pDC->Draw3dRect(rcBackground, m_clrFrame.clrLight, m_clrFrame.clrDark);

	rcBackground.DeflateRect(1, 1);
	rcBackground.right = rcBackground.left + 30;
	XTPDrawHelpers()->GradientFill(pDC, rcBackground, RGB(0, 0, 128), RGB(0, 0, 128), FALSE);
}
示例#3
0
//+---------------------------------------------------------------------------
//
//  Member:     CDispRoot::DrawSelf
//
//  Synopsis:   Draw this node's children and background.
//
//  Arguments:  pContext        draw context
//              pChild          start drawing at this child
//
//  Notes:
//
//----------------------------------------------------------------------------
void CDispRoot::DrawSelf(CDispDrawContext* pContext, CDispNode* pChild)
{
    // draw optional background
    if(HasBackground() && (pChild==NULL || !_pFirstChildNode->IsVisible()))
    {
        // calculate intersection with redraw region
        CRect rcBackground(_rcContainer.Size());
        CRect rcBackgroundClip(rcBackground);
        pContext->IntersectRedrawRegion(&rcBackgroundClip);
        if(!rcBackgroundClip.IsEmpty())
        {
            _pDispClient->DrawClientBackground(
                &rcBackground,
                &rcBackgroundClip,
                pContext->GetDispSurface(),
                this,
                pContext->GetClientData(),
                0);
        }
    }

    // draw children, bottom layers to top
    if(pChild == NULL)
    {
        pChild = _pFirstChildNode;
    }

    // only children which meet our visibility and inview criteria
    if(pChild!=NULL && pChild->AllSet(CDispFlags::s_drawSelector))
    {
        pChild->Draw(pContext, NULL);
    }
}
void CXTPSkinObjectHeader::OnDraw(CDC* pDC)
{
	CXTPClientRect rcClient(this);
	CRect rcBackground(rcClient);

	CXTPBufferDC dc(*pDC, rcClient);

	BOOL bFilterBar = (GetStyle() & HDS_FILTERBAR) && XTPSystemVersion()->GetComCtlVersion() >= MAKELONG(80, 5);
	CRect rcFilter(0, 0, 0, 0);

	dc.FillSolidRect(rcClient, GetColor(COLOR_3DFACE));

	if (bFilterBar)
	{
		INT cyFilter = (rcClient.Height() - 1)/2;

		rcFilter = rcClient;

		rcClient.bottom = rcClient.top + cyFilter;
		rcFilter.top = rcClient.bottom;

		DefWindowProc(WM_PAINT, (WPARAM)dc.GetSafeHdc(), 0);
	}

	CXTPSkinManagerClass* pClass = GetSkinClass();

	CXTPFontDC fontDC(&dc, GetFont());
	dc.SetTextColor(GetColor(COLOR_BTNTEXT));
	dc.SetBkMode(TRANSPARENT);

	CHeaderCtrl* pHeaderCtrl = (CHeaderCtrl*)this;

	int iItemCount = pHeaderCtrl->GetItemCount();



	// Draw each header item
	for (int iItem = 0; iItem < iItemCount; ++iItem)
	{
		int nIndex = Header_OrderToIndex(m_hWnd, iItem);

		// initialize draw item structure.
		CRect rcItem(0, 0, 0, 0);
		Header_GetItemRect(m_hWnd, nIndex, &rcItem);

		if ((rcItem.right < rcClient.left) || (rcItem.left > rcClient.right))
			continue;

		if (bFilterBar)
		{
			rcItem.bottom = rcFilter.top;
		}

		int nState = HIS_NORMAL;

		if (nIndex == m_nHotItem)
		{
			nState = m_bLBtnDown ? HIS_PRESSED : HIS_HOT;
		}

		rcBackground.left = max(rcBackground.left, rcItem.right);


		pClass->DrawThemeBackground(&dc, HP_HEADERITEM, nState, &rcItem);

		DrawItemEntry(&dc, nIndex, rcItem, nState);
	}

	if (rcBackground.left < rcBackground.right)
		pClass->DrawThemeBackground(&dc, 0, 0, &rcBackground);

}
示例#5
0
//+---------------------------------------------------------------------------
//
//  Member:     CDispRoot::EraseBackground
//              
//  Synopsis:   Quickly draw border and background.
//              
//  Arguments:  pContext        draw context
//              pClientData     client data used by clients in DrawClient
//              hrgnDraw        region to draw in destination coordinates
//              prcDraw         rect to draw in destination coordinates
//
//  Notes:      if hrgnDraw and prcDraw are both NULL, the bounding rect of
//              this root node is used
//              
//----------------------------------------------------------------------------
void CDispRoot::EraseBackground(
        CDispDrawContext* pContext,
        void* pClientData,
        HRGN hrgnDraw,
        const RECT* prcDraw)
{
    // BUGBUG (donmarsh) - EraseBackground can be called while we are recalcing
    // the display tree!  For example, CSelectLayout::HandleViewChange changes
    // the clip region of child windows, which causes an immediate
    // call to EraseBackground.  This is messy, because we could stomp on
    // values in pContext that are in use by the recalc code.  Therefore, we
    // ignore these calls.  If the following Assert fires, you should look
    // at the stack and protect the operation that called it with
    // CServer::CLock lock(Doc(), SERVERLOCK_IGNOREERASEBKGND);
    AssertSz(!_fDrawLock, "EraseBackground called during drawing");
// BUGBUG (donmarsh) -- temporarily disable this assert to help 5.0 stress numbers
//    AssertSz(!_fRecalcLock, "EraseBackground called during recalc");
    if(_fDrawLock || _fRecalcLock)
	{
		return;
	}

    // BUGBUG (donmarsh) - for now we must use this root's own context, due
    // to the context stack used for drawing.  Eventually, we should eliminate
    // the context pointer argument to DrawRoot.
    Assert(pContext == &_drawContext);
    AssertSz(!_fDrawLock, "Illegal call to EraseBackground inside Draw()");
    Assert(_pRenderSurface != NULL);

    // set redraw region (will become a rect if possible)
    CRegion rgnRedraw;
    if(hrgnDraw != NULL)
    {
        rgnRedraw = hrgnDraw;
    }
    else if(prcDraw != NULL)
    {
        rgnRedraw = *prcDraw;
    }
    else
    {
        rgnRedraw = _rcContainer;
    }
    
    // check for early exit conditions
    if(!rgnRedraw.Intersects(_rcContainer))
	{
		return;
	}

    // set initial context values
    pContext->SetClientData(pClientData);
    pContext->_offset = _rcContainer.TopLeft().AsSize();
    pContext->_pFirstDrawNode = NULL;
    pContext->SetRedrawRegion(&rgnRedraw);
    pContext->SetDispSurface(_pRenderSurface);
    _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size);

    // BUGBUG (donmarsh) - To address bug 62008 (erase background for HTML Help
    // control), we need to disable clipping in CDispSurface::GetDC.  Ideally,
    // CDispSurface should allow us to have a NULL _prgnClip, but that is
    // currently not the case.
    CRegion rgnClip(-15000, -15000, 15000, 15000);

    _pRenderSurface->SetClipRgn(&rgnClip);
    
    if(_pFirstChildNode == NULL)
    {
        DrawSelf(pContext, NULL);
    }
    else if(_pFirstChildNode->IsScroller())
    {
        CDispScroller* pScroller = DYNCAST(CDispScroller, _pFirstChildNode);
        CDispExtras* pExtras = pScroller->GetExtras();
        CDispInfo di(pExtras);
        pScroller->CalcDispInfo(_rcContainer, &di);
        
        // draw root background if scroller isn't opaque or doesn't have a background
        if(!pScroller->IsOpaque() || !pScroller->HasBackground())
        {
            Assert(HasBackground());
            CRect rcBackground(_rcContainer.Size());
            CRect rcBackgroundClip(rcBackground);
            pContext->IntersectRedrawRegion(&rcBackgroundClip);
            if(!rcBackgroundClip.IsEmpty())
            {
                _pDispClient->DrawClientBackground(
                    &rcBackground,
                    &rcBackgroundClip,
                    pContext->GetDispSurface(),
                    this,
                    pContext->GetClientData(),
                    0);
            }
        }
        else
        {
            pScroller->DrawBackground(pContext, &di);
        }
        
        // draw scroller's border if it has one
        if(pScroller->HasBorder(pExtras))
        {
            pScroller->DrawBorder(pContext, &di);
        }
    }
    
    _pRenderSurface->SetClipRgn(NULL);
    ::SelectClipRgn(_pRenderSurface->GetRawDC(), NULL);
}