# 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-2006 Torus Knot Software Ltd
    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         virtual void setCaption(const DisplayString& text);
    00053
    00054         void setCharHeight( Real height );
    00055         Real getCharHeight() const;
    00056
    00057         void setSpaceWidth( Real width );
    00058         Real getSpaceWidth() const;
    00059
    00060         void setFontName( const String& font );
    00061         const String& getFontName() const;
    00062
    00064         virtual const String& getTypeName(void) const;
    00066         void getRenderOperation(RenderOperation& op);
    00068         void setMaterialName(const String& matName);
    00069
    00076         void setColour(const ColourValue& col);
    00077
    00079         const ColourValue& getColour(void) const;
    00086         void setColourBottom(const ColourValue& col);
    00088         const ColourValue& getColourBottom(void) const;
    00095         void setColourTop(const ColourValue& col);
    00097         const ColourValue& getColourTop(void) const;
    00098
    00099         inline void setAlignment( Alignment a )
    00100         {
    00101             mAlignment = a;
    00102             mGeomPositionsOutOfDate = true;
    00103         }
    00104         inline Alignment getAlignment() const
    00105         {
    00106             return mAlignment;
    00107         }
    00108
    00110         void setMetricsMode(GuiMetricsMode gmm);
    00111
    00113         void _update(void);
    00114
    00115         //-----------------------------------------------------------------------------------------
    00119         class _OgrePrivate CmdCaption : public ParamCommand
    00120         {
    00121         public:
    00122             String doGet( const void* target ) const;
    00123             void doSet( void* target, const String& val );
    00124         };
    00125         //-----------------------------------------------------------------------------------------
    00129         class _OgrePrivate CmdCharHeight : public ParamCommand
    00130         {
    00131         public:
    00132             String doGet( const void* target ) const;
    00133             void doSet( void* target, const String& val );
    00134         };
    00135         //-----------------------------------------------------------------------------------------
    00139         class _OgrePrivate CmdSpaceWidth : public ParamCommand
    00140         {
    00141         public:
    00142             String doGet( const void* target ) const;
    00143             void doSet( void* target, const String& val );
    00144         };
    00145         //-----------------------------------------------------------------------------------------
    00149         class _OgrePrivate CmdFontName : public ParamCommand
    00150         {
    00151         public:
    00152             String doGet( const void* target ) const;
    00153             void doSet( void* target, const String& val );
    00154         };
    00155         //-----------------------------------------------------------------------------------------
    00159         class _OgrePrivate CmdColourTop : public ParamCommand
    00160         {
    00161         public:
    00162             String doGet( const void* target ) const;
    00163             void doSet( void* target, const String& val );
    00164         };
    00165         //-----------------------------------------------------------------------------------------
    00169         class _OgrePrivate CmdColourBottom : public ParamCommand
    00170         {
    00171         public:
    00172             String doGet( const void* target ) const;
    00173             void doSet( void* target, const String& val );
    00174         };
    00175         //-----------------------------------------------------------------------------------------
    00179         class _OgrePrivate CmdColour : public ParamCommand
    00180         {
    00181         public:
    00182             String doGet( const void* target ) const;
    00183             void doSet( void* target, const String& val );
    00184         };
    00185         //-----------------------------------------------------------------------------------------
    00189         class _OgrePrivate CmdAlignment : public ParamCommand
    00190         {
    00191         public:
    00192             String doGet( const void* target ) const;
    00193             void doSet( void* target, const String& val );
    00194         };
    00195
    00196     protected:
    00198         Alignment mAlignment;
    00199
    00201         bool mTransparent;
    00202
    00204         RenderOperation mRenderOp;
    00205
    00207         void addBaseParameters(void);
    00208
    00209         static String msTypeName;
    00210
    00211         // Command objects
    00212         static CmdCharHeight msCmdCharHeight;
    00213         static CmdSpaceWidth msCmdSpaceWidth;
    00214         static CmdFontName msCmdFontName;
    00215         static CmdColour msCmdColour;
    00216         static CmdColourTop msCmdColourTop;
    00217         static CmdColourBottom msCmdColourBottom;
    00218         static CmdAlignment msCmdAlignment;
    00219
    00220
    00221         FontPtr mpFont;
    00222         Real mCharHeight;
    00223         ushort mPixelCharHeight;
    00224         Real mSpaceWidth;
    00225         ushort mPixelSpaceWidth;
    00226         size_t mAllocSize;
    00227         Real mViewportAspectCoef;
    00228
    00230         ColourValue mColourBottom;
    00231         ColourValue mColourTop;
    00232         bool mColoursChanged;
    00233
    00234
    00236         void checkMemoryAllocation( size_t numChars );
    00238         virtual void updatePositionGeometry();
    00240         virtual void updateTextureGeometry();
    00242         virtual void updateColours(void);
    00243     };
    00244 }
    00245
    00246 #endif
    00247

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:32:20 2009