Crazy Eddie's GUI System  0.8.7
widgets/ItemEntry.h
1 /***********************************************************************
2  created: 31/3/2005
3  author: Tomas Lindquist Olsen (based on code by Paul D Turner)
4 
5  purpose: Interface to base class for ItemEntry widget
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIItemEntry_h_
30 #define _CEGUIItemEntry_h_
31 
32 #include "../Base.h"
33 #include "../Window.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 
40 // Start of CEGUI namespace section
41 namespace CEGUI
42 {
43 
48 class CEGUIEXPORT ItemEntryWindowRenderer : public WindowRenderer
49 {
50 public:
55  ItemEntryWindowRenderer(const String& name);
56 
65  virtual Sizef getItemPixelSize(void) const = 0;
66 };
67 
76 class CEGUIEXPORT ItemEntry : public Window
77 {
78 public:
79  /*************************************************************************
80  Constants
81  *************************************************************************/
82  static const String WidgetTypeName;
83 
89 
90  /*************************************************************************
91  Accessors
92  *************************************************************************/
101  Sizef getItemPixelSize(void) const;
102 
108  ItemListBase* getOwnerList(void) const {return d_ownerList;}
109 
114  bool isSelected(void) const {return d_selected;}
115 
120  bool isSelectable(void) const {return d_selectable;}
121 
122  /*************************************************************************
123  Set methods
124  *************************************************************************/
134  void setSelected(bool setting) {setSelected_impl(setting, true);}
135 
140  void select(void) {setSelected_impl(true, true);}
141 
146  void deselect(void) {setSelected_impl(false, true);}
147 
153  void setSelected_impl(bool state, bool notify);
154 
168  void setSelectable(bool setting);
169 
170  /*************************************************************************
171  Construction and Destruction
172  *************************************************************************/
177  ItemEntry(const String& type, const String& name);
178 
183  virtual ~ItemEntry(void) {}
184 
185 protected:
186  /*************************************************************************
187  Abstract Implementation Functions
188  *************************************************************************/
197  //virtual Size getItemPixelSize_impl(void) const = 0;
198 
199  /*************************************************************************
200  Implementation Functions
201  *************************************************************************/
202  // validate window renderer
203  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
204 
205  /*************************************************************************
206  New Event Handlers
207  *************************************************************************/
212  virtual void onSelectionChanged(WindowEventArgs& e);
213 
214  /*************************************************************************
215  Overridden Event Handlers
216  *************************************************************************/
217  virtual void onMouseClicked(MouseEventArgs& e);
218 
219  /*************************************************************************
220  Implementation Data
221  *************************************************************************/
222 
225 
228 
230  bool d_selectable;
231 
232  // make the ItemListBase a friend
233  friend class ItemListBase;
234 
235 private:
236 
237  void addItemEntryProperties(void);
238 };
239 
240 } // End of CEGUI namespace section
241 
242 #if defined(_MSC_VER)
243 # pragma warning(pop)
244 #endif
245 
246 #endif // end of guard _CEGUIItemEntry_h_
bool isSelectable(void) const
Returns whether this item is selectable or not.
Definition: widgets/ItemEntry.h:120
void deselect(void)
Deselects the item.
Definition: widgets/ItemEntry.h:146
bool d_selected
'true' when the item is selectable.
Definition: widgets/ItemEntry.h:227
void setSelected(bool setting)
Sets the selection state of this item (on/off). If this item is not selectable this function does not...
Definition: widgets/ItemEntry.h:134
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Base class for item type widgets.
Definition: widgets/ItemEntry.h:76
bool isSelected(void) const
Returns whether this item is selected or not.
Definition: widgets/ItemEntry.h:114
void select(void)
Selects the item.
Definition: widgets/ItemEntry.h:140
ItemListBase * d_ownerList
< pointer to the owner ItemListBase. 0 if there is none.
Definition: widgets/ItemEntry.h:224
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:50
Base class for ItemEntry window renderer objects.
Definition: widgets/ItemEntry.h:48
ItemListBase * getOwnerList(void) const
Returns a pointer to the owner ItemListBase. 0 if there is none.
Definition: widgets/ItemEntry.h:108
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
static const String WidgetTypeName
Window factory name.
Definition: widgets/ItemEntry.h:82
virtual ~ItemEntry(void)
Destructor for ItemEntry objects.
Definition: widgets/ItemEntry.h:183
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:251
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: InputEvent.h:280
Base class for item list widgets.
Definition: ItemListBase.h:78
static const String EventSelectionChanged
Definition: widgets/ItemEntry.h:88
String class used within the GUI system.
Definition: String.h:62