int32 ValueToString<EImageOrientation>( const EImageOrientation& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eImageOrientation_Normal:
			rString = CGUIString("eImageOrientation_Normal");
			break;
		case eImageOrientation_90CW:
			rString =  CGUIString("eImageOrientation_90CW");
			break;
		case eImageOrientation_90CCW:
			rString =  CGUIString("eImageOrientation_90CCW");
			break;
		case eImageOrientation_FlipHorizon:
			rString =  CGUIString("eImageOrientation_FlipHorizon");
			break;
		case eImageOrientation_FlipVertical:
			rString =  CGUIString("eImageOrientation_FlipVertical");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EImageOrientation]]: unknown image orientation <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<EParticle2DSystemMode>( const EParticle2DSystemMode& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eParticle2DSystemMode_Gravity:
			rString = CGUIString("eParticle2DSystemMode_Gravity");
			break;
		case eParticle2DSystemMode_Radius:
			rString = CGUIString("eParticle2DSystemMode_Radius");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EParticle2DSystemMode]]: unknown EParticle2DSystemMode enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<EScreenValue>( const EScreenValue& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eScreenValue_Pixel:
			rString = CGUIString("eScreenValue_Pixel");
			break;
		case eScreenValue_Percentage:
			rString = CGUIString("eScreenValue_Percentage");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EScreenValue]]: unknown image orientation <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<EOrientation>( const EOrientation& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eOrientation_Vertical:
			rString = CGUIString("eOrientation_Vertical");
			break;
		case eOrientation_Horizontal:
			rString = CGUIString("eOrientation_Horizontal");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EOrientation]]: unknown EOrientation enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<EInterpolationType>( const EInterpolationType& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eInterpolationType_Linear:
			rString = CGUIString("eInterpolationType_Linear");
			break;
		case eInterpolationType_EaseIn:
			rString = CGUIString("eInterpolationType_EaseIn");
			break;
		case eInterpolationType_EaseInOut:
			rString = CGUIString("eInterpolationType_EaseInOut");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EInterpolationType]]: unknown EInterpolationType enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<ETextAlignmentVert>( const ETextAlignmentVert& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eTextAlignment_Vert_Up:
			rString = CGUIString("eTextAlignment_Vert_Up");
			break;
		case eTextAlignment_Vert_Down:
			rString = CGUIString("eTextAlignment_Vert_Down");
			break;
		case eTextAlignment_Vert_Center:
			rString = CGUIString("eTextAlignment_Vert_Center");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[ETextAlignmentVert]]: unknown ETextAlignmentVert enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	int32 ValueToString<ETextAlignmentHorz>( const ETextAlignmentHorz& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eTextAlignment_Horz_Left:
			rString = CGUIString("eTextAlignment_Horz_Left");
			break;
		case eTextAlignment_Horz_Right:
			rString = CGUIString("eTextAlignment_Horz_Right");
			break;
		case eTextAlignment_Horz_Center:
			rString = CGUIString("eTextAlignment_Horz_Center");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[ETextAlignmentHorz]]: unknown ETextAlignmentHorz enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
Exemple #8
0
// BidiTransform is used to handle RTL text flipping in the string
void CGUITextLayout::BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder)
{
  for (unsigned int i=0; i<lines.size(); i++)
  {
    CGUIString &line = lines[i];

    // reserve enough space in the flipped text
    vecText flippedText;
    flippedText.reserve(line.m_text.size());

    character_t sectionStyle = 0xffff0000; // impossible to achieve
    std::wstring sectionText;
    for (vecText::iterator it = line.m_text.begin(); it != line.m_text.end(); ++it)
    {
      character_t style = *it & 0xffff0000;
      if (style != sectionStyle)
      {
        if (!sectionText.empty())
        { // style has changed, bidi flip text
          std::wstring sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
          for (unsigned int j = 0; j < sectionFlipped.size(); j++)
            flippedText.push_back(sectionStyle | sectionFlipped[j]);
        }
        sectionStyle = style;
        sectionText.clear();
      }
      sectionText.push_back( (wchar_t)(*it & 0xffff) );
    }

    // handle the last section
    if (!sectionText.empty())
    {
      std::wstring sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
      for (unsigned int j = 0; j < sectionFlipped.size(); j++)
        flippedText.push_back(sectionStyle | sectionFlipped[j]);
    }

    // replace the original line with the proccessed one
    lines[i] = CGUIString(flippedText.begin(), flippedText.end(), line.m_carriageReturn);
  }
}
	int32 ValueToString<EBlendFunc>( const EBlendFunc& rValue, CGUIString& rString )
	{
		switch(rValue)
		{
		case eBlendFunc_ZERO:
			rString = CGUIString("eBlendFunc_ZERO");
			break;
		case eBlendFunc_ONE:
			rString = CGUIString("eBlendFunc_ONE");
			break;
		case eBlendFunc_SRC_COLOR:
			rString = CGUIString("eBlendFunc_SRC_COLOR");
			break;
		case eBlendFunc_ONE_MINUS_SRC_COLOR:
			rString = CGUIString("eBlendFunc_ONE_MINUS_SRC_COLOR");
			break;
		case eBlendFunc_SRC_ALPHA:
			rString = CGUIString("eBlendFunc_SRC_ALPHA");
			break;
		case eBlendFunc_ONE_MINUS_SRC_ALPHA:
			rString = CGUIString("eBlendFunc_ONE_MINUS_SRC_ALPHA");
			break;
		case eBlendFunc_DST_ALPHA:
			rString = CGUIString("eBlendFunc_DST_ALPHA");
			break;
		case eBlendFunc_ONE_MINUS_DST_ALPHA:
			rString = CGUIString("eBlendFunc_ONE_MINUS_DST_ALPHA");
			break;
		default:
			GUI_THROW( GUI_FORMAT(
				"[ValueToString[EBlendFunc]]: unknown EBlendFunc enum <%d>",
				rValue));
			return -1;
		}
		return 0;
	}
	//------------------------------------------------------------------------------
	void	CGUIColListHeader::AddSegment( const CGUIStringW& rText, uint32 nId )
	{
		CGUIColListHeaderSegment * pSegment = static_cast<CGUIColListHeaderSegment*>(GUI_CREATE_WIDGET(m_strSegmentType.c_str(), CGUIString("segment_")+GSystem->GenerateAnonymousName(), GetSceneName()));
		pSegment->SetParent(this);
		m_vecSegment.push_back(pSegment);
		pSegment->SetTextContent(pText);
		pSegment->SetTextInfo(GetSegmentTextInfo());

		CGUIImage* pImage = NULL;
		if( pImage = GetImage("COLUMN_HEADER_NORMAL"))
		{
			pSegment->SetImage("COLUMN_HEADER_NORMAL", pImage);
		}
		if( pImage = GetImage("COLUMN_HEADER_HOVER"))
		{
			pSegment->SetImage("COLUMN_HEADER_HOVER", pImage);
		}
		if( pImage = GetImage("COLUMN_HEADER_PUSH"))
		{
			pSegment->SetImage("COLUMN_HEADER_PUSH", pImage);
		}
		
		pSegment->SetSize( m_aSegmentDefaultSize);

		if(!m_pSortedSegment)
		{
			m_pSortedSegment = m_vecSegment[0];
		}

		LayoutSegment();
	}