Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 
224  ItemListBase* d_ownerList;
225 
227  bool d_selected;
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_