Crazy Eddies GUI System  0.7.1
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 
61 
62  /************************************************************************
63  Accessors
64  *************************************************************************/
69  bool isVertScrollbarAlwaysShown(void) const {return d_forceVScroll;}
70 
75  bool isHorzScrollbarAlwaysShown(void) const {return d_forceHScroll;}
76 
81  Scrollbar* getVertScrollbar() const;
82 
87  Scrollbar* getHorzScrollbar() const;
88 
89  /************************************************************************
90  Manipulators
91  *************************************************************************/
96  void setShowVertScrollbar(bool mode);
97 
102  void setShowHorzScrollbar(bool mode);
103 
117  void ensureItemIsVisibleVert(const ItemEntry& item);
118 
132  void ensureItemIsVisibleHorz(const ItemEntry& item);
133 
134  /************************************************************************
135  Object Construction and Destruction
136  *************************************************************************/
141  ScrolledItemListBase(const String& type, const String& name);
142 
147  virtual ~ScrolledItemListBase(void);
148 
149  // overridden from ItemListBase
150  virtual void initialiseComponents(void);
151 
152 protected:
153  /************************************************************************
154  Implementation functions
155  ************************************************************************/
166  virtual bool testClassName_impl(const String& class_name) const
167  {
168  if (class_name=="ScrolledItemListBase")
169  {
170  return true;
171  }
172  return ItemListBase::testClassName_impl(class_name);
173  }
174 
179  void configureScrollbars(const Size& doc_size);
180 
181  /************************************************************************
182  New event handlers
183  ************************************************************************/
184  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
185  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
186 
187  /************************************************************************
188  Overridden event handlers
189  ************************************************************************/
190  virtual void onMouseWheel(MouseEventArgs& e);
191 
192  /************************************************************************
193  Event subscribers
194  ************************************************************************/
195  bool handle_VScroll(const EventArgs& e);
196  bool handle_HScroll(const EventArgs& e);
197 
198  /************************************************************************
199  Implementation data
200  ************************************************************************/
201  bool d_forceVScroll;
202  bool d_forceHScroll;
203 
204 private:
205  /************************************************************************
206  Static Properties for this class
207  ************************************************************************/
208  static ScrolledItemListBaseProperties::ForceVertScrollbar d_forceVertScrollbarProperty;
209  static ScrolledItemListBaseProperties::ForceHorzScrollbar d_forceHorzScrollbarProperty;
210 
211  void addScrolledItemListBaseProperties(void);
212 };
213 
214 } // end CEGUI namespace
215 
216 #if defined(_MSC_VER)
217 # pragma warning(pop)
218 #endif
219 
220 #endif // end of guard _CEGUIScrolledItemListBase_h_