Crazy Eddies GUI System  0.7.2
CEGUIScrolledItemListBase.h
1 /************************************************************************
2  filename: CEGUIIScrolledItemListBase.h
3  created: Sat Oct 29 2005
4  author: Tomas Lindquist Olsen
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIScrolledItemListBase_h_
29 #define _CEGUIScrolledItemListBase_h_
30 
31 #include "CEGUIItemListBase.h"
32 #include "CEGUIScrollbar.h"
33 #include "CEGUIScrolledItemListBaseProperties.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 // begin CEGUI namespace
40 namespace CEGUI
41 {
42 
47 class CEGUIEXPORT ScrolledItemListBase : public ItemListBase
48 {
49 public:
50  static const String EventNamespace;
51 
52  /************************************************************************
53  Constants
54  *************************************************************************/
58 
71 
72  /************************************************************************
73  Accessors
74  *************************************************************************/
79  bool isVertScrollbarAlwaysShown(void) const {return d_forceVScroll;}
80 
85  bool isHorzScrollbarAlwaysShown(void) const {return d_forceHScroll;}
86 
91  Scrollbar* getVertScrollbar() const;
92 
97  Scrollbar* getHorzScrollbar() const;
98 
99  /************************************************************************
100  Manipulators
101  *************************************************************************/
106  void setShowVertScrollbar(bool mode);
107 
112  void setShowHorzScrollbar(bool mode);
113 
127  void ensureItemIsVisibleVert(const ItemEntry& item);
128 
142  void ensureItemIsVisibleHorz(const ItemEntry& item);
143 
144  /************************************************************************
145  Object Construction and Destruction
146  *************************************************************************/
151  ScrolledItemListBase(const String& type, const String& name);
152 
157  virtual ~ScrolledItemListBase(void);
158 
159  // overridden from ItemListBase
160  virtual void initialiseComponents(void);
161 
162 protected:
163  /************************************************************************
164  Implementation functions
165  ************************************************************************/
176  virtual bool testClassName_impl(const String& class_name) const
177  {
178  if (class_name=="ScrolledItemListBase")
179  {
180  return true;
181  }
182  return ItemListBase::testClassName_impl(class_name);
183  }
184 
189  void configureScrollbars(const Size& doc_size);
190 
191  /************************************************************************
192  New event handlers
193  ************************************************************************/
194  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
195  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
196 
197  /************************************************************************
198  Overridden event handlers
199  ************************************************************************/
200  virtual void onMouseWheel(MouseEventArgs& e);
201 
202  /************************************************************************
203  Event subscribers
204  ************************************************************************/
205  bool handle_VScroll(const EventArgs& e);
206  bool handle_HScroll(const EventArgs& e);
207 
208  /************************************************************************
209  Implementation data
210  ************************************************************************/
211  bool d_forceVScroll;
212  bool d_forceHScroll;
213 
214 private:
215  /************************************************************************
216  Static Properties for this class
217  ************************************************************************/
218  static ScrolledItemListBaseProperties::ForceVertScrollbar d_forceVertScrollbarProperty;
219  static ScrolledItemListBaseProperties::ForceHorzScrollbar d_forceHorzScrollbarProperty;
220 
221  void addScrolledItemListBaseProperties(void);
222 };
223 
224 } // end CEGUI namespace
225 
226 #if defined(_MSC_VER)
227 # pragma warning(pop)
228 #endif
229 
230 #endif // end of guard _CEGUIScrolledItemListBase_h_