Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreTextAreaGuiElement.h

Go to the documentation of this file.
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 © 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         virtual ~TextAreaGuiElement();
00068 
00069         virtual void initialise(void);
00070         void setCaption( const String& caption );
00071         const String& getCaption() const;
00072 
00073         void setCharHeight( Real height );
00074         Real getCharHeight() const;
00075 
00076         void setSpaceWidth( Real width );
00077         Real getSpaceWidth() const;
00078 
00079         void setFontName( const String& font );
00080         const String& getFontName() const;
00081 
00083         virtual const String& getTypeName(void) const;
00085         void getRenderOperation(RenderOperation& op);
00087         void setMaterialName(const String& matName);
00088 
00095         void setColour(const ColourValue& col);
00096 
00098         const ColourValue& getColour(void) const;
00105         void setColourBottom(const ColourValue& col);
00107         const ColourValue& getColourBottom(void) const;
00114         void setColourTop(const ColourValue& col);
00116         const ColourValue& getColourTop(void) const;
00117 
00118         inline void setAlignment( Alignment a )
00119         {
00120             mAlignment = a;
00121             updateGeometry();
00122         }
00123         inline Alignment getAlignment() const
00124         {
00125             return mAlignment;
00126         }
00127 
00129         void setMetricsMode(GuiMetricsMode gmm);
00130 
00132         void _update(void);
00133 
00134         //-----------------------------------------------------------------------------------------
00138         class CmdCaption : public ParamCommand
00139         {
00140         public:
00141             String doGet( const void* target ) const;
00142             void doSet( void* target, const String& val );
00143         };
00144         //-----------------------------------------------------------------------------------------
00148         class CmdCharHeight : public ParamCommand
00149         {
00150         public:
00151             String doGet( const void* target ) const;
00152             void doSet( void* target, const String& val );
00153         };
00154         //-----------------------------------------------------------------------------------------
00158         class CmdSpaceWidth : public ParamCommand
00159         {
00160         public:
00161             String doGet( const void* target ) const;
00162             void doSet( void* target, const String& val );
00163         };
00164         //-----------------------------------------------------------------------------------------
00168         class CmdFontName : public ParamCommand
00169         {
00170         public:
00171             String doGet( const void* target ) const;
00172             void doSet( void* target, const String& val );
00173         };
00174         //-----------------------------------------------------------------------------------------
00178         class CmdColourTop : public ParamCommand
00179         {
00180         public:
00181             String doGet( const void* target ) const;
00182             void doSet( void* target, const String& val );
00183         };
00184         //-----------------------------------------------------------------------------------------
00188         class CmdColourBottom : public ParamCommand
00189         {
00190         public:
00191             String doGet( const void* target ) const;
00192             void doSet( void* target, const String& val );
00193         };
00194         //-----------------------------------------------------------------------------------------
00198         class CmdColour : public ParamCommand
00199         {
00200         public:
00201             String doGet( const void* target ) const;
00202             void doSet( void* target, const String& val );
00203         };
00204         //-----------------------------------------------------------------------------------------
00208         class CmdAlignment : public ParamCommand
00209         {
00210         public:
00211             String doGet( const void* target ) const;
00212             void doSet( void* target, const String& val );
00213         };
00214 
00215     protected:
00217         Alignment mAlignment;
00218 
00220         bool mTransparent;
00221 
00223         RenderOperation mRenderOp;
00224 
00226         void addBaseParameters(void);
00227 
00228         static String msTypeName;
00229 
00230         // Command objects
00231         static CmdCharHeight msCmdCharHeight;
00232         static CmdSpaceWidth msCmdSpaceWidth;
00233         static CmdFontName msCmdFontName;
00234         static CmdColour msCmdColour;
00235         static CmdColourTop msCmdColourTop;
00236         static CmdColourBottom msCmdColourBottom;
00237         static CmdAlignment msCmdAlignment;
00238 
00239 
00240         Font *mpFont;
00241         Real mCharHeight;
00242         ushort mPixelCharHeight;
00243         Real mSpaceWidth;
00244         ushort mPixelSpaceWidth;
00245         size_t mAllocSize;
00246         Real mViewportAspectCoef;
00247 
00249         ColourValue mColourBottom;
00250         ColourValue mColourTop;
00251         bool mColoursChanged;
00252 
00253 
00255         virtual void updateGeometry();
00257         void checkMemoryAllocation( size_t numChars );
00259         virtual void updatePositionGeometry();
00261         virtual void updateColours(void);
00262     };
00263 }
00264 
00265 #endif
00266 

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:49 2004