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

OgreListGuiElement.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://www.ogre3d.org/
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 __ListGuiElement_H__
00026 #define __ListGuiElement_H__
00027 
00028 #include "OgreGuiElementPrerequisites.h"
00029 #include "OgreListSelectionTarget.h"
00030 #include "OgreBorderPanelGuiElement.h"
00031 #include "OgreListChanger.h"
00032 #include "OgreScrollBarGuiElement.h"
00033 #include "OgreEventListeners.h"
00034 
00035 namespace Ogre {
00036 
00037 
00038     
00059     class _OgreGuiElementExport ListGuiElement : public PanelGuiElement, public ListSelectionTarget, public ListChanger, public ScrollListener, public MouseListener, public MouseMotionListener
00060     {
00061     public :
00062 
00063         ListGuiElement(const String& name);
00064         ~ListGuiElement();
00065 
00067         class CmdItemTemplate : public ParamCommand
00068         {
00069         public:
00070             String doGet(const void* target) const;
00071             void doSet(void* target, const String& val);
00072         };
00074         class CmdVSpacing : public ParamCommand
00075         {
00076         public:
00077             String doGet(const void* target) const;
00078             void doSet(void* target, const String& val);
00079         };
00081         class CmdHSpacing : public ParamCommand
00082         {
00083         public:
00084             String doGet(const void* target) const;
00085             void doSet(void* target, const String& val);
00086         };
00088         class CmdItemPanelMaterial : public ParamCommand
00089         {
00090         public:
00091             String doGet(const void* target) const;
00092             void doSet(void* target, const String& val);
00093         };
00094 
00096         class CmdItemPanelMaterialSelected : public ParamCommand
00097         {
00098         public:
00099             String doGet(const void* target) const;
00100             void doSet(void* target, const String& val);
00101         };
00102 
00104         class CmdScrollBar : public ParamCommand
00105         {
00106         public:
00107             String doGet(const void* target) const;
00108             void doSet(void* target, const String& val);
00109         };
00110 
00111 
00112 
00113         virtual void setItemTemplateName(const String& val);
00114         virtual void addListItem(Resource* r);
00115         virtual void removeListItem(Resource* r);
00116         virtual String getItemTemplateName() const;
00117         virtual Real getVSpacing() const;
00118         virtual Real getHSpacing() const;
00119         virtual void setVSpacing(Real val);
00120         virtual void setHSpacing(Real val);
00121 
00122         void mouseClicked(MouseEvent* e) {};
00123         void mouseEntered(MouseEvent* e)  {};
00124         void mouseExited(MouseEvent* e)  {};
00125         void mousePressed(MouseEvent* e) ;
00126         void mouseReleased(MouseEvent* e) {};
00127         void mouseDragged(MouseEvent* e) ;
00128         void mouseMoved(MouseEvent* e) ;
00129         void setSelectedIndex(size_t index);
00130 
00131         virtual String getItemPanelMaterial() const;
00132         virtual String getItemPanelMaterialSelected() const;
00133         virtual void setItemPanelMaterial(const String& val);
00134         virtual void setItemPanelMaterialSelected(const String& val);
00135 
00136         virtual void setScrollBarName(const String& val);
00137         virtual String getScrollBarName() const;
00138 
00139         void scrollPerformed(ScrollEvent* se);
00140 
00141         virtual void setSelectedItem(Resource* r, bool on);
00142         virtual void setSelectedItem(Resource* r);
00143 
00144 
00145         virtual Resource* getSelectedItem();
00146         virtual int getSelectedIndex() const;
00147 
00148         virtual ResourceListConstIterator getConstIterator() const;
00149         virtual ResourceListConstIterator getConstEndIterator() const;
00150 
00151         virtual Resource* popFront() ;
00152         virtual size_t getListSize() const;
00153 
00155         const String& getTypeName(void) const;
00156 
00157 
00158     protected:
00159         virtual void setSelectedItem(GuiElement* item, bool on);
00160         virtual void setSelectedItem(GuiElement* item);
00161 
00162         void addBaseParameters(void);
00163         String getListItemName(Resource* r) const;
00164         String getListItemPanelName(Resource* r) const;
00165 
00166         static CmdItemTemplate msCmdItemTemplate;
00167         static CmdVSpacing msCmdVSpacing;
00168         static CmdScrollBar msCmdScrollBar;
00169         static CmdHSpacing msCmdHSpacing;
00170         static CmdItemPanelMaterial msCmdItemPanelMaterial;
00171         static CmdItemPanelMaterialSelected msCmdItemPanelMaterialSelected;
00172         static String msTypeName;
00173 
00174         virtual void layoutItems();
00175         size_t mFirstVisibleItem, mVisibleRange;
00176         Real mVSpacing;
00177         Real mHSpacing;
00178 
00179         ushort mPixelVSpacing;
00180         ushort mPixelHSpacing;
00181         String mItemTemplateName;
00182         String mItemPanelMaterial;
00183         String mItemPanelMaterialSelected;
00184         ScrollBarGuiElement* mScrollBar;
00185 
00186         ResourceList mResourceList; 
00187 
00188         GuiElement* mSelectedElement;
00189     };
00190 
00191 }
00192 
00193 
00194 #endif  // __ListGuiElement_H__
00195 

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:31 2004