CEGUIItemEntry.h

00001 /***********************************************************************
00002         filename:       CEGUIItemEntry.h
00003         created:        31/3/2005
00004         author:         Tomas Lindquist Olsen (based on code by Paul D Turner)
00005         
00006         purpose:        Interface to base class for ItemEntry widget
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIItemEntry_h_
00031 #define _CEGUIItemEntry_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIWindow.h"
00035 #include "elements/CEGUIItemEntryProperties.h"
00036 
00037 #if defined(_MSC_VER)
00038 #       pragma warning(push)
00039 #       pragma warning(disable : 4251)
00040 #endif
00041 
00042 // Start of CEGUI namespace section
00043 namespace CEGUI
00044 {
00045 
00050 class CEGUIEXPORT ItemEntryWindowRenderer : public WindowRenderer
00051 {
00052 public:
00057     ItemEntryWindowRenderer(const String& name);
00058 
00067     virtual Size getItemPixelSize(void) const = 0;
00068 };
00069 
00078 class CEGUIEXPORT ItemEntry : public Window
00079 {
00080 public:
00081     /*************************************************************************
00082         Constants
00083     *************************************************************************/
00084     static const String WidgetTypeName;             
00085     static const String EventSelectionChanged;    
00086 
00087         /*************************************************************************
00088                 Accessors
00089         *************************************************************************/
00098         Size getItemPixelSize(void) const;
00099 
00105     ItemListBase* getOwnerList(void) const  {return d_ownerList;}
00106 
00111     bool isSelected(void) const             {return d_selected;}
00112 
00117     bool isSelectable(void) const           {return d_selectable;}
00118 
00119     /*************************************************************************
00120                 Set methods
00121         *************************************************************************/
00131     void setSelected(bool setting)  {setSelected_impl(setting, true);}
00132     
00137     void select(void)               {setSelected_impl(true, true);}
00138 
00143     void deselect(void)             {setSelected_impl(false, true);}
00144 
00150     void setSelected_impl(bool state, bool notify);
00151 
00165     void setSelectable(bool setting);
00166 
00167         /*************************************************************************
00168                 Construction and Destruction
00169         *************************************************************************/
00174         ItemEntry(const String& type, const String& name);
00175 
00180         virtual ~ItemEntry(void) {}
00181 
00182 protected:
00183     /*************************************************************************
00184         Abstract Implementation Functions
00185     *************************************************************************/
00194     //virtual Size getItemPixelSize_impl(void) const = 0;
00195 
00196         /*************************************************************************
00197                 Implementation Functions
00198         *************************************************************************/
00210         virtual bool testClassName_impl(const String& class_name) const
00211         {
00212                 if (class_name=="ItemEntry")    return true;
00213                 return Window::testClassName_impl(class_name);
00214         }
00215 
00216     // validate window renderer
00217     virtual bool validateWindowRenderer(const String& name) const
00218     {
00219         return (name == "ItemEntry");
00220     }
00221 
00222     /*************************************************************************
00223         New Event Handlers
00224     *************************************************************************/
00229     virtual void onSelectionChanged(WindowEventArgs& e);
00230 
00231     /*************************************************************************
00232                 Overridden Event Handlers
00233         *************************************************************************/
00234         virtual void onMouseClicked(MouseEventArgs& e);
00235 
00236     /*************************************************************************
00237         Implementation Data
00238     *************************************************************************/
00239     
00241     ItemListBase* d_ownerList;
00242     
00244     bool d_selected;
00245 
00247     bool d_selectable;
00248     
00249     // make the ItemListBase a friend
00250     friend class ItemListBase;
00251 
00252 private:
00253     /************************************************************************
00254         Static Properties for this class
00255     ************************************************************************/
00256     static ItemEntryProperties::Selectable d_selectableProperty;
00257     static ItemEntryProperties::Selected d_selectedProperty;
00258     
00259     void addItemEntryProperties(void);
00260 };
00261 
00262 } // End of  CEGUI namespace section
00263 
00264 #if defined(_MSC_VER)
00265 #       pragma warning(pop)
00266 #endif
00267 
00268 #endif  // end of guard _CEGUIItemEntry_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4