Crazy Eddie's GUI System  0.8.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
widgets/ItemEntry.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 "../Base.h"
34 #include "../Window.h"
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
44 
49 class CEGUIEXPORT ItemEntryWindowRenderer : public WindowRenderer
50 {
51 public:
56  ItemEntryWindowRenderer(const String& name);
57 
66  virtual Sizef getItemPixelSize(void) const = 0;
67 };
68 
77 class CEGUIEXPORT ItemEntry : public Window
78 {
79 public:
80  /*************************************************************************
81  Constants
82  *************************************************************************/
83  static const String WidgetTypeName;
84 
90 
91  /*************************************************************************
92  Accessors
93  *************************************************************************/
102  Sizef getItemPixelSize(void) const;
103 
109  ItemListBase* getOwnerList(void) const {return d_ownerList;}
110 
115  bool isSelected(void) const {return d_selected;}
116 
121  bool isSelectable(void) const {return d_selectable;}
122 
123  /*************************************************************************
124  Set methods
125  *************************************************************************/
135  void setSelected(bool setting) {setSelected_impl(setting, true);}
136 
141  void select(void) {setSelected_impl(true, true);}
142 
147  void deselect(void) {setSelected_impl(false, true);}
148 
154  void setSelected_impl(bool state, bool notify);
155 
169  void setSelectable(bool setting);
170 
171  /*************************************************************************
172  Construction and Destruction
173  *************************************************************************/
178  ItemEntry(const String& type, const String& name);
179 
184  virtual ~ItemEntry(void) {}
185 
186 protected:
187  /*************************************************************************
188  Abstract Implementation Functions
189  *************************************************************************/
198  //virtual Size getItemPixelSize_impl(void) const = 0;
199 
200  /*************************************************************************
201  Implementation Functions
202  *************************************************************************/
203  // validate window renderer
204  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
205 
206  /*************************************************************************
207  New Event Handlers
208  *************************************************************************/
213  virtual void onSelectionChanged(WindowEventArgs& e);
214 
215  /*************************************************************************
216  Overridden Event Handlers
217  *************************************************************************/
218  virtual void onMouseClicked(MouseEventArgs& e);
219 
220  /*************************************************************************
221  Implementation Data
222  *************************************************************************/
223 
225  ItemListBase* d_ownerList;
226 
228  bool d_selected;
229 
231  bool d_selectable;
232 
233  // make the ItemListBase a friend
234  friend class ItemListBase;
235 
236 private:
237 
238  void addItemEntryProperties(void);
239 };
240 
241 } // End of CEGUI namespace section
242 
243 #if defined(_MSC_VER)
244 # pragma warning(pop)
245 #endif
246 
247 #endif // end of guard _CEGUIItemEntry_h_