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

OgreBorderPanelGuiElement.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
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 program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 
00026 #ifndef __BorderPanelGuiElement_H__
00027 #define __BorderPanelGuiElement_H__
00028 
00029 #include "OgreGuiElementPrerequisites.h"
00030 #include "OgrePanelGuiElement.h"
00031 
00032 namespace Ogre {
00033 
00034 
00035     
00049     class _OgreGuiElementExport BorderPanelGuiElement : public PanelGuiElement
00050     {
00051         friend class BorderRenderable;
00052     public:
00054         BorderPanelGuiElement(const String& name);
00055         ~BorderPanelGuiElement();
00056 
00068         void setBorderSize(Real size);
00069 
00081         void setBorderSize(Real sides, Real topAndBottom);
00082 
00096         void setBorderSize(Real left, Real right, Real top, Real bottom);
00097 
00099         Real getLeftBorderSize(void);
00101         Real getRightBorderSize(void);
00103         Real getTopBorderSize(void);
00105         Real getBottomBorderSize(void);
00106 
00117         void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
00121         void setRightBorderUV(Real u1, Real v1, Real u2, Real v2);
00125         void setTopBorderUV(Real u1, Real v1, Real u2, Real v2);
00129         void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2);
00133         void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
00137         void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2);
00141         void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
00145         void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2);
00146 
00147         String getLeftBorderUVString();
00148         String getRightBorderUVString();
00149         String getTopBorderUVString();
00150         String getBottomBorderUVString();
00151         String getTopLeftBorderUVString();
00152         String getTopRightBorderUVString();
00153         String getBottomLeftBorderUVString();
00154         String getBottomRightBorderUVString();
00155 
00156 
00157 
00158 
00160         void setBorderMaterialName(const String& name);
00162         const String& getBorderMaterialName(void);
00163 
00165         void _updateRenderQueue(RenderQueue* queue);
00166 
00168         void setMetricsMode(GuiMetricsMode gmm);
00169 
00171         void _update(void);
00172 
00173 
00175         class CmdBorderSize : public ParamCommand
00176         {
00177         public:
00178             String doGet(void* target);
00179             void doSet(void* target, const String& val);
00180         };
00182         class CmdBorderMaterial : public ParamCommand
00183         {
00184         public:
00185             String doGet(void* target);
00186             void doSet(void* target, const String& val);
00187         };
00189         class CmdBorderLeftUV : public ParamCommand
00190         {
00191         public:
00192             String doGet(void* target);
00193             void doSet(void* target, const String& val);
00194         };
00196         class CmdBorderTopUV : public ParamCommand
00197         {
00198         public:
00199             String doGet(void* target);
00200             void doSet(void* target, const String& val);
00201         };
00203         class CmdBorderRightUV : public ParamCommand
00204         {
00205         public:
00206             String doGet(void* target);
00207             void doSet(void* target, const String& val);
00208         };
00210         class CmdBorderBottomUV : public ParamCommand
00211         {
00212         public:
00213             String doGet(void* target);
00214             void doSet(void* target, const String& val);
00215         };
00217         class CmdBorderTopLeftUV : public ParamCommand
00218         {
00219         public:
00220             String doGet(void* target);
00221             void doSet(void* target, const String& val);
00222         };
00224         class CmdBorderBottomLeftUV : public ParamCommand
00225         {
00226         public:
00227             String doGet(void* target);
00228             void doSet(void* target, const String& val);
00229         };
00231         class CmdBorderBottomRightUV : public ParamCommand
00232         {
00233         public:
00234             String doGet(void* target);
00235             void doSet(void* target, const String& val);
00236         };
00238         class CmdBorderTopRightUV : public ParamCommand
00239         {
00240         public:
00241             String doGet(void* target);
00242             void doSet(void* target, const String& val);
00243         };
00244     protected:
00245         Real mLeftBorderSize;
00246         Real mRightBorderSize;
00247         Real mTopBorderSize;
00248         Real mBottomBorderSize;
00249 
00250         ushort mPixelLeftBorderSize;
00251         ushort mPixelRightBorderSize;
00252         ushort mPixelTopBorderSize;
00253         ushort mPixelBottomBorderSize;
00254 
00255         String mBorderMaterialName;
00256         Material* mpBorderMaterial;
00257 
00258         // Render operation for the border area
00259         RenderOperation mRenderOp2;
00260 
00261         static String msTypeName;
00262 
00264         void updatePositionGeometry(void);
00265 
00267         void addBaseParameters(void);
00268 
00269         enum BorderCellIndex {
00270             BCELL_TOP_LEFT = 0,
00271             BCELL_TOP = 1,
00272             BCELL_TOP_RIGHT = 2,
00273             BCELL_LEFT = 3,
00274             BCELL_RIGHT = 4,
00275             BCELL_BOTTOM_LEFT = 5,
00276             BCELL_BOTTOM = 6,
00277             BCELL_BOTTOM_RIGHT = 7
00278         };
00280         void setCellUV(BorderCellIndex idx, Real& u1, Real& v1, Real& u2, Real& v2);
00281         String getCellUVString(BorderCellIndex idx);
00282 
00283         // Command objects
00284         static CmdBorderSize msCmdBorderSize;
00285         static CmdBorderMaterial msCmdBorderMaterial;
00286         static CmdBorderLeftUV msCmdBorderLeftUV;
00287         static CmdBorderTopUV msCmdBorderTopUV;
00288         static CmdBorderBottomUV msCmdBorderBottomUV;
00289         static CmdBorderRightUV msCmdBorderRightUV;
00290         static CmdBorderTopLeftUV msCmdBorderTopLeftUV;
00291         static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV;
00292         static CmdBorderTopRightUV msCmdBorderTopRightUV;
00293         static CmdBorderBottomRightUV msCmdBorderBottomRightUV;
00294 
00295     protected:
00296         BorderRenderable* mBorderRenderable;
00297 
00298     };
00299 
00305     class _OgreGuiElementExport BorderRenderable : public Renderable
00306     {
00307     protected:
00308         BorderPanelGuiElement* mParent;
00309     public:
00311         BorderRenderable(BorderPanelGuiElement* parent) : mParent(parent) {}
00312         Material* getMaterial(void) const { return mParent->mpBorderMaterial; }
00313         void getRenderOperation(RenderOperation& rend) { rend = mParent->mRenderOp2; }
00314         void getWorldTransforms(Matrix4* xform) { mParent->getWorldTransforms(xform); }
00315         unsigned short getNumWorldTransforms(void) { return 1; }
00316         bool useIdentityProjection(void) { return true; }
00317         bool useIdentityView(void) { return true; }
00318         Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
00319     };
00320 
00321 }
00322 
00323 #endif

Copyright © 2002 by The OGRE Team