00001 /*------------------------------------------------------------------------- 00002 This source file is a part of OGRE 00003 (Object-oriented Graphics Rendering Engine) 00004 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2012 Torus Knot Software Ltd 00008 Permission is hereby granted, free of charge, to any person obtaining a copy 00009 of this software and associated documentation files (the "Software"), to deal 00010 in the Software without restriction, including without limitation the rights 00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 copies of the Software, and to permit persons to whom the Software is 00013 furnished to do so, subject to the following conditions: 00014 00015 The above copyright notice and this permission notice shall be included in 00016 all copies or substantial portions of the Software. 00017 00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 THE SOFTWARE 00025 -------------------------------------------------------------------------*/ 00026 00027 #ifndef _TextAreaOverlayElement_H__ 00028 #define _TextAreaOverlayElement_H__ 00029 00030 #include "OgreOverlayElement.h" 00031 #include "OgreFont.h" 00032 00033 namespace Ogre 00034 { 00043 class _OgreExport TextAreaOverlayElement : public OverlayElement 00044 { 00045 public: 00046 enum Alignment 00047 { 00048 Left, 00049 Right, 00050 Center 00051 }; 00052 00053 public: 00055 TextAreaOverlayElement(const String& name); 00056 virtual ~TextAreaOverlayElement(); 00057 00058 virtual void initialise(void); 00059 virtual void setCaption(const DisplayString& text); 00060 00061 void setCharHeight( Real height ); 00062 Real getCharHeight() const; 00063 00064 void setSpaceWidth( Real width ); 00065 Real getSpaceWidth() const; 00066 00067 void setFontName( const String& font ); 00068 const String& getFontName() const; 00069 00071 virtual const String& getTypeName(void) const; 00073 const MaterialPtr& getMaterial(void) const; 00075 void getRenderOperation(RenderOperation& op); 00077 void setMaterialName(const String& matName); 00078 00085 void setColour(const ColourValue& col); 00086 00088 const ColourValue& getColour(void) const; 00095 void setColourBottom(const ColourValue& col); 00097 const ColourValue& getColourBottom(void) const; 00104 void setColourTop(const ColourValue& col); 00106 const ColourValue& getColourTop(void) const; 00107 00108 inline void setAlignment( Alignment a ) 00109 { 00110 mAlignment = a; 00111 mGeomPositionsOutOfDate = true; 00112 } 00113 inline Alignment getAlignment() const 00114 { 00115 return mAlignment; 00116 } 00117 00119 void setMetricsMode(GuiMetricsMode gmm); 00120 00122 void _update(void); 00123 00124 //----------------------------------------------------------------------------------------- 00128 class _OgrePrivate CmdCaption : public ParamCommand 00129 { 00130 public: 00131 String doGet( const void* target ) const; 00132 void doSet( void* target, const String& val ); 00133 }; 00134 //----------------------------------------------------------------------------------------- 00138 class _OgrePrivate CmdCharHeight : public ParamCommand 00139 { 00140 public: 00141 String doGet( const void* target ) const; 00142 void doSet( void* target, const String& val ); 00143 }; 00144 //----------------------------------------------------------------------------------------- 00148 class _OgrePrivate CmdSpaceWidth : public ParamCommand 00149 { 00150 public: 00151 String doGet( const void* target ) const; 00152 void doSet( void* target, const String& val ); 00153 }; 00154 //----------------------------------------------------------------------------------------- 00158 class _OgrePrivate CmdFontName : public ParamCommand 00159 { 00160 public: 00161 String doGet( const void* target ) const; 00162 void doSet( void* target, const String& val ); 00163 }; 00164 //----------------------------------------------------------------------------------------- 00168 class _OgrePrivate CmdColourTop : public ParamCommand 00169 { 00170 public: 00171 String doGet( const void* target ) const; 00172 void doSet( void* target, const String& val ); 00173 }; 00174 //----------------------------------------------------------------------------------------- 00178 class _OgrePrivate CmdColourBottom : public ParamCommand 00179 { 00180 public: 00181 String doGet( const void* target ) const; 00182 void doSet( void* target, const String& val ); 00183 }; 00184 //----------------------------------------------------------------------------------------- 00188 class _OgrePrivate CmdColour : public ParamCommand 00189 { 00190 public: 00191 String doGet( const void* target ) const; 00192 void doSet( void* target, const String& val ); 00193 }; 00194 //----------------------------------------------------------------------------------------- 00198 class _OgrePrivate CmdAlignment : public ParamCommand 00199 { 00200 public: 00201 String doGet( const void* target ) const; 00202 void doSet( void* target, const String& val ); 00203 }; 00204 00205 protected: 00207 Alignment mAlignment; 00208 00210 bool mTransparent; 00211 00213 RenderOperation mRenderOp; 00214 00216 void addBaseParameters(void); 00217 00218 static String msTypeName; 00219 00220 // Command objects 00221 static CmdCharHeight msCmdCharHeight; 00222 static CmdSpaceWidth msCmdSpaceWidth; 00223 static CmdFontName msCmdFontName; 00224 static CmdColour msCmdColour; 00225 static CmdColourTop msCmdColourTop; 00226 static CmdColourBottom msCmdColourBottom; 00227 static CmdAlignment msCmdAlignment; 00228 00229 00230 FontPtr mFont; 00231 Real mCharHeight; 00232 ushort mPixelCharHeight; 00233 Real mSpaceWidth; 00234 ushort mPixelSpaceWidth; 00235 size_t mAllocSize; 00236 Real mViewportAspectCoef; 00237 00239 ColourValue mColourBottom; 00240 ColourValue mColourTop; 00241 bool mColoursChanged; 00242 00243 00245 void checkMemoryAllocation( size_t numChars ); 00247 virtual void updatePositionGeometry(); 00249 virtual void updateTextureGeometry(); 00251 virtual void updateColours(void); 00252 }; 00255 } 00256 00257 #endif 00258
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:28 2012