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-2009 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 void getRenderOperation(RenderOperation& op); 00075 void setMaterialName(const String& matName); 00076 00083 void setColour(const ColourValue& col); 00084 00086 const ColourValue& getColour(void) const; 00093 void setColourBottom(const ColourValue& col); 00095 const ColourValue& getColourBottom(void) const; 00102 void setColourTop(const ColourValue& col); 00104 const ColourValue& getColourTop(void) const; 00105 00106 inline void setAlignment( Alignment a ) 00107 { 00108 mAlignment = a; 00109 mGeomPositionsOutOfDate = true; 00110 } 00111 inline Alignment getAlignment() const 00112 { 00113 return mAlignment; 00114 } 00115 00117 void setMetricsMode(GuiMetricsMode gmm); 00118 00120 void _update(void); 00121 00122 //----------------------------------------------------------------------------------------- 00126 class _OgrePrivate CmdCaption : public ParamCommand 00127 { 00128 public: 00129 String doGet( const void* target ) const; 00130 void doSet( void* target, const String& val ); 00131 }; 00132 //----------------------------------------------------------------------------------------- 00136 class _OgrePrivate CmdCharHeight : public ParamCommand 00137 { 00138 public: 00139 String doGet( const void* target ) const; 00140 void doSet( void* target, const String& val ); 00141 }; 00142 //----------------------------------------------------------------------------------------- 00146 class _OgrePrivate CmdSpaceWidth : public ParamCommand 00147 { 00148 public: 00149 String doGet( const void* target ) const; 00150 void doSet( void* target, const String& val ); 00151 }; 00152 //----------------------------------------------------------------------------------------- 00156 class _OgrePrivate CmdFontName : public ParamCommand 00157 { 00158 public: 00159 String doGet( const void* target ) const; 00160 void doSet( void* target, const String& val ); 00161 }; 00162 //----------------------------------------------------------------------------------------- 00166 class _OgrePrivate CmdColourTop : public ParamCommand 00167 { 00168 public: 00169 String doGet( const void* target ) const; 00170 void doSet( void* target, const String& val ); 00171 }; 00172 //----------------------------------------------------------------------------------------- 00176 class _OgrePrivate CmdColourBottom : public ParamCommand 00177 { 00178 public: 00179 String doGet( const void* target ) const; 00180 void doSet( void* target, const String& val ); 00181 }; 00182 //----------------------------------------------------------------------------------------- 00186 class _OgrePrivate CmdColour : public ParamCommand 00187 { 00188 public: 00189 String doGet( const void* target ) const; 00190 void doSet( void* target, const String& val ); 00191 }; 00192 //----------------------------------------------------------------------------------------- 00196 class _OgrePrivate CmdAlignment : public ParamCommand 00197 { 00198 public: 00199 String doGet( const void* target ) const; 00200 void doSet( void* target, const String& val ); 00201 }; 00202 00203 protected: 00205 Alignment mAlignment; 00206 00208 bool mTransparent; 00209 00211 RenderOperation mRenderOp; 00212 00214 void addBaseParameters(void); 00215 00216 static String msTypeName; 00217 00218 // Command objects 00219 static CmdCharHeight msCmdCharHeight; 00220 static CmdSpaceWidth msCmdSpaceWidth; 00221 static CmdFontName msCmdFontName; 00222 static CmdColour msCmdColour; 00223 static CmdColourTop msCmdColourTop; 00224 static CmdColourBottom msCmdColourBottom; 00225 static CmdAlignment msCmdAlignment; 00226 00227 00228 FontPtr mpFont; 00229 Real mCharHeight; 00230 ushort mPixelCharHeight; 00231 Real mSpaceWidth; 00232 ushort mPixelSpaceWidth; 00233 size_t mAllocSize; 00234 Real mViewportAspectCoef; 00235 00237 ColourValue mColourBottom; 00238 ColourValue mColourTop; 00239 bool mColoursChanged; 00240 00241 00243 void checkMemoryAllocation( size_t numChars ); 00245 virtual void updatePositionGeometry(); 00247 virtual void updateTextureGeometry(); 00249 virtual void updateColours(void); 00250 }; 00253 } 00254 00255 #endif 00256
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 28 21:10:44 2010