RECT CItemData::GetRect(CDCHandle& dc)
{
	if ( NULL == m_pData )
		return RECT() ;

	if ( TIT_LINK != m_pData->dwType && TIT_TEXT != m_pData->dwType )
		return RECT() ;

	RECT rcItem = {0} ;
	wstring wsText ;
	switch(m_pData->dwType)
	{
	case TIT_LINK:
		{
			CFont font ;
			font.CreateFont(13,0,0,0,GetBold()?FW_BOLD:FW_NORMAL,0,TRUE,0,0,0,0,0,0,_T("Tahoma")) ;
			HFONT hOldFont = dc.SelectFont(font) ;
			wsText = m_pData->pData->pilLink->wsText ;
			dc.DrawText(wsText.c_str() , wsText.size() , &rcItem , DT_CALCRECT|DT_NOPREFIX|DT_NOCLIP|DT_SINGLELINE) ;
			dc.SelectFont(hOldFont) ;
		}
		break;
	case TIT_TEXT :
		wsText = m_pData->pData->pitText->wsText ;
		dc.DrawText(wsText.c_str() , wsText.size() , &rcItem , DT_CALCRECT|DT_NOPREFIX|DT_NOCLIP|DT_SINGLELINE) ;
		break ;
	}
	return rcItem ;
}
void CMenuSkin::DrawMenuItemText(CDCHandle dc, UINT uMenuRes, WORD wMenuID, const CString &lpszMenuString, const RECT &rect, CBitmapHandle hBitmap, CBitmapHandle hBitmapMask, bool bEnabled, bool bBold)
{
	if (hBitmap == (HBITMAP)-1 || hBitmap == (HBITMAP)-2)
	{
		int iWidth = m_imgMenuIcon.GetWidth() / 2;
		int iBegin = iWidth * (-(int)(HBITMAP)hBitmap - 1);
		int iY = (rect.bottom - rect.top - ICON_WIDTH) / 2;
		RECT rcDest = { rect.left + iY + 1, rect.top + iY, rect.left + iY + iWidth + 1, rect.top + iY + iWidth };
		RECT rcSrc = { iBegin, 0, iBegin + iWidth, m_imgMenuIcon.GetHeight() };
		m_imgMenuIcon.Draw(dc, rcDest, rcSrc);
	}
	else if ( (hBitmap && ::GetObjectType(hBitmap) == OBJ_BITMAP) || 
              (hBitmapMask && ::GetObjectType(hBitmapMask) == OBJ_BITMAP) )
	{
		ICONINFO ii = { TRUE, 8, 8, hBitmapMask, hBitmap };
		CIcon ico;
		ico.CreateIconIndirect(&ii);

		int iY = (rect.bottom - rect.top - ICON_WIDTH) / 2;
		ico.DrawIconEx(dc, rect.left + iY + 1, rect.top + iY, ICON_WIDTH, ICON_WIDTH);
	}

	CString strMenuText = lpszMenuString;
	int n = strMenuText.Find('\n');
	if (n >= 0)
		strMenuText = strMenuText.Mid(0, n);

	TCHAR szAcc[128] = { 0 };
	n = strMenuText.Find('\t');
	if (n >= 0)
	{
		_tcscpy_s(szAcc, strMenuText.Mid(n + 1));
		strMenuText = strMenuText.Mid(0, n);
	}

	RECT rcText = rect;
	rcText.left += ICON_WIDTH + 6;
	rcText.right -= 5;

	dc.SetBkMode(TRANSPARENT);
	dc.SetTextColor(CSkinProperty::GetColor(bEnabled ? Skin_Property_Menu_Text_Color : Skin_Property_Menu_Disabled_Text_Color));
	dc.SelectFont(bBold ? s()->Common()->GetBoldFont() : s()->Common()->GetDefaultFont());
	dc.DrawText(strMenuText, strMenuText.GetLength(), &rcText, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);

	if (szAcc[0])
	{
		dc.SetTextColor(CSkinProperty::GetColor(Skin_Property_Menu_Shortcut_Text_Color));
		dc.SelectFont(s()->Common()->GetMenuAccFont());
		dc.DrawText(szAcc, -1, &rcText, DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
	}
}
Example #3
0
void CDxMonthPicker::DrawButtons(CDCHandle dc)
{
    if (m_btnToday->m_bVisible)
    {
        dc.FillSolidRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNFACE));

        CRect rcButtonX = m_btnToday->m_rcButton;
        rcButtonX.DeflateRect(1, 1, 1, 1);

        if (m_btnToday->m_bPressed)
        {
            dc.Draw3dRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNTEXT), GetSysColor(COLOR_BTNFACE));
            dc.Draw3dRect(rcButtonX, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
        }
        else
        {
            dc.Draw3dRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNTEXT));
            dc.Draw3dRect(rcButtonX, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
        }

        HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
        CString strCaption = _T("Today");

        dc.SetTextColor(RGB(0,0,0));
        dc.DrawText(strCaption, strCaption.GetLength(), rcButtonX, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
    }
}
bool CTooltipText::RanderText(CDCHandle& dc , RECT rcRect , int iRowSpace)
{
	int iHeight = x_GetLineHeight(dc) ;
	CRect rc (rcRect.left,rcRect.top,rcRect.left,rcRect.top+iHeight) ;
	CRect rcLine (rcRect.left,rcRect.top,rcRect.left,rcRect.top+iHeight) ;
	list<CItemData>::iterator it = m_ItemList.begin() ;
	m_LinkBlockList.clear() ;

	for ( ;it!=m_ItemList.end() ; it++ )
	{
		if(TIT_RETURN == it->GetType() )
		{
			rc.bottom += iHeight ;
			rcLine.OffsetRect(CPoint(0,iHeight+iRowSpace)) ;
			rcLine.right = rcRect.left ;
		}
		else if ( TIT_LINK == it->GetType() || TIT_TEXT == it->GetType() )
		{
			CRect rcItem = it->GetRect(dc) ;
			rcLine.left = rcLine.right ;
			rcLine.right += rcItem.right ;
			rcLine.right = rcLine.right>rcRect.right ? rcRect.right : rcLine.right;
			COLORREF clrOld = dc.GetTextColor() ;
			dc.SetTextColor(it->GetColor()) ;
			if ( it->GetType() == TIT_LINK )
			{
				CFont font ;
				font.CreateFont(13,0,0,0,it->GetBold()?FW_BOLD:FW_NORMAL,0,TRUE,0,0,0,0,0,0,_T("Tahoma")) ;
				HFONT hOldFont = dc.SelectFont(font) ;

				LINKBLOCK lb = {it->GetColor(),it->GetColorHover(),it->GetColorActive(),it->GetBold(),rcLine,it->GetId(),it->GetText()};
				m_LinkBlockList.push_back(lb);

				dc.DrawText(it->GetText().c_str() , it->GetText().size() , &rcLine , DT_NOCLIP|DT_NOPREFIX |DT_SINGLELINE|DT_WORD_ELLIPSIS) ;

				dc.SelectFont(hOldFont) ;
			}
			else
				dc.DrawText(it->GetText().c_str() , it->GetText().size() , &rcLine , DT_NOCLIP|DT_NOPREFIX |DT_SINGLELINE|DT_WORD_ELLIPSIS) ;
			dc.SetTextColor(clrOld) ;
		}
	}

	return true ;

}
Example #5
0
void CDxDatePickerMonth::DrawMonthHeader(CDCHandle dc)
{
    if (m_rcHeader.IsRectEmpty())
        return;

    COleDateTime dtMonth = GetMonth();
    CRect rcHeader = m_rcHeader;
    CRect rcLeftScroll = m_rcLeftScroll;
    CRect rcRightScroll = m_rcRightScroll;

    CRect rcClient(m_pControl->m_rcControl);
    //dc.Draw3dRect(0, 0, rcClient.Width(), rcClient.Height(), m_clrStaticBorder, m_clrStaticBorder);

    CRect rcHeaderBk = m_rcMonth;
    rcHeaderBk.bottom = rcHeader.bottom;

    // fill background
    dc.FillSolidRect(rcHeaderBk, RGB(191, 219, 255));

    // draw header text
    dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
    dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

    HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));

    CString strText;

    if (!m_pControl->m_strYearMonthFormat.IsEmpty())
    {
        //strText = GetDateFormat(dtMonth, pControl->m_strYearMonthFormat);
    }
    else
    {
        strText.Format(_T("%s %d"), (LPCTSTR)m_pControl->GetMonthName( dtMonth.GetMonth()), dtMonth.GetYear());
    }

    dc.DrawText(strText, strText.GetLength(), &rcHeader, DT_SINGLELINE | DT_VCENTER | DT_CENTER);

    // draw left scroll triangle
    if (!rcLeftScroll.IsRectEmpty())
    {
        // draw left triangle itself
        if (GetShowLeftScroll())
            DrawScrollTriangle(dc, rcLeftScroll, TRUE, m_clrMonthHeaderButton, m_pControl->m_bYearsTriangle);
    }

    // draw right scroll triangle
    if (!rcRightScroll.IsRectEmpty())
    {
        // draw right triangle itself
        if (GetShowRightScroll())
            DrawScrollTriangle(dc, rcRightScroll, FALSE, m_clrMonthHeaderButton, m_pControl->m_bYearsTriangle);
    }

    dc.SelectFont(hFontOld);
}
Example #6
0
void	CToolBarPropertyPage::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	if (lpDrawItemStruct->CtlID == IDC_LIST_ICON) {
		CDCHandle dc = lpDrawItemStruct->hDC;

		// Save these value to restore them when done drawing.
		COLORREF crOldTextColor = dc.GetTextColor();
		COLORREF crOldBkColor = dc.GetBkColor();

		// If this item is selected, set the background color 
		// and the text color to appropriate values. Also, erase
		// rect by filling it with the background color.
		if ((lpDrawItemStruct->itemAction | ODA_SELECT) &&
			(lpDrawItemStruct->itemState & ODS_SELECTED))
		{
			dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
			dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
			dc.FillSolidRect(&lpDrawItemStruct->rcItem, 
				::GetSysColor(COLOR_HIGHLIGHT));
		} else
			dc.FillSolidRect(&lpDrawItemStruct->rcItem, crOldBkColor);
#if 0
		// If this item has the focus, draw a red frame around the
		// item's rect.
		if ((lpDrawItemStruct->itemAction | ODA_FOCUS) &&
			(lpDrawItemStruct->itemState & ODS_FOCUS))
		{
			CBrush br;
			br.CreateSolidBrush(RGB(255, 0, 0));
			dc.FrameRect(&lpDrawItemStruct->rcItem, br);
		}
#endif
		IconListData* pData = (IconListData*)lpDrawItemStruct->itemData;
		if (pData) {
			CIconHandle icon = m_imgList.GetIcon(pData->nIndex);
			if (icon.m_hIcon)
				icon.DrawIconEx(dc, lpDrawItemStruct->rcItem.left + cxMargin, lpDrawItemStruct->rcItem.top + cyMargin, m_iconSize.cx, m_iconSize.cy);

			lpDrawItemStruct->rcItem.left += m_iconSize.cx + cxMargin + IconTextMargin;
			// Draw the text.
			dc.DrawText(
				pData->strText,
				pData->strText.GetLength(),
				&lpDrawItemStruct->rcItem,
				DT_SINGLELINE | DT_VCENTER);
		}

		// Reset the background color and the text color back to their
		// original values.
		dc.SetTextColor(crOldTextColor);
		dc.SetBkColor(crOldBkColor);
	}
}
Example #7
0
void
CNdasMenuBitmapHandler::
OnDrawStatusText(
	LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDCHandle dc = lpDrawItemStruct->hDC;
	CRect rect(&lpDrawItemStruct->rcItem);
	rect.bottom -= 2;

	COLORREF oldBkColor = dc.SetBkColor(RGB(255,255,225));

	CBrush brush = ::CreateSolidBrush(RGB(255,255,225));
	
	CPen pen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW)); 

	HBRUSH hOldBrush = dc.SelectBrush(brush);
	HPEN hOldPen = dc.SelectPen(pen);

