Example #1
0
VOID CDUIProgressBarBase::PaintForgnd(HDC dc)
{
	RECT rtContent = GetContentRect();
	
	CRefPtr<CImageList> pImage = m_uiData.m_imageBK;
	if(!pImage.IsNull() 
		&& !pImage->IsNull() 
		&& pImage->GetItemCount() >= PROCRSS_BAR_IMAGE_COUNT)
	{
		RECT rtTemp = {0};
		GetProgressRect(rtContent, rtTemp);
		if(!IsRectEmpty(&rtTemp))
		{
			CDUIRenderClip clip2(dc, rtTemp);
			if(IsVertical())
			{
				pImage->VerticalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_FORE);
			}
			else
			{
				pImage->HorizontalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_FORE);
			}
		}
	}
	else
	{
		DUI_ASSERT(FALSE);
	}
}
Example #2
0
VOID CDUIIconTextItem::PaintForgnd(HDC dc)
{
	CRefPtr<CImageList> pIcon;
	if(m_bExpand)
	{
		pIcon = m_uiData.m_pExpandIcon;
	}
	else
	{
		pIcon = m_uiData.m_pNormalIcon;
	}

	if(pIcon.IsNull() || pIcon->IsNull())
	{
		return;
	}
	
	INT nImageIndex(m_nIconIndex);
	if(nImageIndex >= pIcon->GetItemCount())
	{
		nImageIndex = 0;
	}

	RECT rtIcon = GetIconRect();
	pIcon->DrawInCenter(dc , rtIcon, nImageIndex);
}
Example #3
0
VOID CDUIProgressBarBase::SetAttribute(const CDUIString& strName, const CDUIString& strValue)
{
	BOOL bHandled(FALSE);
	if(strName.compare(_T("back_image")) == 0)
	{
		CRefPtr<CImageList> pImage = GetSkinMgr()->GetImage(strValue);
		DUI_ASSERT(!pImage.IsNull() && (pImage->GetItemCount() >= PROCRSS_BAR_IMAGE_COUNT));
		
		CProgressBarUIData data;
		data.m_imageBK = pImage;
		SetUIData(data);

		bHandled = TRUE;
	}
	else if(strName.compare(_T("range")) == 0)
	{
		TCHAR szValue[128] = {0};
		lstrcpyn(szValue, strValue.c_str(), sizeof(szValue) / sizeof(TCHAR) - 1);
		LPTSTR pstr = szValue;
		INT nItem1 = _tcstol(pstr, &pstr, 10);    
		INT nItem2 = _tcstol(pstr + 1, &pstr, 10); 	

		SetRange(nItem1, nItem2);
		bHandled = TRUE;
	}
	else if(strName.compare(_T("pos")) == 0)
	{
		INT nPos = _ttol(strValue.c_str());
		SetPos(nPos);
		bHandled = TRUE;
	}
	

	if(!bHandled)
	{
		theBase::SetAttribute(strName, strValue);
	}
}
Example #4
0
VOID CDUIProgressBarBase::PaintBkgnd(HDC dc)
{
	RECT rtContent = GetContentRect();
	
	CRefPtr<CImageList> pImage = m_uiData.m_imageBK;
	if(!pImage.IsNull() 
		&& !pImage->IsNull() 
		&& pImage->GetItemCount() >= PROCRSS_BAR_IMAGE_COUNT)
	{
		if(IsVertical())
		{
			pImage->VerticalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_BK);
		}
		else
		{
			pImage->HorizontalStretch(dc, rtContent, PROCRSS_BAR_IMAGE_BK);
		}
	}
	else
	{
		DUI_ASSERT(FALSE);
	}
}