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

OgreTextAreaOverlayElement.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 (c) 2000-2005 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 _TextAreaOverlayElement_H__
00027 #define _TextAreaOverlayElement_H__
00028 
00029 #include "OgreOverlayElement.h"
00030 #include "OgreFont.h"
00031 
00032 namespace Ogre
00033 {
00049     class _OgreExport TextAreaOverlayElement : public OverlayElement
00050     {
00051     public:
00052         enum Alignment
00053         {
00054             Left,
00055             Right,
00056             Center
00057         };
00058 
00059     public:
00061         TextAreaOverlayElement(const String& name);
00062         virtual ~TextAreaOverlayElement();
00063 
00064         virtual void initialise(void);
00065         void setCaption( const String& caption );
00066         const String& getCaption() const;
00067 
00068         void setCharHeight( Real height );
00069         Real getCharHeight() const;
00070 
00071         void setSpaceWidth( Real width );
00072         Real getSpaceWidth() const;
00073 
00074         void setFontName( const String& font );
00075         const String& getFontName() const;
00076 
00078         virtual const String& getTypeName(void) const;
00080         void getRenderOperation(RenderOperation& op);
00082         void setMaterialName(const String& matName);
00083 
00090         void setColour(const ColourValue& col);
00091 
00093         const ColourValue& getColour(void) const;
00100         void setColourBottom(const ColourValue& col);
00102         const ColourValue& getColourBottom(void) const;
00109         void setColourTop(const ColourValue& col);
00111         const ColourValue& getColourTop(void) const;
00112 
00113         inline void setAlignment( Alignment a )
00114         {
00115             mAlignment = a;
00116             mGeomPositionsOutOfDate = true;
00117         }
00118         inline Alignment getAlignment() const
00119         {
00120             return mAlignment;
00121         }
00122 
00124         void setMetricsMode(GuiMetricsMode gmm);
00125 
00127         void _update(void);
00128 
00129         //-----------------------------------------------------------------------------------------
00133         class _OgrePrivate CmdCaption : public ParamCommand
00134         {
00135         public:
00136             String doGet( const void* target ) const;
00137             void doSet( void* target, const String& val );
00138         };
00139         //-----------------------------------------------------------------------------------------
00143         class _OgrePrivate CmdCharHeight : public ParamCommand
00144         {
00145         public:
00146             String doGet( const void* target ) const;
00147             void doSet( void* target, const String& val );
00148         };
00149         //-----------------------------------------------------------------------------------------
00153         class _OgrePrivate CmdSpaceWidth : public ParamCommand
00154         {
00155         public:
00156             String doGet( const void* target ) const;
00157             void doSet( void* target, const String& val );
00158         };
00159         //-----------------------------------------------------------------------------------------
00163         class _OgrePrivate CmdFontName : public ParamCommand
00164         {
00165         public:
00166             String doGet( const void* target ) const;
00167             void doSet( void* target, const String& val );
00168         };
00169         //-----------------------------------------------------------------------------------------
00173         class _OgrePrivate CmdColourTop : public ParamCommand
00174         {
00175         public:
00176             String doGet( const void* target ) const;
00177             void doSet( void* target, const String& val );
00178         };
00179         //-----------------------------------------------------------------------------------------
00183         class _OgrePrivate CmdColourBottom : public ParamCommand
00184         {
00185         public:
00186             String doGet( const void* target ) const;
00187             void doSet( void* target, const String& val );
00188         };
00189         //-----------------------------------------------------------------------------------------
00193         class _OgrePrivate CmdColour : public ParamCommand
00194         {
00195         public:
00196             String doGet( const void* target ) const;
00197             void doSet( void* target, const String& val );
00198         };
00199         //-----------------------------------------------------------------------------------------
00203         class _OgrePrivate CmdAlignment : public ParamCommand
00204         {
00205         public:
00206             String doGet( const void* target ) const;
00207             void doSet( void* target, const String& val );
00208         };
00209 
00210     protected:
00212         Alignment mAlignment;
00213 
00215         bool mTransparent;
00216 
00218         RenderOperation mRenderOp;
00219 
00221         void addBaseParameters(void);
00222 
00223         static String msTypeName;
00224 
00225         // Command objects
00226         static CmdCharHeight msCmdCharHeight;
00227         static CmdSpaceWidth msCmdSpaceWidth;
00228         static CmdFontName msCmdFontName;
00229         static CmdColour msCmdColour;
00230         static CmdColourTop msCmdColourTop;
00231         static CmdColourBottom msCmdColourBottom;
00232         static CmdAlignment msCmdAlignment;
00233 
00234 
00235         FontPtr mpFont;
00236         Real mCharHeight;
00237         ushort mPixelCharHeight;
00238         Real mSpaceWidth;
00239         ushort mPixelSpaceWidth;
00240         size_t mAllocSize;
00241         Real mViewportAspectCoef;
00242 
00244         ColourValue mColourBottom;
00245         ColourValue mColourTop;
00246         bool mColoursChanged;
00247 
00248 
00250         void checkMemoryAllocation( size_t numChars );
00252         virtual void updatePositionGeometry();
00254         virtual void updateTextureGeometry();
00256         virtual void updateColours(void);
00257     };
00258 }
00259 
00260 #endif
00261 

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:51 2006