ElementTextDefault.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROCKETCOREELEMENTTEXTDEFAULT_H
00029 #define ROCKETCOREELEMENTTEXTDEFAULT_H
00030
00031 #include <Rocket/Core/Header.h>
00032 #include <Rocket/Core/ElementText.h>
00033 #include <Rocket/Core/Geometry.h>
00034
00035 namespace Rocket {
00036 namespace Core {
00037
00042 class ROCKETCORE_API ElementTextDefault : public ElementText
00043 {
00044 public:
00045 ElementTextDefault(const String& tag);
00046 virtual ~ElementTextDefault();
00047
00048 virtual void SetText(const WString& text);
00049 virtual const WString& GetText() const;
00050
00051 virtual void OnRender();
00052
00057 virtual bool GenerateToken(float& token_width, int token_begin);
00067 virtual bool GenerateLine(WString& line, int& line_length, float& line_width, int line_begin, float maximum_line_width, float right_spacing_width, bool trim_whitespace_prefix);
00068
00070 virtual void ClearLines();
00074 virtual void AddLine(const Vector2f& line_position, const WString& line);
00075
00077 virtual void SuppressAutoLayout();
00078
00079 protected:
00080 virtual void OnPropertyChange(const PropertyNameList& properties);
00081
00084 virtual void GetRML(String& content);
00085
00087 virtual void DirtyFont();
00088
00089 private:
00090
00091
00092 bool UpdateFontConfiguration();
00093
00094
00095 struct Line
00096 {
00097 Line(const WString& text, const Vector2f& position) : text(text), position(position)
00098 {
00099 width = 0;
00100 }
00101
00102 WString text;
00103 Vector2f position;
00104 int width;
00105 };
00106
00107
00108 void GenerateGeometry(FontFaceHandle* font_face_handle);
00109
00110 void GenerateGeometry(FontFaceHandle* font_face_handle, Line& line);
00111
00112 void GenerateDecoration(FontFaceHandle* font_face_handle, const Line& line);
00113
00114 WString text;
00115
00116 typedef std::vector< Line > LineList;
00117 LineList lines;
00118
00119 bool dirty_layout_on_change;
00120
00121 GeometryList geometry;
00122 bool geometry_dirty;
00123
00124 Colourb colour;
00125
00126
00127 Geometry decoration;
00128
00129 int generated_decoration;
00130
00131
00132
00133 int decoration_property;
00134
00135 int font_configuration;
00136 bool font_dirty;
00137 };
00138
00139 }
00140 }
00141
00142 #endif