//	dc.Rectangle(rect);

	dc.RoundRect(rect,CPoint(rect.Height() /4, rect.Height() / 4));

	(void) dc.SelectPen(hOldPen);
	(void) dc.SelectBrush(hOldBrush);

	CRect rectText(rect);
	rectText.left += GetSystemMetrics(SM_CXMENUCHECK) + 2;

	CString strStatus;
	ATLVERIFY(strStatus.LoadString(static_cast<UINT>(lpDrawItemStruct->itemData)));

	CFontHandle curFont = dc.GetCurrentFont();
	LOGFONT logFont;
	curFont.GetLogFont(&logFont);
	logFont.lfWeight = FW_BOLD;
	CFont newFont = ::CreateFontIndirect(&logFont);
	CFontHandle oldFont = dc.SelectFont(newFont);

//	COLORREF oldTextColor = dc.SetTextColor(RGB(40,40,233));

	dc.DrawText(
		strStatus,
		strStatus.GetLength(),
		&rectText,
		DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX | 
		DT_VCENTER);

	dc.SelectFont(oldFont);
//	dc.SetTextColor(oldTextColor);
	dc.SetBkColor(oldBkColor);
}
Example #8
0
void CDuiMenuODWnd::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
    CRect rcItem=lpDrawItemStruct->rcItem;
    DuiMenuItemData *pdmmi=(DuiMenuItemData*)lpDrawItemStruct->itemData;

    CDCHandle dc(lpDrawItemStruct->hDC);
    CDCHandle dcMem;
    dcMem.CreateCompatibleDC(dc);
    CBitmap	  bmp=CGdiAlpha::CreateBitmap32(dc,rcItem.Width(),rcItem.Height());
    CBitmapHandle hOldBmp=dcMem.SelectBitmap(bmp);
    dcMem.BitBlt(0,0,rcItem.Width(),rcItem.Height(),dc,rcItem.left,rcItem.top,SRCCOPY);
    rcItem.MoveToXY(0,0);

    if(pdmmi)
    {
        MENUITEMINFO mii= {sizeof(MENUITEMINFO),MIIM_FTYPE,0};
        HMENU menuPopup=pdmmi->hMenu;
        GetMenuItemInfo(menuPopup,pdmmi->nID,FALSE,&mii);

        BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED;
        BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED;
        BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED;
        BOOL bRadio = mii.fType&MFT_RADIOCHECK;

        m_pItemSkin->Draw(dcMem,rcItem,bSelected?1:0);	//draw back

        //draw icon
        CRect rcIcon;
        rcIcon.left=rcItem.left+m_nIconMargin;
        rcIcon.right=rcIcon.left+m_szIcon.cx;
        rcIcon.top=rcItem.top+(rcItem.Height()-m_szIcon.cy)/2;
        rcIcon.bottom=rcIcon.top+m_szIcon.cy;
        if(bChecked)
        {
            if(m_pCheckSkin)
            {
                if(bRadio) m_pCheckSkin->Draw(dcMem,rcIcon,1);
                else m_pCheckSkin->Draw(dcMem,rcIcon,0);
            }
        }
        else if(pdmmi->itemInfo.iIcon!=-1 && m_pIconSkin)
        {
            m_pIconSkin->Draw(dcMem,rcIcon,pdmmi->itemInfo.iIcon);
        }
        rcItem.left=rcIcon.right+m_nIconMargin;

        //draw text
        CRect rcTxt=rcItem;
        rcTxt.DeflateRect(m_nTextMargin,0);
        dcMem.SetBkMode(TRANSPARENT);

        COLORREF crOld=dcMem.SetTextColor(bDisabled?m_crTxtGray:(bSelected?m_crTxtSel:m_crTxtNormal));


        HFONT hOldFont=0;
        hOldFont=dcMem.SelectFont(m_hFont);
        dcMem.DrawText(pdmmi->itemInfo.strText,pdmmi->itemInfo.strText.GetLength(),&rcTxt,DT_SINGLELINE|DT_VCENTER|DT_LEFT);
        dcMem.SelectFont(hOldFont);

        dcMem.SetTextColor(crOld);

        if(bSelected && m_pItemSkin->GetStates()>2)
        {
            //draw select mask
            CRect rcItem=lpDrawItemStruct->rcItem;
            rcItem.MoveToXY(0,0);
            m_pItemSkin->Draw(dcMem,rcItem,2);
        }
    }
    else  //if(strcmp("sep",pXmlItem->Value())==0)
    {
        m_pItemSkin->Draw(dcMem,rcItem,0);	//draw back
        if(m_pIconSkin)
        {
            rcItem.left += m_pIconSkin->GetSkinSize().cx+m_nIconMargin*2;
        }

        if(m_pSepSkin)
            m_pSepSkin->Draw(dcMem,&rcItem,0);
        else
        {
            CGdiAlpha::DrawLine(dcMem, rcItem.left, rcItem.top, rcItem.right, rcItem.top, RGB(196,196,196), PS_SOLID);
            CGdiAlpha::DrawLine(dcMem, rcItem.left, rcItem.top+1, rcItem.right, rcItem.top+1, RGB(255,255,255), PS_SOLID);
        }
    }
    rcItem=lpDrawItemStruct->rcItem;
    dc.BitBlt(rcItem.left,rcItem.top,rcItem.Width(),rcItem.Height(),dcMem,0,0,SRCCOPY);
    dcMem.SelectBitmap(hOldBmp);
    dcMem.DeleteDC();
    bmp.DeleteObject();
}
Example #9
0
void 
CNBTreeListView::DrawTreeItem(LPNMTVCUSTOMDRAW lptvcd, UINT iState, const RECT& rcItem)
{
	CDCHandle dc = lptvcd->nmcd.hdc;
	HTREEITEM hItem = (HTREEITEM) lptvcd->nmcd.dwItemSpec;

	tMapItem* pVal = m_mapItems.Lookup(hItem);
	if( pVal == NULL ) return;

	// NOTE: Having an ImageList attached to the TreeView control seems
	//       to produce some extra WM_ERASEBKGND msgs, which we can use to
	//       optimize the painting...
	CImageList il = m_ctrlTree.GetImageList(TVSIL_NORMAL);

	// If the item had focus then draw it
	// NOTE: Only when images are used (see note above)
	// FIX-BY-PATRIA: DrawFocusRect should be done later
	//if( (iState & CDIS_FOCUS) != 0 && !il.IsNull() ) {
	//	RECT rcFocus = rcItem;
	//	rcFocus.left = 1;
	//	dc.SetTextColor(::GetSysColor(COLOR_BTNTEXT));
	//	dc.DrawFocusRect(&rcFocus);
	//}

	// If it's selected, paint the selection background
	if( iState & CDIS_SELECTED  && iState & CDIS_FOCUS) {
		RECT rcHigh = rcItem;
		dc.FillSolidRect(&rcHigh, ::GetSysColor(COLOR_HIGHLIGHT));
	}
	else if( il.IsNull() ) {
		RECT rcHigh = rcItem;
		dc.FillSolidRect(&rcHigh, lptvcd->clrTextBk);
	}

	// Always write text with background
	dc.SetBkMode(OPAQUE);
	dc.SetBkColor(::GetSysColor((iState & CDIS_SELECTED) != 0 ? COLOR_HIGHLIGHT : COLOR_WINDOW));

	// Draw all columns of the item
	RECT rc = rcItem;
	int cnt = pVal->GetSize();
	for( int i = 0; i < cnt; i++ ) {
		LPTLVITEM pItem = (*pVal)[i];
		ATLASSERT(pItem);

		if( i != 0 ) rc.left = m_rcColumns[i].left;
		rc.right = m_rcColumns[i].right;

		if( pItem->mask & TLVIF_IMAGE ) {
			ATLASSERT(!il.IsNull());
			int cx, cy;
			il.GetIconSize(cx, cy);
			il.DrawEx(
				pItem->iImage, 
				dc, 
				rc.left, rc.top, 
				MIN(cx, rc.right - rc.left), cy,
				CLR_NONE, CLR_NONE,
				ILD_TRANSPARENT);
			rc.left += cx;
		}

		if( pItem->mask & TLVIF_TEXT ) {

			rc.left += 2;

			COLORREF clrText = lptvcd->clrText;
			if( pItem->mask & TLVIF_TEXTCOLOR ) clrText = pItem->clrText;
			if( iState & CDIS_SELECTED ) clrText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
			dc.SetTextColor(clrText);

			CFont font;
			HFONT hOldFont = NULL;
			if( pItem->mask & TLVIF_STATE ) {
				LOGFONT lf;
				::GetObject(m_ctrlTree.GetFont(), sizeof(LOGFONT), &lf);
				if( pItem->state & TLVIS_BOLD ) lf.lfWeight += FW_BOLD - FW_NORMAL;
				if( pItem->state & TLVIS_ITALIC ) lf.lfItalic = TRUE;
				if( pItem->state & TLVIS_UNDERLINE ) lf.lfUnderline = TRUE;
				if( pItem->state & TLVIS_STRIKEOUT ) lf.lfStrikeOut = TRUE;
				font.CreateFontIndirect(&lf);
				ATLASSERT(!font.IsNull());
				hOldFont = dc.SelectFont(font);
			}

			UINT format = pItem->mask & TLVIF_FORMAT ? pItem->format : 0;

			if (0 == i)
			{
				CNBDevice* pDevice = (CNBDevice*) m_ctrlTree.GetItemData(hItem);
				if (NULL != pDevice && pDevice->GetIDString(_T('*')).GetLength() > 0)
				{
					CString strBottom = pDevice->GetIDString(m_chHidden);

					CRect rcTop = rc; rcTop.DeflateRect(0, 0, 0, rcTop.Height() / 2);
					CRect rcBottom = rc; rcBottom.top = rcTop.bottom;
					
					dc.FillSolidRect(&rc, lptvcd->clrTextBk);

					LOGFONT lf;
					CFontHandle fontHandle = dc.GetCurrentFont();
					fontHandle.GetLogFont(&lf);
					lf.lfWeight = FW_BOLD;
					CFont font; 
					font.CreateFontIndirect(&lf);
					ATLASSERT(!font.IsNull());

					HFONT hOldFont = dc.SelectFont(font);
					dc.DrawText(pItem->pszText, -1, &rcTop, DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | format);
					dc.SelectFont(hOldFont);

					COLORREF clrText = dc.GetTextColor();
					clrText = RGB(
						(GetRValue(clrText) + 0x40) & 0xFF, 
						(GetGValue(clrText) + 0x40) & 0xFF,
						(GetBValue(clrText) + 0x40) & 0xFF);
					clrText = dc.SetTextColor(clrText);
					dc.DrawText(strBottom, -1, &rcBottom, DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | format);
					dc.SetTextColor(clrText);
				}
				else
				{
					dc.FillSolidRect(&rc, lptvcd->clrTextBk);

					LOGFONT lf;
					CFontHandle fontHandle = dc.GetCurrentFont();
					fontHandle.GetLogFont(&lf);
					lf.lfWeight = FW_BOLD;
					CFont font; 
					font.CreateFontIndirect(&lf);
					ATLASSERT(!font.IsNull());
					HFONT hOldFont = dc.SelectFont(font);
					dc.DrawText(pItem->pszText, 
						-1, 
						&rc, 
						DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | format);
					dc.SelectFont(hOldFont);
				}
			}
			else
			{
				dc.DrawText(pItem->pszText, 
					-1, 
					&rc, 
					DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | format);
			}

			if( pItem->mask & TLVIF_STATE ) dc.SelectFont(hOldFont);
		}
	}
	// FIX-BY-PATRIA: DrawFocusRect should be done here
	if( (iState & CDIS_FOCUS) != 0 && !il.IsNull() ) {
		RECT rcFocus = rcItem;
		rcFocus.left = 1;
		dc.SetTextColor(::GetSysColor(COLOR_BTNTEXT));
		dc.DrawFocusRect(&rcFocus);
	}

}
Example #10
0
void CBigFileListCtrl::DoDrawItem(CDCHandle dc, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    CRect rcItem = lpDrawItemStruct->rcItem;
    size_t idx = (size_t)lpDrawItemStruct->itemData;
    int nItem = lpDrawItemStruct->itemID;
    BOOL bSelect = lpDrawItemStruct->itemState & ODS_SELECTED;
    CRect rcDraw;
    CVirtualDirManager* pDir = (CVirtualDirManager*)m_pOwner;
    CString strFilePath, strFile, strDir;
    HICON hIcon = NULL, hIconCache = NULL;
    int nCurrentEnd = rcItem.left;
    double percent;
    CRect rcClient;
    CFontHandle underlineFont = KuiFontPool::GetFont(FALSE, TRUE, FALSE);
    CFontHandle normalFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE);

    // 绘制背景
    {
        rcDraw = rcItem;
        GetClientRect(rcClient);
        if (rcClient.right > rcDraw.right)
            rcDraw.right = rcClient.right;
        dc.FillSolidRect(rcDraw, RGB(0xff,0xff,0xff));
    }

    if (idx == -1)
    {
        CString strMore;
        dc.SelectFont(underlineFont);
        dc.SetTextColor(RGB(0x4d, 0x70, 0x96));
        strMore.Format(
            //_T("已经显示了%d个文件,还有%d个没有显示,点击此处查看全部"), 
            _T("还有%d个没有显示,点击此处查看全部"),
            //GetItemCount() - 1, 
            m_dwMoreItems);
        rcDraw = rcItem;
        dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
        int nLeft = rcItem.left + GetColumnWidth(0) + GetColumnWidth(1);
        int nRight = nLeft + GetColumnWidth(2);
        rcDraw.left = nLeft;
        rcDraw.right = nRight;
        dc.DrawText(strMore, strMore.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_CALCRECT);
        if (rcDraw.right > nRight)
            rcDraw.right = nRight;
        dc.DrawText(strMore, strMore.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS);
        m_rcMore.left = rcDraw.left;
        m_rcMore.right = rcDraw.right;
        m_rcMore.top = 0;
        m_rcMore.bottom = m_nItemHeight;
        return;
    }

    if (idx == -2)
    {
        CString strNone;
        dc.SelectFont(normalFont);
        dc.SetTextColor(RGB(0, 0, 0));
        strNone = _T("没有发现文件,您可以重新扫描。");
        rcDraw = rcItem;
        dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
        rcDraw.left = rcItem.left + GetColumnWidth(0) + GetColumnWidth(1);
        rcDraw.right = rcDraw.left + GetColumnWidth(2);
        dc.DrawText(strNone, strNone.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS);
        return;
    }

    percent = (double)pDir->m_vCacheFiles[idx].qwFileSize / pDir->m_vCacheFiles[0].qwFileSize;
    rcDraw = rcItem;
    dc.SetTextColor(RGB(0,0,0));
    if (bSelect)
    {
        CPen penBorder;
        CBrush brushBk;
        CRect rcSelect = rcDraw;

        penBorder.CreatePen(PS_SOLID, 1, RGB(0x7d, 0xa2, 0xce));
        brushBk.CreateSolidBrush(RGB(0xeb, 0xf4, 0xfd));
        dc.SelectPen(penBorder);
        dc.SelectBrush(brushBk);
        dc.RoundRect(rcSelect, CPoint(3, 3));
        rcSelect.left += 2;
        rcSelect.right -= 2;
        rcSelect.top += 2;
        rcSelect.bottom -= 2;
        DrawGradualColorRect(dc, rcSelect, RGB(0xdd, 0xec, 0xfd), RGB(0xc2, 0xdc, 0xfd));
    }
    else
    {
        dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
    }
    {
        // 画背景进度条
        CRect rcProgress = rcDraw;
        rcProgress.left += 2;
        rcProgress.right -= 2;
        rcProgress.top += 2;
        rcProgress.bottom -= 2;
        rcProgress.right = rcProgress.left + int(rcProgress.Width() * percent);
        COLORREF color1 = RGB(0xff, 0xf4, 0xcc);
        COLORREF color2 = RGB(0xff, 0xde, 0x5c);
        COLORREF color3 = RGB(0xff, 0xf4 + (0xde - 0xf4) * percent, 0xcc + (0x5c - 0xcc) * percent);
        DrawGradualColorRect(dc, rcProgress, color1, color3, FALSE);
    }
    //rcDraw.top = rcDraw.bottom;
    //rcDraw.bottom += 1;
    //dc.FillSolidRect(rcDraw, RGB(0xea, 0xe9, 0xe1));

    dc.SetBkMode(TRANSPARENT);

    strFilePath = pDir->m_vCacheFiles[idx].strFilePath;
    strFile = strFilePath.Right(strFilePath.GetLength() - strFilePath.ReverseFind(_T('\\')) - 1);
    strDir = strFilePath.Left(strFilePath.GetLength());

    // 绘制文件名
    hIconCache = g_IconCache.GetIcon(strFilePath);
    if (hIconCache)
    {
        hIcon = hIconCache;
    }
    else
    {
        hIcon = bigfilehelper::GetIconFromFilePath(strFilePath);
    }
    rcDraw = rcItem;
    rcDraw.left = nCurrentEnd;
    nCurrentEnd += GetColumnWidth(0);
    rcDraw.right = nCurrentEnd;
    if (rcDraw.Width() > 8)
    {
        dc.DrawIconEx(rcDraw.left + 4, rcDraw.top + (rcDraw.Height() - 16) / 2, hIcon, 16, 16);
    }
    if (rcDraw.Width() > 24)
    {
        rcDraw.left += 24;
        BOOL bFilter = CBigfileFilter::Instance().IsFileInFilter(strFilePath);
        BOOL bfilterEnable = GetSysFilterEnable();
        if(bFilter && bfilterEnable)
            dc.SetTextColor(RGB(0xcc, 0xcc, 0xcc));
        dc.DrawText(strFile, strFile.GetLength(), rcDraw, DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_END_ELLIPSIS);
    }

    // 绘制进度条
    rcDraw.left = nCurrentEnd;
    nCurrentEnd += GetColumnWidth(1);
    rcDraw.right = nCurrentEnd;
    if (rcDraw.Width() > 8)
    {
        CString strSize;
        bigfilehelper::GetFileSizeString(pDir->m_vCacheFiles[idx].qwFileSize, strSize);
        dc.DrawText(strSize, strSize.GetLength(), rcDraw, DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
    }
//     if (rcDraw.Width() > 48)
//     {
//         CPen penBorder;
//         CBrush brushProgress;
//         CRect rcProgress = rcDraw;
//         int nLength;
//         rcProgress.left += 40;
//         rcProgress.right -= 4;
//         rcProgress.top += (rcDraw.Height() - 6) / 2;
//         rcProgress.bottom -= (rcDraw.Height() - 6) / 2;
//         penBorder.CreatePen(PS_SOLID, 1, RGB(0xb5, 0xb5, 0xb5));
//         brushProgress.CreateSolidBrush(RGB(0xf3, 0xf6, 0xfd));
//         dc.SelectPen(penBorder);
//         dc.SelectBrush(brushProgress);
//         dc.RoundRect(rcProgress, CPoint(3, 3));
//     }

    // 绘制路径
    rcDraw.left = nCurrentEnd;
    nCurrentEnd += GetColumnWidth(2);
    rcDraw.right = nCurrentEnd;

    if (rcDraw.Width() > 8)
    {
        dc.DrawText(strDir, strDir.GetLength(), rcDraw, DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);   
    }

    // 绘制控制
    rcDraw.left = nCurrentEnd;
    nCurrentEnd += GetColumnWidth(3);
    rcDraw.right = nCurrentEnd;

    if (rcDraw.Width() > 4)
    {
        CRect rcLink;
        for (size_t i = 0; i < m_vLinks.size(); ++i)
        {
            CString strLink = m_vLinks[i].strLink;
            rcLink = rcDraw;
            rcLink.left = rcDraw.left + 4 + 40 * (long)i;
            rcLink.top += 4;
            rcLink.bottom += 4;
            dc.SelectFont(underlineFont);
            dc.SetTextColor(RGB(0x4d, 0x70, 0x96));
            dc.DrawText(strLink, strLink.GetLength(), rcLink, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_CALCRECT);
            if (rcLink.right > rcDraw.right)
                rcLink.right = rcDraw.right;
            dc.DrawText(strLink, strLink.GetLength(), rcLink, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_END_ELLIPSIS);
            rcLink.top = (rcLink.top - m_nHeaderHeight) % m_nItemHeight;
            rcLink.bottom = (rcLink.bottom - m_nHeaderHeight) % m_nItemHeight;
            m_vLinks[i].rcLink = rcLink;
        }
    }

    // 绘制
    //dc.DrawText(strFilePath, strFilePath.GetLength(), rcDraw, DT_SINGLELINE|DT_VCENTER|DT_LEFT);

    if (hIcon != hIconCache)
    {
        DestroyIcon(hIcon);
    }
}
void CButtonST::DrawItem(UINT ctrlID, LPDRAWITEMSTRUCT lpDIS)
{
	CDCHandle pDC = lpDIS->hDC;

	CPenHandle	pOldPen;

	// Checkbox or Radiobutton style ?
	if (m_bIsCheckBox)
		{
		m_bIsPressed  =  (lpDIS->itemState & ODS_SELECTED) || m_nCheck;
		}
	// Normal button OR other button style ...
	else
		{
		m_bIsPressed = (lpDIS->itemState & ODS_SELECTED);
		}

	m_bIsFocused  = (lpDIS->itemState & ODS_FOCUS) != 0;
	m_bIsDisabled = (lpDIS->itemState & ODS_DISABLED) != 0;
	
	CRect itemRect = lpDIS->rcItem;

	pDC.SetBkMode(TRANSPARENT);

	if (!m_bIsFlat)
		{
		if (m_bIsFocused || GetDefault())
			{
			CBrush br;
			br.CreateSolidBrush(RGB(0,0,0));  
			pDC.FrameRect(&itemRect, br);
			itemRect.DeflateRect(1, 1);
			}
		}

	// Prepare draw... paint button background

	// Draw transparent?
	if (m_bDrawTransparent)
		{
		PaintBk(pDC);
		}
	else
		{
		OnDrawBackground(pDC, &itemRect);
		}

	// Draw pressed button
	if (m_bIsPressed)
		{
		if (m_bIsFlat)
			{
			if (m_bDrawBorder)
				{
				OnDrawBorder(pDC, &itemRect);
				}
			}
		else    
			{
			CBrush brBtnShadow;
			brBtnShadow.CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
			pDC.FrameRect(&itemRect, brBtnShadow);
			}
		}
	else // ...else draw non pressed button
		{
		CPen penBtnHiLight; // White
		CPen pen3DLight;       // Light gray
		CPen penBtnShadow;   // Dark gray
		CPen pen3DDKShadow; // Black

		penBtnHiLight.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNHILIGHT)); // White
		pen3DLight.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DLIGHT));       // Light gray
		penBtnShadow.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNSHADOW));   // Dark gray
		pen3DDKShadow.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DDKSHADOW)); // Black

		if (m_bIsFlat)
			{
			if (m_bMouseOnButton && m_bDrawBorder)
				{
				pDC.Draw3dRect(itemRect, ::GetSysColor(COLOR_BTNHILIGHT), ::GetSysColor(COLOR_BTNSHADOW));
				}
			}
		else
			{
			// Draw top-left borders
			// White line
			pOldPen = pDC.SelectPen(penBtnHiLight);
			pDC.MoveTo(itemRect.left, itemRect.bottom-1);
			pDC.LineTo(itemRect.left, itemRect.top);
			pDC.LineTo(itemRect.right, itemRect.top);
			// Light gray line
			pDC.SelectPen(pen3DLight);
			pDC.MoveTo(itemRect.left+1, itemRect.bottom-1);
			pDC.LineTo(itemRect.left+1, itemRect.top+1);
			pDC.LineTo(itemRect.right, itemRect.top+1);
			// Draw bottom-right borders
			// Black line
			pDC.SelectPen(pen3DDKShadow);
			pDC.MoveTo(itemRect.left, itemRect.bottom-1);
			pDC.LineTo(itemRect.right-1, itemRect.bottom-1);
			pDC.LineTo(itemRect.right-1, itemRect.top-1);
			// Dark gray line
			pDC.SelectPen(penBtnShadow);
			pDC.MoveTo(itemRect.left+1, itemRect.bottom-2);
			pDC.LineTo(itemRect.right-2, itemRect.bottom-2);
			pDC.LineTo(itemRect.right-2, itemRect.top);
			//
			pDC.SelectPen(pOldPen);
			}
		}

	// Read the button's title
	CString sTitle;
	int nLen = GetWindowTextLength();
	int nRetLen = GetWindowText(sTitle.GetBufferSetLength(nLen), nLen + 1);

	CRect captionRect = lpDIS->rcItem;

	// Draw the icon
	if (m_csIcons[0].hIcon != 0)
		{
		DrawTheIcon(pDC, !sTitle.IsEmpty(), lpDIS->rcItem, captionRect, m_bIsPressed, m_bIsDisabled);
		}

	if (m_csBitmaps[0].hBitmap != 0)
		{
		pDC.SetBkColor(RGB(255,255,255));
		DrawTheBitmap(pDC, !sTitle.IsEmpty(), lpDIS->rcItem, captionRect, m_bIsPressed, m_bIsDisabled);
		}

	// Write the button title (if any)
	if (!sTitle.IsEmpty())
		{
		// Draw the button's title
		// If button is pressed then "press" title also
		if (m_bIsPressed && !m_bIsCheckBox)
			{
			captionRect.OffsetRect(1, 1);
			}
		// Center text
		CRect centerRect = captionRect;
		pDC.DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER | DT_CALCRECT);
		captionRect.OffsetRect((centerRect.Width() - captionRect.Width())/2, (centerRect.Height() - captionRect.Height())/2);
		pDC.SetBkMode(TRANSPARENT);
		if (m_bIsDisabled)
			{
			captionRect.OffsetRect(1, 1);
			pDC.SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
			pDC.DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
			captionRect.OffsetRect(-1, -1);
			pDC.SetTextColor(::GetSysColor(COLOR_3DSHADOW));
			pDC.DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
			}
		else
			{
			if (m_bMouseOnButton || m_bIsPressed) 
				{
				pDC.SetTextColor(m_crColors[BTNST_COLOR_FG_IN]);
				pDC.SetBkColor(m_crColors[BTNST_COLOR_BK_IN]);
				} 
			else 
				{
				pDC.SetTextColor(m_crColors[BTNST_COLOR_FG_OUT]);
				pDC.SetBkColor(m_crColors[BTNST_COLOR_BK_OUT]);
				}
			pDC.DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
			}
		}
	if (!m_bIsFlat || (m_bIsFlat && m_bDrawFlatFocus))
		{
		// Draw the focus rect
		if (m_bIsFocused)
			{
			CRect focusRect = itemRect;
			focusRect.DeflateRect(3, 3);
			pDC.DrawFocusRect(&focusRect);
			}
		}
}
Example #12
0
BOOL CDxDatePickerDay::DrawDay(CDCHandle dc)
{
    // check this day item
    BOOL bThisMonthItem = FALSE;
    BOOL bNextMonthItem = FALSE;
    BOOL bPreviousMonthItem = FALSE;

    CDxMonthPicker* pControl = GetDatePicker();
    CDxDatePickerMonth* pMonth = GetMonth();

    COleDateTime dtDay = GetDate();
    CRect rcDay = GetRect();

    if (dtDay.GetYear() > pMonth->GetMonth().GetYear())
    {
        bNextMonthItem = TRUE;
    }
    else if (dtDay.GetYear() < pMonth->GetMonth().GetYear())
    {
        bPreviousMonthItem = TRUE;
    }
    else
    {
        // years the same
        if (dtDay.GetMonth() > pMonth->GetMonth().GetMonth())
            bNextMonthItem = TRUE;
        else if (dtDay.GetMonth() < pMonth->GetMonth().GetMonth())
            bPreviousMonthItem = TRUE;
        else // months the same
            bThisMonthItem = TRUE;
    }

    if (bPreviousMonthItem && !pMonth->GetShowDaysBefore())
        return FALSE;

    if (bNextMonthItem && !pMonth->GetShowDaysAfter())
        return FALSE;


    // apply settings to the DC
    dc.SetBkMode(TRANSPARENT);
    dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
    dc.FillSolidRect(rcDay, GetSysColor(COLOR_WINDOW));

    // change default drawing metrics if day is selected
    if (pControl->IsSelected(dtDay))
    {
        dc.SetTextColor(GetSysColor(COLOR_WINDOW));
        dc.FillSolidRect(rcDay, GetSysColor(COLOR_WINDOWTEXT));
    }

    // make a text for drawing
    CString strText;
    strText.Format(_T("%i"), dtDay.GetDay());

    // draw item content
    {
        // draw item text
        HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
        dc.DrawText(strText, strText.GetLength(), &rcDay, DT_SINGLELINE | DT_VCENTER | DT_CENTER | DT_NOCLIP);
    }

    CRect rcFocus = rcDay;
    BOOL bToday = FALSE;

    // highlight today item
    if (IsToday(dtDay))
    {
        dc.Draw3dRect(rcDay, GetSysColor(COLOR_HIGHLIGHT), GetSysColor(COLOR_HIGHLIGHT));
        bToday = TRUE;
    }

    if (pControl->IsSelected(dtDay))
    {
        if (!bToday)
        {
            dc.SetTextColor(0);
            dc.SetBkColor(RGB(255, 255, 255));
            dc.DrawFocusRect(&rcFocus);
        }
        else
        {
            COLORREF clrFocus = GetSysColor(COLOR_HIGHLIGHT);
            clrFocus = clrFocus ^ RGB(255, 128, 128);

            rcFocus.DeflateRect(0, 0, 1, 1);

            CPen pen1;
            pen1.CreatePen(PS_DOT, 1, clrFocus);

            HPEN hOldPen = dc.SelectPen(pen1);

            dc.MoveTo(rcFocus.TopLeft());
            dc.LineTo(rcFocus.right, rcFocus.top);
            dc.LineTo(rcFocus.right, rcFocus.bottom);
            dc.LineTo(rcFocus.left, rcFocus.bottom);
            dc.LineTo(rcFocus.left, rcFocus.top);

            dc.SelectPen(hOldPen);
        }
    }

    return TRUE;
}
Example #13
0
LRESULT CLogListBox::OnDrawitem(UINT uMsg, WPARAM wParam, LPARAM lParam,BOOL& bHandled)
{
	LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
	if(!dis) return FALSE;
      
	LogListBoxItem * item = (LogListBoxItem *)dis->itemData;
	if(!item) return FALSE;
	
   CDCHandle dc = dis->hDC;

   if(dis->itemAction & (ODA_DRAWENTIRE|ODA_SELECT))
   {
		dc.SetBkColor(GetSysColor(COLOR_WINDOW));
		dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
      CRect r(dis->rcItem);
		if(!(dis->itemState & ODS_SELECTED ))
		{
			CBrush br;
			br.CreateSolidBrush(GetSysColor(COLOR_WINDOW));
			dc.FillRect(r,br);
		}
		CRect rct;
      GetClientRect(&rct);

		if(dis->itemState & ODS_SELECTED )
		{
			CRect rd(dis->rcItem);
			GuiTools::FillRectGradient(dis->hDC,rd,0xEAE2D9, 0xD3C1AF, false);
		}
		else if(dis->itemID != GetCount()-1) // If it isn't last item
		{
			CPen pen;
			pen.CreatePen(PS_SOLID, 1, RGB(190,190,190));
			SelectObject(dc.m_hDC, pen);
			dc.MoveTo(rct.left, r.bottom-1);
			dc.LineTo(rct.right, r.bottom-1);
		}
			  
		SetBkMode(dc.m_hDC,TRANSPARENT);

		SIZE TimeLabelDimensions;
		SelectObject(dc.m_hDC, NormalFont);
		GetTextExtentPoint32(dc, item->Time, item->Time.GetLength(), &TimeLabelDimensions);
		
		// Writing error time
		
		ExtTextOutW(dc.m_hDC, rct.right-5-TimeLabelDimensions.cx, r.top + LLB_VertMargin, ETO_CLIPPED, r, item->Time, item->Time.GetLength(), 0);
		// Writing error title
		SelectObject(dc.m_hDC, UnderlineFont);
		ExtTextOutW(dc.m_hDC, r.left+56, r.top + LLB_VertMargin, ETO_CLIPPED, r, item->strTitle, wcslen(item->strTitle), 0);
		
		// Writing some info
		SelectObject(dc.m_hDC, NormalFont);
		RECT ItemRect={r.left+56, r.top + LLB_VertMargin + LLB_VertDivider + item->TitleHeight, 
							r.right - 10, r.bottom-LLB_VertMargin};
		dc.DrawText(item->Info, item->Info.GetLength() , &ItemRect, DT_NOPREFIX);
			
		// Writing error text with bold (explication of error)
		SelectObject(dc.m_hDC, BoldFont);
		RECT TextRect = {r.left+56, LLB_VertMargin +r.top+ item->TitleHeight+LLB_VertDivider+((item->Info.GetLength())?(item->InfoHeight+LLB_VertDivider):0), r.right - 10, r.bottom-LLB_VertMargin};
		dc.DrawText(item->strText,  wcslen(item->strText), &TextRect, DT_NOPREFIX);

		if(item->Type == logError)
			dc.DrawIcon(12,r.top+8,ErrorIcon);
		else if(item->Type == logWarning)
			dc.DrawIcon(12,r.top+8,WarningIcon);
	}
  
	bHandled = true;
	return 0;
}
Example #14
0
bool CPrintFolder::DrawImage(CDCHandle dc, CPoint point, IW::Image &image, IW::FolderItem *pItem)
{
	HFONT hOldFont = dc.SelectFont(m_font);
	UINT uTextStyle =  DT_NOPREFIX | DT_EDITCONTROL;
	if (m_bCenter) uTextStyle |= DT_CENTER;
	if (!m_bWrap) uTextStyle |= DT_WORD_ELLIPSIS; else uTextStyle |= DT_WORDBREAK;

	// Calc Text Size
	CSimpleArray<CString> arrayStrText;
	CSimpleValArray<int> arrayHeights;
	pItem->GetFormatText(arrayStrText, m_annotations, true);

	int i, nHeightText = 0;

	for(i = 0; i < arrayStrText.GetSize(); i++)
	{
		CRect r(point.x, 
			point.y + _sizeSection.cy, 
			point.x + _sizeSection.cx, 
			point.y + _sizeSection.cy);

		dc.DrawText(arrayStrText[i], -1,
			&r, uTextStyle | DT_CALCRECT);

		int nLimit = _sizeThumbNail.cy / 2;
		if (nHeightText + r.Height() > nLimit) 
		{
			arrayHeights.Add(nLimit - nHeightText);
			nHeightText = nLimit;
			break;
		}
		else
		{
			nHeightText += r.Height();
			arrayHeights.Add(r.Height());
		}
	}

	CSize sizeThumbNailLocal = _sizeThumbNail;	
	sizeThumbNailLocal.cy -= nHeightText;

	if (!image.IsEmpty())
	{
		IW::Page page = image.GetFirstPage();

		// Best fit rotate
		if (m_nPrintRotateBest > 0)
		{
			bool bRotate = ((sizeThumbNailLocal.cx > sizeThumbNailLocal.cy) &&
				(page.GetWidth() < page.GetHeight())) || 
				((sizeThumbNailLocal.cx < sizeThumbNailLocal.cy) &&
				(page.GetWidth() > page.GetHeight()));

			if (bRotate)
			{
				IW::Image imageRotate;

				if (m_nPrintRotateBest == 1)
				{
					IW::Rotate270(image, imageRotate, _pStatus);
				}
				else
				{
					IW::Rotate90(image, imageRotate, _pStatus);
				}

				image = imageRotate;
			}
		}	

		const int nSizeAverage = (page.GetWidth() + page.GetHeight()) / 2;

		page = image.GetFirstPage();
		page.SetBackGround(m_clrBackGround);

		const CRect rectBounding = image.GetBoundingRect();

		const int nWidthPels = dc.GetDeviceCaps(HORZRES); 
		const int nHeightPels = dc.GetDeviceCaps(VERTRES); 

		const long icx = rectBounding.Width();
		const long icy = rectBounding.Height();
		const long nDiv = 0x1000;		
		
		// Scale the image
		long sh = MulDiv(sizeThumbNailLocal.cx, nDiv, icx);
		long sw = MulDiv(sizeThumbNailLocal.cy, nDiv, icy);		
		long s =  IW::Min(sh, sw);
		
		const CSize sizeImage(MulDiv(page.GetWidth(), s, nDiv), MulDiv(page.GetHeight(), s, nDiv));		
		const CPoint pt(point.x + ((sizeThumbNailLocal.cx - sizeImage.cx) / 2) + m_nPadding,
			point.y + ((sizeThumbNailLocal.cy - sizeImage.cy) / 2) + m_nPadding);

		const CRect rectPrint(pt, sizeImage);

		if ((rectPrint.Width() < page.GetWidth()) && (rectPrint.Height() < page.GetHeight()))
		{
			IW::Image imageScaled;
			IW::Scale(image, imageScaled, rectPrint.Size(), _pStatus);
			image = imageScaled;
			page = image.GetFirstPage();
		}

		IW::CRender::DrawToDC(dc, page, rectPrint);
	}

	// Draw the Text!
	CRect rectText(point.x, 
		point.y + _sizeSection.cy - nHeightText, 
		point.x + _sizeSection.cx, 
		point.y + _sizeSection.cy);

	for(i = 0; i < arrayHeights.GetSize(); i++)
	{
		dc.DrawText(arrayStrText[i], -1, &rectText, uTextStyle);
		rectText.top += arrayHeights[i];
	}
		
	dc.SelectFont(hOldFont);

	

	return true;
}
Example #15
0
bool CPrintFolder::PrintHeaders(CDCHandle dc, UINT nPage)
{
	try
	{
		int nBkMode = dc.SetBkMode(TRANSPARENT);
		COLORREF clrTextColor = dc.SetTextColor(RGB(0,0,0));				

		// Draw header and footer!!
		if (m_bShowFooter || m_bShowPageNumbers)
		{
			HFONT hOldFont = dc.SelectFont(m_font);

			int cy = _rectExtents.bottom - (m_nFooterHeight - m_nPadding);
			
			dc.MoveTo(_rectExtents.left + m_nPadding, cy);
			dc.LineTo(_rectExtents.right - m_nPadding, cy);
			
			CRect r(_rectExtents.left, cy, _rectExtents.right, _rectExtents.bottom);
			
			if (m_bShowFooter)
			{
				
				DWORD dwStyle = DT_NOCLIP | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX;
				dwStyle |= (!m_bShowPageNumbers) ? DT_CENTER : DT_LEFT;
				dc.DrawText(_strFooter, -1, r, dwStyle);
			}

			if (m_bShowPageNumbers)
			{
				
				DWORD dwStyle = DT_NOCLIP | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX;
				dwStyle |= (!m_bShowFooter) ? DT_CENTER : DT_RIGHT;

				CString str;
				str.Format(IDS_PRINT_PAGE_FMT, nPage + 1, GetPageCount());
				dc.DrawText(str, -1, &r, dwStyle);
			}

			dc.SelectFont(hOldFont);
		}
		
		if (m_bShowHeader)
		{
			int cy = (_rectExtents.top + m_nHeaderHeight) - m_nPadding;
			
			dc.MoveTo(_rectExtents.left + m_nPadding, cy);
			dc.LineTo(_rectExtents.right - m_nPadding, cy);
			
			CRect r(_rectExtents.left, _rectExtents.top, _rectExtents.right, cy);
			
			HFONT hOldFont = dc.SelectFont(m_fontTitle);
			dc.DrawText(_strHeader, -1, &r, 
				DT_NOCLIP | DT_VCENTER | DT_CENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX);
			dc.SelectFont(hOldFont);
		}

		dc.SetBkMode(nBkMode);
		dc.SetTextColor(clrTextColor);
	}
	catch(_com_error &e) 
	{
		IW::CMessageBoxIndirect mb;
		mb.ShowException(IDS_LOW_LEVEL_ERROR_FMT, e);
	}

	return true;
}
Example #16
0
void CListViewCtrlEx::_DrawNormalItem( LPDRAWITEMSTRUCT lpdis, const TListItem *pItem )
{
    if (!pItem)
        return;

    int nItem = lpdis->itemID;

    CDCHandle dc;
    dc.Attach(lpdis->hDC);

    HFONT	hOldFont = dc.SelectFont(m_fontDef);

    BOOL bSelect = FALSE ;
    if ((lpdis->itemAction | ODA_SELECT) &&
            (lpdis->itemState & ODS_SELECTED))
    {
        bSelect = TRUE ;
    }

    if ( bSelect )
        dc.FillSolidRect( &lpdis->rcItem, RGB(185,219,255));
    else
        dc.FillSolidRect( &lpdis->rcItem, pItem->clrBg);

    // draw check box
    if( pItem->dwFlags&(LISTITEM_CHECKBOX|LISTITEM_RADIOBOX) )
        _DrawCheckBox(dc, lpdis->rcItem, _super::GetCheckState(nItem), pItem->dwFlags);

    COLORREF oldClr = dc.GetTextColor();
    for(int i=0; i<pItem->subItems.size(); ++i)
    {
        CRect	rcSubItem;
        DWORD	nMarginWidth = 0;
        CRect	rcBounds;
        GetSubItemRect(nItem, i, LVIR_LABEL, &rcSubItem);

        nMarginWidth = LEFT_MARGIN_TEXT_COLUMN+3;

        if(i==0)
        {
            if( pItem->dwFlags&(LISTITEM_CHECKBOX|LISTITEM_RADIOBOX) )
            {
                nMarginWidth+=rcSubItem.left;
            }
            else
            {
                rcSubItem.left -= 19;
                nMarginWidth+=5;
            }
        }

#define DT_FLAGS_DRAW_TEXT		(DT_SINGLELINE|DT_LEFT|DT_NOPREFIX|DT_END_ELLIPSIS|DT_VCENTER)

        rcSubItem.left += LEFT_MARGIN_TEXT_COLUMN;
        rcSubItem.right -= 3;
        const TListSubItem &subItem = pItem->subItems[i];
        if(subItem.type == SUBITEM_LINK)
        {
            dc.SelectFont(m_fontLink);
            dc.SetTextColor(COLOR_LIST_LINK);

            CRect	rcProbeItem;
            dc.DrawText( subItem.str, -1, &rcProbeItem, DT_SINGLELINE|DT_LEFT|DT_NOPREFIX|DT_VCENTER|DT_CALCRECT);
            dc.DrawText( subItem.str, -1, &rcSubItem, DT_FLAGS_DRAW_TEXT);

            DWORD nMaxWidth = rcProbeItem.Width()+nMarginWidth;
            _SetColumnNeedWidth(i,nMaxWidth);
        }
        else
        {
            if (subItem.type == SUBITEM_ICON && subItem.nImg != NULL)
            {
                dc.DrawIconEx( rcSubItem.left, rcSubItem.top + 3, (HICON)subItem.nImg, 16 , 16, 0, 0, DI_NORMAL );
                rcSubItem.left = rcSubItem.left + 18;
            }
            else if (subItem.type == SUBITEM_PNG)
            {
                Gdiplus::Image* pImg = BkPngPool::Get(subItem.nImg);
                if (pImg)
                {
                    Gdiplus::Graphics graphics(dc);

                    SIZE size = {0, 0};
                    if (pImg)
                    {
                        size.cx = pImg->GetWidth();
                        size.cy = pImg->GetHeight();
                    }

                    graphics.DrawImage(pImg, Gdiplus::Rect(rcSubItem.left, rcSubItem.top + 5, size.cx, size.cy));
                }
                rcSubItem.left = rcSubItem.left + 18;
            } else if(subItem.type==SUBITEM_COMBO)
            {
                CDC	dcTmp;
                dcTmp.CreateCompatibleDC(dc);
                HBITMAP hBmpOld	= dcTmp.SelectBitmap(m_bitmapCombo);
                dc.BitBlt(rcSubItem.right-20, rcSubItem.top + 3, 20, 20, dcTmp, 0, 0, SRCCOPY);
                dcTmp.SelectBitmap(hBmpOld);
                dcTmp.DeleteDC();
            }

            UINT uFormat = DT_SINGLELINE|DT_LEFT|DT_NOPREFIX|DT_PATH_ELLIPSIS|DT_VCENTER;
            if (i == 3)
            {
                if (pItem->nLevel == enumLevelRisk)
                {
                    rcSubItem.DeflateRect(2, 3);

                    CPen penBorder;
                    penBorder.CreatePen( PS_SOLID, 1, RGB(224, 0, 0) );
                    CBrush bshInterior;
                    bshInterior.CreateSolidBrush( RGB(224, 0, 0)  );

                    HPEN hOldPen = dc.SelectPen( penBorder );
                    HBRUSH hOldBrush = dc.SelectBrush( bshInterior );

                    dc.RoundRect( rcSubItem, CPoint( 3, 3 ) );
                    dc.SelectPen(hOldPen);
                    dc.SelectBrush(hOldBrush);
                    dc.SetTextColor( RGB(255, 255, 255) );
                }
                else if (pItem->nLevel == enumLevelUnknown)
                {
                    rcSubItem.DeflateRect(2, 3);

                    CPen penBorder;
                    penBorder.CreatePen( PS_SOLID, 1, RGB(250, 115, 5) );
                    CBrush bshInterior;
                    bshInterior.CreateSolidBrush( RGB(250, 115, 5)  );

                    HPEN hOldPen = dc.SelectPen( penBorder );
                    HBRUSH hOldBrush = dc.SelectBrush( bshInterior );

                    dc.RoundRect( rcSubItem, CPoint( 3, 3 ) );
                    dc.SelectPen(hOldPen);
                    dc.SelectBrush(hOldBrush);
                    dc.SetTextColor( RGB(255, 255, 255) );
                }
                else
                    dc.SetTextColor( subItem.clr );

                uFormat = DT_SINGLELINE|DT_CENTER|DT_NOPREFIX|DT_PATH_ELLIPSIS|DT_VCENTER;
            }
            else
                dc.SetTextColor( subItem.clr );

            dc.DrawText( subItem.str, -1, &rcSubItem, uFormat);
            if (subItem.type == SUBITEM_ICON || subItem.type == SUBITEM_PNG)
                rcSubItem.left = rcSubItem.left - 18;

            CRect	rcProbeItem;
            dc.DrawText( subItem.str, -1, &rcProbeItem, DT_SINGLELINE|DT_LEFT|DT_NOPREFIX|DT_VCENTER|DT_CALCRECT);
            DWORD nMaxWidth = rcProbeItem.Width()+nMarginWidth;
            _SetColumnNeedWidth(i,nMaxWidth);
        }
    }

    CPen	penx;
    penx.CreatePen(PS_SOLID,1,pItem->clrBtmGapLine);
    HPEN	penOld = dc.SelectPen(penx);
    dc.MoveTo( lpdis->rcItem.left, lpdis->rcItem.bottom-1 );
    CRect rcClient;
    GetClientRect(rcClient);

    dc.LineTo( lpdis->rcItem.left + rcClient.Width(), lpdis->rcItem.bottom-1);
    dc.SelectPen(penOld);

    dc.SelectFont(hOldFont);
    dc.SetTextColor(oldClr);
    dc.Detach();
}
Example #17
0
void CListViewCtrlEx::_DrawTitleItem( LPDRAWITEMSTRUCT lpdis, const TListItem *pItem )
{
    ATLASSERT(pItem);

    if(pItem->subItems.empty())
        return ;

    int	nWinWidth=lpdis->rcItem.right-lpdis->rcItem.left;
    CRect	rcWindows;
    GetWindowRect(rcWindows);
    if ( nWinWidth > rcWindows.Width())
        nWinWidth = rcWindows.Width()-20;

    int nItem = lpdis->itemID;

    CDCHandle dc;
    dc.Attach(lpdis->hDC);
    dc.FillSolidRect( &lpdis->rcItem, pItem->clrBg);
    HFONT	hOldFont = dc.SelectFont(m_fontDef);
    COLORREF clrOld = dc.GetTextColor();
    COLORREF clrDef = clrOld;

    //
    RECT rcItem = lpdis->rcItem;
    if( pItem->dwFlags&LISTITEM_EXPANDABLE )
    {
        //3 + 9 + 3
        if(rcItem.left>-12)
        {
            CDC	dcTmp;
            dcTmp.CreateCompatibleDC(dc);
            HBITMAP hBmpOld	= dcTmp.SelectBitmap(m_bitmapExpand);
            RECT rcMinus = _GetRectMinus(rcItem);
            dc.BitBlt( rcMinus.left, rcMinus.top, 9, 9, dcTmp, pItem->_isclapsed? 9:0, 0, SRCCOPY);
            dcTmp.SelectBitmap(hBmpOld);
        }
    }

    for ( int i = 0; i < pItem->subItems.size(); i++)
    {
        bool	bVCenter=TRUE;
        const TListSubItem& subItem = pItem->subItems[i];
        CRect rcItem = subItem.rcOffset;
        if ( i == 0 )
        {
            rcItem = lpdis->rcItem;

            if(pItem->nTopMargin>=0)
            {
                rcItem.top += pItem->nTopMargin;
                rcItem.bottom -= 0;
                bVCenter=FALSE;
            }
            else
            {
                rcItem.top += 2;
                rcItem.bottom -= 2;
            }
            rcItem.left+= pItem->nLeftmargin;
        }
        else
        {
            if ( rcItem.left < 0 )
            {
                rcItem.left = nWinWidth+rcItem.left;
            }
            if (rcItem.right < 0)
            {
                rcItem.right = nWinWidth+rcItem.right;
            }
            rcItem.OffsetRect( lpdis->rcItem.left, lpdis->rcItem.top);
        }

        if ( subItem.type == SUBITEM_TEXT )
        {
            dc.SetTextColor( subItem.clr);
            dc.SelectFont(m_fontDef);
        }
        else if ( subItem.type == SUBITEM_LINK )
        {
            dc.SelectFont(m_fontLink);
            dc.SetTextColor(COLOR_LIST_LINK);
        }
        else
        {
            dc.SetTextColor( subItem.clr);
            dc.SelectFont(m_fontDef);
        }

        CString strTitle = subItem.str;
        DWORD	nFlag=DT_SINGLELINE|DT_LEFT|DT_NOPREFIX|DT_END_ELLIPSIS;
        if(bVCenter)
            nFlag|=DT_VCENTER;

        if (i==0&&pItem->bBold||pItem->nHeightAdd!=0)
        {
            HFONT	fntOld=dc.SelectFont(BkFontPool::GetFont(pItem->bBold,FALSE,FALSE,pItem->nHeightAdd));
            dc.DrawText( strTitle, -1, &rcItem, nFlag);
            dc.SelectFont(fntOld);
        }
        else
            dc.DrawText( strTitle, -1, &rcItem, nFlag);
    }

    CPen	pex;
    pex.CreatePen(PS_SOLID,1,pItem->clrBtmGapLine);
    HPEN	penOld = dc.SelectPen(pex);
    dc.MoveTo( lpdis->rcItem.left, lpdis->rcItem.bottom-1 );
    dc.LineTo( lpdis->rcItem.right, lpdis->rcItem.bottom-1 );

    dc.SetTextColor(clrOld);
    dc.SelectPen(penOld);
    dc.SelectFont(hOldFont);
    dc.Detach();
}
Example #18
0
void CDxDatePickerMonth::DrawDaysOfWeek(CDCHandle dc)
{
    if (m_rcDaysOfWeek.IsRectEmpty())
        return;

    // fill background
    dc.FillSolidRect(m_rcDaysOfWeek, m_clrDaysOfWeekBack);

    // draw days of week text
    dc.SetBkColor(m_clrDaysOfWeekBack);
    dc.SetTextColor(m_clrDaysOfWeekText);

    HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));

    int nMaxX = 0;
    SIZE szText;

    dc.GetTextExtent(_T("XX"), 2, &szText);

    int nTwoLetterWidth = szText.cx;
    int nWholeLetterWidth = 0;

    for (int i = 0; i < XTP_WEEK_DAYS; i++)
    {
        CString strText(m_pControl->GetDayOfWeekName(i));

        dc.GetTextExtent(strText, strText.GetLength(), &szText);
        nWholeLetterWidth = max(nWholeLetterWidth, szText.cx);
    }

    for (int nDayDelta = 0; nDayDelta < XTP_WEEK_DAYS; nDayDelta++)
    {
        // calc item rect
        CDxDatePickerDay* pDay = GetDay(nDayDelta);
        CRect rcItem(pDay->GetRect());
        rcItem.top = m_rcDaysOfWeek.top;
        rcItem.bottom = m_rcDaysOfWeek.bottom - 2;
        nMaxX = rcItem.right;

        // get item text
        CString strText(m_pControl->GetDayOfWeekName(pDay->GetDate().GetDayOfWeek()));

        // Check if we can draw whole text
        if (nWholeLetterWidth + 4 <= rcItem.Width())
        {
            dc.DrawText(strText, strText.GetLength(), &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
        }
        else if (nTwoLetterWidth + 4 <= rcItem.Width()) // Draw 2 letters
        {
            int nChrLen = (int)_tcsnbcnt(strText, 2);
            dc.DrawText(strText, nChrLen, &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
        }
        else // Draw only first letter
        {
            int nChrLen = (int)_tcsnbcnt(strText, 1);
            dc.DrawText(strText, nChrLen, &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
        }
    }

    // draw bottom line on days of the week
    CRect rcBottomLine(m_rcDaysOfWeek);
    rcBottomLine.bottom--;
    rcBottomLine.top = rcBottomLine.bottom - 1;
    rcBottomLine.left = m_rcWeekNumbers.right - 1;
    rcBottomLine.right = nMaxX;
    dc.FillSolidRect(rcBottomLine, m_clrMonthBorder);

    dc.SelectFont(hFontOld);
}
int CTooltipText::x_GetLineHeight(CDCHandle& dc)
{
	CRect rc (0,0,0,0) ;
	dc.DrawText ( _T("H") , 1 , &rc , DT_CALCRECT|DT_NOPREFIX|DT_NOCLIP ) ;
	return rc.Height() ;
}
void CCategoryItem::DoPaint(CDCHandle dc, ButtonStatus eTabStatus, CategoryPosition btnPos, ButtonStatus eBtn, bool bDrawCloseBtn, int iDeltaHeight)
{
	// m_iXPos: x-value
	// iDeltaHeight: y-value
	// CATEGORY_ITEM_OVERLAP 重叠宽度

	RECT rcItem = { m_iXPos, iDeltaHeight, m_iXPos + m_iWidth + CATEGORY_ITEM_OVERLAP, iDeltaHeight + s()->Category()->GetCategoryHeight() };

	// 画背景
	s()->Category()->DrawCategory(dc, rcItem, eTabStatus);

	int iXTitlePos;

	// if this item is selected, draw Close btn
	// 画关闭图标
	if (bDrawCloseBtn && !GetWebData()->IsNoClose())
	{
		// 关闭图标的y坐标
		int iYCloseBtn = (s()->Category()->GetCategoryHeight() - s()->Category()->GetCategoryCloseButtonHeight()) / 2 + iDeltaHeight;

		RECT rcCloseBtn = { rcItem.right - s()->Category()->GetCategoryCloseButtonWidth() - s()->Category()->GetCategoryMargin(), iYCloseBtn,
			rcItem.right - s()->Category()->GetCategoryMargin(), iYCloseBtn + s()->Category()->GetCategoryCloseButtonHeight() };

		OffsetRect(&rcCloseBtn, -CATEGORY_ITEM_OVERLAP, 0);

		s()->Category()->DrawCategoryCloseButton(dc, rcCloseBtn, btnPos == CatePos_TabItemClose ? eBtn : Btn_MouseOut);
		iXTitlePos = rcCloseBtn.left;
	}
	else // 不画关闭图标
		iXTitlePos = rcItem.right - s()->Category()->GetCategoryMargin();


	bool bSelectedItem = false;
	if (m_pCateCtrl && m_pCateCtrl->GetCurrentSelection() == this)
		bSelectedItem = true;

	// 画logo图和Title
	// Draw the image.
	if (GetWebData() != NULL)
	{
		// 		int iIconWidth = GetWebData()->GetLogo().GetWidth();
		// 		int iIconHeight = GetWebData()->GetLogo().GetHeight();
		// 		POINT pt = { rcItem.left + s()->Category()->GetCategoryMargin(), (s()->Category()->GetCategoryHeight() - iIconHeight) / 2 + iDeltaHeight };
		// 		GetWebData()->GetLogo().Draw(dc, pt.x, pt.y + 3);

		// png icon
		int iIconWidth = GetWebData()->GetLogoPng(bSelectedItem).GetWidth();
		int iIconHeight = GetWebData()->GetLogoPng(bSelectedItem).GetHeight();
		POINT pt = { rcItem.left + s()->Tab()->GetTabMargin(), (s()->Tab()->GetTabHeight() - iIconHeight) / 2 + iDeltaHeight };
		CRect rcDest(pt.x, pt.y, pt.x + iIconWidth, pt.y + iIconHeight);
		rcDest.OffsetRect(0, 1);
		CRect rcSrc(0, 0, iIconWidth, iIconHeight);
		GetWebData()->GetLogoPng(bSelectedItem).ResetCacheDC(); // CacheDC没有正确设置,这里重新设置一下
		GetWebData()->GetLogoPng(bSelectedItem).Draw(dc, rcDest, rcSrc);

		if (ShowSecureLock())
		{
			int iIconHeight = 0;
			//POINT pt = { rcItem.left + s()->Tab()->GetTabMargin(), (s()->Tab()->GetTabHeight() - iIconHeight) / 2 + iDeltaHeight };
			POINT pt = { rcItem.left, rcItem.top };
			CRect rcMiniLock(pt.x, pt.y, pt.x + 15, pt.y + 16);
			OffsetRect(&rcMiniLock, 12, 10);
			s()->Tab()->DrawTabMiniLockButton(dc, rcMiniLock, (ButtonStatus)0);
		}

		dc.SetTextColor(eTabStatus == Btn_MouseDown ? RGB(16, 93, 145) : RGB(29, 126, 191));
		RECT rcText = { rcItem.left + s()->Category()->GetCategoryMargin() + 20 + CATEGORY_IMAGE_TEXT_MARGIN, 6, iXTitlePos - CATEGORY_TEXT_CLOSE_MARGIN, s()->Category()->GetCategoryHeight() };
		OffsetRect(&rcText, -1, -2);
		dc.DrawText(GetWebData()->GetName(), -1, &rcText, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX);
	}
}