Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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 {
00036     class _OgreExport TextAreaOverlayElement : public OverlayElement
00037     {
00038     public:
00039         enum Alignment
00040         {
00041             Left,
00042             Right,
00043             Center
00044         };
00045 
00046     public:
00048         TextAreaOverlayElement(const String& name);
00049         virtual ~TextAreaOverlayElement();
00050 
00051         virtual void initialise(void);
00052         void setCaption( const String& caption );
00053         const String& getCaption() const;
00054 
00055         void setCharHeight( Real height );
00056         Real getCharHeight() const;
00057 
00058         void setSpaceWidth( Real width );
00059         Real getSpaceWidth() const;
00060 
00061         void setFontName( const String& font );
00062         const String& getFontName() const;
00063 
00065         virtual const String& getTypeName(void) const;
00067         void getRenderOperation(RenderOperation& op);
00069         void setMaterialName(const String& matName);
00070 
00077         void setColour(const ColourValue& col);
00078 
00080         const ColourValue& getColour(void) const;
00087         void setColourBottom(const ColourValue& col);
00089         const ColourValue& getColourBottom(void) const;
00096         void setColourTop(const ColourValue& col);
00098         const ColourValue& getColourTop(void) const;
00099 
00100         inline void setAlignment( Alignment a )
00101         {
00102             mAlignment = a;
00103             mGeomPositionsOutOfDate = true;
00104         }
00105         inline Alignment getAlignment() const
00106         {
00107             return mAlignment;
00108         }
00109 
00111         void setMetricsMode(GuiMetricsMode gmm);
00112 
00114         void _update(void);
00115 
00116         //-----------------------------------------------------------------------------------------
00120         class _OgrePrivate CmdCaption : public ParamCommand
00121         {
00122         public:
00123             String doGet( const void* target ) const;
00124             void doSet( void* target, const String& val );
00125         };
00126         //-----------------------------------------------------------------------------------------
00130         class _OgrePrivate CmdCharHeight : public ParamCommand
00131         {
00132         public:
00133             String doGet( const void* target ) const;
00134             void doSet( void* target, const String& val );
00135         };
00136         //-----------------------------------------------------------------------------------------
00140         class _OgrePrivate CmdSpaceWidth : public ParamCommand
00141         {
00142         public:
00143             String doGet( const void* target ) const;
00144             void doSet( void* target, const String& val );
00145         };
00146         //-----------------------------------------------------------------------------------------
00150         class _OgrePrivate CmdFontName : public ParamCommand
00151         {
00152         public:
00153             String doGet( const void* target ) const;
00154             void doSet( void* target, const String& val );
00155         };
00156         //-----------------------------------------------------------------------------------------
00160         class _OgrePrivate CmdColourTop : public ParamCommand
00161         {
00162         public:
00163             String doGet( const void* target ) const;
00164             void doSet( void* target, const String& val );
00165         };
00166         //-----------------------------------------------------------------------------------------
00170         class _OgrePrivate CmdColourBottom : public ParamCommand
00171         {
00172         public:
00173             String doGet( const void* target ) const;
00174             void doSet( void* target, const String& val );
00175         };
00176         //-----------------------------------------------------------------------------------------
00180         class _OgrePrivate CmdColour : public ParamCommand
00181         {
00182         public:
00183             String doGet( const void* target ) const;
00184             void doSet( void* target, const String& val );
00185         };
00186         //-----------------------------------------------------------------------------------------
00190         class _OgrePrivate CmdAlignment : public ParamCommand
00191         {
00192         public:
00193             String doGet( const void* target ) const;
00194             void doSet( void* target, const String& val );
00195         };
00196 
00197     protected:
00199         Alignment mAlignment;
00200 
00202         bool mTransparent;
00203 
00205         RenderOperation mRenderOp;
00206 
00208         void addBaseParameters(void);
00209 
00210         static String msTypeName;
00211 
00212         // Command objects
00213         static CmdCharHeight msCmdCharHeight;
00214         static CmdSpaceWidth msCmdSpaceWidth;
00215         static CmdFontName msCmdFontName;
00216         static CmdColour msCmdColour;
00217         static CmdColourTop msCmdColourTop;
00218         static CmdColourBottom msCmdColourBottom;
00219         static CmdAlignment msCmdAlignment;
00220 
00221 
00222         FontPtr mpFont;
00223         Real mCharHeight;
00224         ushort mPixelCharHeight;
00225         Real mSpaceWidth;
00226         ushort mPixelSpaceWidth;
00227         size_t mAllocSize;
00228         Real mViewportAspectCoef;
00229 
00231         ColourValue mColourBottom;
00232         ColourValue mColourTop;
00233         bool mColoursChanged;
00234 
00235 
00237         void checkMemoryAllocation( size_t numChars );
00239         virtual void updatePositionGeometry();
00241         virtual void updateTextureGeometry();
00243         virtual void updateColours(void);
00244     };
00245 }
00246 
00247 #endif
00248 

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 Jan 21 10:01:39 2007