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

OgreButtonGuiElement.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 #ifndef __ButtonGuiElement_H__
00026 #define __ButtonGuiElement_H__
00027 
00028 #include "OgreGuiElementPrerequisites.h"
00029 #include "OgreActionTarget.h"
00030 #include "OgreBorderPanelGuiElement.h"
00031 
00032 namespace Ogre {
00033 
00034     
00054     class _OgreGuiElementExport ButtonGuiElement : public BorderPanelGuiElement, public ActionTarget
00055     {
00056     protected:
00057         String mActionCommand;
00058         bool mPressed;
00059         void fireActionPerformed();
00060         String mBorderDownMaterialName,mBorderUpMaterialName;
00061         void changeChild(GuiElement* e, Real add);
00062         static String msTypeName;
00063         GuiElement* mInsideObject;
00064     public :
00065         void addBaseParameters(void);
00066 
00067         ButtonGuiElement(const String& name);
00068         void processEvent(InputEvent* e) ;
00069 
00070         void setPressed(bool b, bool init = false);
00071         String getActionCommand();
00072         bool isPressed();
00073         GuiElement* findElementAt(Real x, Real y);
00074 
00075 
00077         void setBorderDownMaterialName(const String& name);
00079         const String& getBorderDownMaterialName(void);
00080 
00082         void setBorderUpMaterialName(const String& name);
00084         const String& getBorderUpMaterialName(void);
00085 
00086         void setButtonCaption(const String& templateName, const String& name);
00087         String getButtonCaption();
00088 
00090         class CmdBorderDownMaterial : public ParamCommand
00091         {
00092         public:
00093             String doGet(void* target);
00094             void doSet(void* target, const String& val);
00095         };
00096 
00098         class CmdBorderUpMaterial : public ParamCommand
00099         {
00100         public:
00101             String doGet(void* target);
00102             void doSet(void* target, const String& val);
00103         };
00105         class CmdButtonCaption : public ParamCommand
00106         {
00107         public:
00108             String doGet(void* target);
00109             void doSet(void* target, const String& val);
00110         };
00111         static CmdBorderDownMaterial msCmdBorderDownMaterial;
00112         static CmdBorderUpMaterial msCmdBorderUpMaterial;
00113         static CmdButtonCaption msCmdButtonCaption;
00114 
00115     };
00116 
00117 }
00118 
00119 
00120 #endif  // __ButtonGuiElement_H__

Copyright © 2002 by The OGRE Team