MarkupTextManager.h
Go to the documentation of this file.00001 00014 #ifndef __MarkupTextManager_H__ 00015 #define __MarkupTextManager_H__ 00016 00017 // Includes 00018 #include "Singleton.h" 00019 #include "StringId.h" 00020 #include "Array.h" 00021 00022 // Forward declares 00023 class Asset; 00024 class Font; 00025 00026 // MarkupTextManager 00027 class MarkupTextManager:public Singleton<MarkupTextManager> 00028 { 00029 public: 00030 MarkupTextManager(); 00031 virtual ~MarkupTextManager(); 00032 00033 00034 enum FontStyle 00035 { 00036 FontStyle_StringId, 00037 FontStyle_Normal, 00038 FontStyle_Bold, 00039 FontStyle_Italic, 00040 FontStyle_BoldItalic, 00041 FontStyle_Headline, 00042 FontStyle_Link, 00043 FontStyle_LinkHover, 00044 FontStyle_Option, 00045 FontStyle_OptionHover, 00046 FontStyle_OptionDisabled, 00047 }; 00048 00049 void SetFontStyle( 00050 FontStyle style, 00051 const Asset& font, 00052 unsigned short color 00053 ); 00054 00055 void SetFontStyle( 00056 FontStyle style, 00057 const Asset& font, 00058 unsigned short color, 00059 unsigned short bgcolor, 00060 unsigned char opacity = 255 00061 ); 00062 00063 void SetFontStyle( 00064 StringId style, 00065 const Asset& font, 00066 unsigned short color 00067 ); 00068 00069 void SetFontStyle( 00070 StringId style, 00071 const Asset& font, 00072 unsigned short color, 00073 unsigned short bgcolor, 00074 unsigned char opacity = 255 00075 ); 00076 00077 Font* GetFont( 00078 FontStyle style 00079 ); 00080 00081 unsigned short GetFontColor( 00082 FontStyle style 00083 ); 00084 00085 unsigned char GetFontBgOpacity( 00086 FontStyle style 00087 ); 00088 00089 unsigned short GetFontBgColor( 00090 FontStyle style 00091 ); 00092 00093 Font* GetFont( 00094 StringId style 00095 ); 00096 00097 unsigned short GetFontColor( 00098 StringId style 00099 ); 00100 00101 unsigned char GetFontBgOpacity( 00102 StringId style 00103 ); 00104 00105 unsigned short GetFontBgColor( 00106 StringId style 00107 ); 00108 00109 void RegisterVariable( 00110 StringId name, 00111 int* value 00112 ); 00113 00114 void RegisterVariable( 00115 StringId name, 00116 StringId* value 00117 ); 00118 00119 void RegisterVariable( 00120 StringId name, 00121 Array<int>* values 00122 ); 00123 00124 void RegisterVariable( 00125 StringId name, 00126 Array<StringId>* value 00127 ); 00128 00129 void UnregisterVariable( 00130 StringId name 00131 ); 00132 00133 void GetVariableValue( 00134 StringId name, 00135 char* buffer, 00136 int bufferSize 00137 ); 00138 00139 void GetVariableValue( 00140 StringId name, 00141 int index, 00142 char* buffer, 00143 int bufferSize 00144 ); 00145 00146 private: 00147 struct FontStyleDefinition 00148 { 00149 StringId styleId; 00150 FontStyle style; 00151 Font* font; 00152 unsigned short color; 00153 unsigned char opacity; 00154 unsigned short bgcolor; 00155 }; 00156 00157 FontStyleDefinition* FindFontStyle( 00158 FontStyle style 00159 ); 00160 00161 FontStyleDefinition* FindFontStyle( 00162 StringId style 00163 ); 00164 00165 void RemoveFontStyle(FontStyle style); 00166 void AddFontStyle(FontStyle style, const Asset& font, unsigned short color, unsigned char opacity, unsigned short bgcolor); 00167 00168 void RemoveFontStyle(StringId style); 00169 void AddFontStyle(StringId style, const Asset& font, unsigned short color, unsigned char opacity, unsigned short bgcolor); 00170 00171 struct RegisteredVariable 00172 { 00173 StringId name; 00174 StringId* stringIdValue; 00175 int* intValue; 00176 Array<StringId>* stringIdArray; 00177 Array<int>* intArray; 00178 }; 00179 00180 const RegisteredVariable* FindRegisteredVariable( 00181 StringId name 00182 ); 00183 private: 00184 Array<FontStyleDefinition> fontStyleDefinitions_; 00185 00186 Array<RegisteredVariable> registeredVariables_; 00187 }; 00188 00189 #define siMarkupTextManager MarkupTextManager::GetInstance() 00190 00191 #endif /* __MarkupTextManager_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
