Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIItemEntry.h
1 /***********************************************************************
2  filename: CEGUIItemEntry.h
3  created: 31/3/2005
4  author: Tomas Lindquist Olsen (based on code by Paul D Turner)
5 
6  purpose: Interface to base class for ItemEntry widget
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIItemEntry_h_
31 #define _CEGUIItemEntry_h_
32 
33 #include "../CEGUIBase.h"
34 #include "../CEGUIWindow.h"
35 #include "CEGUIItemEntryProperties.h"
36 
37 #if defined(_MSC_VER)
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
40 #endif
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
45 
50 class CEGUIEXPORT ItemEntryWindowRenderer : public WindowRenderer
51 {
52 public:
57  ItemEntryWindowRenderer(const String& name);
58 
67  virtual Size getItemPixelSize(void) const = 0;
68 };
69 
78 class CEGUIEXPORT ItemEntry : public Window
79 {
80 public:
81  /*************************************************************************
82  Constants
83  *************************************************************************/
84  static const String WidgetTypeName;
85 
91 
92  /*************************************************************************
93  Accessors
94  *************************************************************************/
103  Size getItemPixelSize(void) const;
104 
110  ItemListBase* getOwnerList(void) const {return d_ownerList;}
111 
116  bool isSelected(void) const {return d_selected;}
117 
122  bool isSelectable(void) const {return d_selectable;}
123 
124  /*************************************************************************
125  Set methods
126  *************************************************************************/
136  void setSelected(bool setting) {setSelected_impl(setting, true);}
137 
142  void select(void) {setSelected_impl(true, true);}
143 
148  void deselect(void) {setSelected_impl(false, true);}
149 
155  void setSelected_impl(bool state, bool notify);
156 
170  void setSelectable(bool setting);
171 
172  /*************************************************************************
173  Construction and Destruction
174  *************************************************************************/
179  ItemEntry(const String& type, const String& name);
180 
185  virtual ~ItemEntry(void) {}
186 
187 protected:
188  /*************************************************************************
189  Abstract Implementation Functions
190  *************************************************************************/
199  //virtual Size getItemPixelSize_impl(void) const = 0;
200 
201  /*************************************************************************
202  Implementation Functions
203  *************************************************************************/
215  virtual bool testClassName_impl(const String& class_name) const
216  {
217  if (class_name=="ItemEntry") return true;
218  return Window::testClassName_impl(class_name);
219  }
220 
221  // validate window renderer
222  virtual bool validateWindowRenderer(const String& name) const
223  {
224  return (name == "ItemEntry");
225  }
226 
227  /*************************************************************************
228  New Event Handlers
229  *************************************************************************/
234  virtual void onSelectionChanged(WindowEventArgs& e);
235 
236  /*************************************************************************
237  Overridden Event Handlers
238  *************************************************************************/
239  virtual void onMouseClicked(MouseEventArgs& e);
240 
241  /*************************************************************************
242  Implementation Data
243  *************************************************************************/
244 
247 
250 
252  bool d_selectable;
253 
254  // make the ItemListBase a friend
255  friend class ItemListBase;
256 
257 private:
258  /************************************************************************
259  Static Properties for this class
260  ************************************************************************/
261  static ItemEntryProperties::Selectable d_selectableProperty;
262  static ItemEntryProperties::Selected d_selectedProperty;
263 
264  void addItemEntryProperties(void);
265 };
266 
267 } // End of CEGUI namespace section
268 
269 #if defined(_MSC_VER)
270 # pragma warning(pop)
271 #endif
272 
273 #endif // end of guard _CEGUIItemEntry_h_
bool isSelectable(void) const
Returns whether this item is selectable or not.
Definition: CEGUIItemEntry.h:122
void deselect(void)
Deselects the item.
Definition: CEGUIItemEntry.h:148
bool d_selected
'true' when the item is selectable.
Definition: CEGUIItemEntry.h:249
void setSelected(bool setting)
Sets the selection state of this item (on/off). If this item is not selectable this function does not...
Definition: CEGUIItemEntry.h:136
Base class for item type widgets.
Definition: CEGUIItemEntry.h:78
bool isSelected(void) const
Returns whether this item is selected or not.
Definition: CEGUIItemEntry.h:116
void select(void)
Selects the item.
Definition: CEGUIItemEntry.h:142
Class that holds the size (width & height) of something.
Definition: CEGUISize.h:43
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIWindow.h:3928
ItemListBase * d_ownerList
< pointer to the owner ItemListBase. 0 if there is none.
Definition: CEGUIItemEntry.h:246
Base-class for the assignable WindowRenderer object.
Definition: CEGUIWindowRenderer.h:51
Base class for ItemEntry window renderer objects.
Definition: CEGUIItemEntry.h:50
Property to access the state of the selectable setting.
Definition: CEGUIItemEntryProperties.h:55
ItemListBase * getOwnerList(void) const
Returns a pointer to the owner ItemListBase. 0 if there is none.
Definition: CEGUIItemEntry.h:110
virtual bool validateWindowRenderer(const String &name) const
Function used in checking if a WindowRenderer is valid for this window.
Definition: CEGUIItemEntry.h:222
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: CEGUIWindow.h:138
static const String WidgetTypeName
Window factory name.
Definition: CEGUIItemEntry.h:84
virtual ~ItemEntry(void)
Destructor for ItemEntry objects.
Definition: CEGUIItemEntry.h:185
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: CEGUIInputEvent.h:245
virtual bool testClassName_impl(const String &class_name) const
Return the "optimal" size for the item.
Definition: CEGUIItemEntry.h:215
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: CEGUIInputEvent.h:274
Base class for item list widgets.
Definition: CEGUIItemListBase.h:80
static const String EventSelectionChanged
Definition: CEGUIItemEntry.h:90
Property to access the state of the selected setting.
Definition: CEGUIItemEntryProperties.h:80
String class used within the GUI system.
Definition: CEGUIString.h:57