Beispiel #1
0
	void TextElement::RenderContent(RenderContext& ctx)
	{
		// TODO: for now, don't render unless they specify the rect
		if (ctx.bCalculate)
		{
			Gdiplus::Rect rcTemp;
			if (RectFromStyle(GetStyle(), rcTemp))
			{
				ctx.rect.Width = max(ctx.rect.Width, rcTemp.X + rcTemp.Width);
				ctx.rect.Height = max(ctx.rect.Height, rcTemp.Y + rcTemp.Height);
			}
			m_rect = rcTemp;

			return;
		}

		TextStyle textStyle = TextStyleFromString(GetStyle().Get(L"text-style", L"normal"));
		if (textStyle == TextStyleVector)
			DrawTextVector(ctx);
		else if (textStyle == TextStyleNormal)
			DrawTextNormal(ctx);
	}
void TextBoxRenderComponent::OnRender(VariantList *pVList)
{

	if (*m_pAlpha <= 0) return;

	CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
	//vFinalPos -= GetAlignmentOffset(*m_pEnclosedSize2d, eAlignment(*m_pAlignment));

	switch(*m_pStyle)
	{
	case STYLE_NORMAL:
		DrawTextNormal(vFinalPos);
		break;
	case STYLE_TYPE:
		DrawTextType(vFinalPos);
		break;
	}

#ifdef _DEBUG
	
	//useful for debugging where the text area rect really is
	//DrawRect(vFinalPos, *m_pSize2d, MAKE_RGBA(200,200,0,200**m_pAlpha));
#endif
}