/* GWEN Copyright (c) 2010 Facepunch Studios See license in Gwen.h */ #pragma once #ifndef GWEN_CONTROLS_RICHLABEL_H #define GWEN_CONTROLS_RICHLABEL_H #include "../gwen_baserender.h" #include "gwen_base.h" #include "gwen_text.h" namespace Gwen { namespace Controls { class GWEN_EXPORT RichLabel : public Controls::Base { public: GWEN_CONTROL( RichLabel, Gwen::Controls::Base ); void AddLineBreak(); void AddText( const Gwen::TextObject& text, Gwen::Color color, Gwen::Font* font = NULL ); virtual bool SizeToChildren( bool w = true, bool h = true ); protected: struct DividedText { typedef stl::list List; DividedText() { type = 0; font = NULL; } unsigned char type; Gwen::String text; Gwen::Color color; Gwen::Font* font; }; void Layout( Gwen::Skin::Base* skin ); void SplitLabel( const Gwen::String& text, Gwen::Font* pFont, const DividedText& txt, int& x, int& y, int& lineheight ); void CreateNewline( int& x, int& y, int& lineheight ); void CreateLabel( const Gwen::String& text, const DividedText& txt, int& x, int& y, int& lineheight, bool NoSplit ); void Rebuild(); void OnBoundsChanged( Gwen::Rect oldBounds ); DividedText::List m_TextBlocks; bool m_bNeedsRebuild; }; } } #endif