00001 /*------------------------------------------------------------------------- 00002 This source file is a part of OGRE 00003 (Object-oriented Graphics Rendering Engine) 00004 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This library is free software; you can redistribute it and/or modify it 00011 under the terms of the GNU Lesser General Public License (LGPL) as 00012 published by the Free Software Foundation; either version 2.1 of the 00013 License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, but 00016 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00017 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00018 License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with this library; if not, write to the Free Software Foundation, 00022 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or go to 00023 http://www.gnu.org/copyleft/lesser.txt 00024 -------------------------------------------------------------------------*/ 00025 00026 #ifndef _TextAreaGuiElement_H__ 00027 #define _TextAreaGuiElement_H__ 00028 00029 #include "OgreGuiElementPrerequisites.h" 00030 #include "OgreGuiContainer.h" 00031 #include "OgreMaterial.h" 00032 #include "OgreStringConverter.h" 00033 #include "OgreGuiElementFactory.h" 00034 #include "OgreFont.h" 00035 #include "OgreFontManager.h" 00036 00037 namespace Ogre 00038 { 00054 class _OgreGuiElementExport TextAreaGuiElement : public GuiElement 00055 { 00056 public: 00057 enum Alignment 00058 { 00059 Left, 00060 Right, 00061 Center 00062 }; 00063 00064 public: 00066 TextAreaGuiElement(const String& name); 00067 ~TextAreaGuiElement(); 00068 00069 void setCaption( const String& caption ); 00070 const String& getCaption() const; 00071 00072 void setCharHeight( Real height ); 00073 Real getCharHeight() const; 00074 00075 void setFontName( const String& font ); 00076 const String& getFontName() const; 00077 00079 const String& getTypeName(void); 00081 void getRenderOperation(RenderOperation& rend); 00083 void setMaterialName(const String& matName); 00084 00091 void setColour(const ColourValue& col); 00092 00094 ColourValue getColour(void) const; 00101 void setColourBottom(const ColourValue& col); 00103 ColourValue getColourBottom(void); 00110 void setColourTop(const ColourValue& col); 00112 ColourValue getColourTop(void); 00113 00114 inline void setAlignment( Alignment a ) 00115 { 00116 mAlignment = a; 00117 updateGeometry(); 00118 } 00119 inline Alignment getAlignment() const 00120 { 00121 return mAlignment; 00122 } 00123 00125 void setMetricsMode(GuiMetricsMode gmm); 00126 00128 void _update(void); 00129 00130 //----------------------------------------------------------------------------------------- 00134 class CmdCaption : public ParamCommand 00135 { 00136 public: 00137 String doGet( void* target ); 00138 void doSet( void* target, const String& val ); 00139 }; 00140 //----------------------------------------------------------------------------------------- 00144 class CmdCharHeight : public ParamCommand 00145 { 00146 public: 00147 String doGet( void* target); 00148 void doSet( void* target, const String& val ); 00149 }; 00150 //----------------------------------------------------------------------------------------- 00154 class CmdFontName : public ParamCommand 00155 { 00156 public: 00157 String doGet( void* target ); 00158 void doSet( void* target, const String& val ); 00159 }; 00160 //----------------------------------------------------------------------------------------- 00164 class CmdColourTop : public ParamCommand 00165 { 00166 public: 00167 String doGet( void* target ); 00168 void doSet( void* target, const String& val ); 00169 }; 00170 //----------------------------------------------------------------------------------------- 00174 class CmdColourBottom : public ParamCommand 00175 { 00176 public: 00177 String doGet( void* target ); 00178 void doSet( void* target, const String& val ); 00179 }; 00180 //----------------------------------------------------------------------------------------- 00184 class CmdColour : public ParamCommand 00185 { 00186 public: 00187 String doGet( void* target ); 00188 void doSet( void* target, const String& val ); 00189 }; 00190 00191 protected: 00193 Alignment mAlignment; 00194 00196 bool mTransparent; 00197 00199 RenderOperation mRenderOp; 00200 00202 void addBaseParameters(void); 00203 00204 static String msTypeName; 00205 00206 // Command objects 00207 static CmdCharHeight msCmdCharHeight; 00208 static CmdFontName msCmdFontName; 00209 static CmdColour msCmdColour; 00210 static CmdColourTop msCmdColourTop; 00211 static CmdColourBottom msCmdColourBottom; 00212 00213 00214 Font *mpFont; 00215 Real mCharHeight; 00216 ushort mPixelCharHeight; 00217 uint mAllocSize; 00218 00220 ColourValue mColourBottom; 00221 ColourValue mColourTop; 00222 00223 00225 void updateGeometry(); 00227 void checkMemoryAllocation( uint numChars ); 00229 virtual void updatePositionGeometry(); 00231 virtual void updateColours(void); 00232 }; 00233 } 00234 00235 #endif
Copyright © 2002 by The OGRE Team