Esempio n. 1
0
bool
ESSimpleRenderView::Create(int nId, _Rect rRect, MercuryBaseView* pOwner, ESChildControl* pParent){
	m_szPage.SetSize(rRect.Width(), rRect.Height());
	m_szView.SetSize(rRect.Width(), m_nContentHeight);
	bool bRet = ESChildScrollView::Create(nId, rRect, pOwner, pParent);
	if( bRet ){
		}
	return bRet;
	}
Esempio n. 2
0
void
RenderItemText::Draw(_DC* pDC, _Rect rcItem, _Rect rcDraw, ESChildControl* pControl){
	if( !m_pStyle ) return;
	Font*	pFontOld	= pDC->SelectObject(&m_pStyle->m_font);
	int		nBkModeOld	= pDC->SetBkMode(TRANSPARENT);
	pDC->SetTextColor(m_crText);

	_Rect rcText;
	if( m_nHAlign == Alignment::HAlign_Center ){
		rcText.left		= rcItem.left + (rcItem.Width() - m_szText.cx)/2;
		rcText.right	= rcText.left + m_szText.cx;
		}
	else{
		if( m_nHAlign == Alignment::HAlign_Right ){
			rcText.left		= rcItem.right - m_szText.cx;
			rcText.right	= rcItem.right;
			}
		else{
			rcText.left		= rcItem.left;
			rcText.right	= rcItem.left + m_szText.cx;
			}
		}

	if( m_nVAlign == Alignment::VAlign_Middle ){
		rcText.top		= rcItem.top + (rcItem.Height() - m_szText.cy)/2;
		rcText.bottom	= rcText.top + m_szItem.cy;
		}
	else{
		if( m_nVAlign == Alignment::VAlign_Bottom ){
			rcText.top		= rcItem.bottom - m_szText.cy;
			rcText.bottom	= rcItem.bottom;
			}
		else{
			rcText.top		= rcItem.top;
			rcText.bottom	= rcItem.top + m_szText.cy;
			}
		}
		
	_string sText = m_sText;
	if( sText.length() )
		ESLocalizationMan::ParseText(sText);
	pDC->ExtTextOut     (rcText.left, rcText.top, ETO_CLIPPED, rcDraw, sText.c_str());
	pDC->SetBkMode		(nBkModeOld);
	pDC->SelectObject	(pFontOld);
	}
Esempio n. 3
0
bool
ESChildSlider::CalcCursorRect(_Rect rcBar, _Rect& rcCursor){
	_Size szCursorImg(0, 0);
	float fZoomCX = 1.0f, fZoomCY = 1.0f;
	if( m_pOwner )
		m_pOwner->GetZoom(fZoomCX, fZoomCY);
	if( !m_imageCursor.IsNull() )
		szCursorImg.SetSize(m_imageCursor.GetWidth()*fZoomCX, m_imageCursor.GetHeight()*fZoomCY);

	if( m_nPos < m_nMin ){
		m_nPos				= m_nMin;
		if( m_bVerticalMode ){
			rcCursor.top		= rcBar.bottom - szCursorImg.cy;
			rcCursor.left		= rcBar.left + (rcBar.Width() - szCursorImg.cx)/2;
			rcCursor.right		= rcCursor.left + szCursorImg.cx;
			rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
			}
		else{
			rcCursor.left		= rcBar.left;
			rcCursor.top		= rcBar.top + (rcBar.Height() - szCursorImg.cy)/2;
			rcCursor.right		= rcCursor.left + szCursorImg.cx;
			rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
			}
		return true;
		}

	if( m_nPos > m_nMax ){
		m_nPos				= m_nMax;
		if( m_bVerticalMode ){
			rcCursor.top		= rcBar.top;
			rcCursor.left		= rcBar.left + (rcBar.Width() - szCursorImg.cx)/2;
			rcCursor.right		= rcCursor.left + szCursorImg.cx;
			rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
			}
		else{
			rcCursor.left		= rcBar.right - szCursorImg.cx;
			rcCursor.top		= rcBar.top + (rcBar.Height() - szCursorImg.cy)/2;
			rcCursor.right		= rcCursor.left + szCursorImg.cx;
			rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
			}
		return true;
		}

	if( m_bVerticalMode ){
		float fDelta		= (float)((rcBar.Height() - szCursorImg.cy) / ((m_nMax - m_nMin)*1.0f));
		m_ptCursorPos.y		= (rcBar.bottom - szCursorImg.cy) - (int)(fDelta*(m_nPos - m_nMin));
		m_ptCursorPos.x		= rcBar.left;

		rcCursor.top		= m_ptCursorPos.y;
		rcCursor.left		= rcBar.left + (rcBar.Width() - szCursorImg.cx)/2;
		rcCursor.right		= rcCursor.left + szCursorImg.cx;
		rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
		}
	else{
		float fDelta		= (float)((rcBar.Width() - szCursorImg.cx) / ((m_nMax - m_nMin)*1.0f));
		m_ptCursorPos.x		= rcBar.left + (int)(fDelta*(m_nPos - m_nMin));
		m_ptCursorPos.y		= rcBar.top;

		rcCursor.left		= m_ptCursorPos.x;
		rcCursor.top		= rcBar.top + (rcBar.Height() - szCursorImg.cy)/2;
		rcCursor.right		= rcCursor.left + szCursorImg.cx;
		rcCursor.bottom		= rcCursor.top + szCursorImg.cy;
		}
	return true;
	}