Crazy Eddies GUI System  0.7.0
CEGUIScrolledItemListBase.h
1 /************************************************************************
2  filename: CEGUIIScrolledItemListBase.h
3  created: Sat Oct 29 2005
4  author: Tomas Lindquist Olsen
5 *************************************************************************/
6 /*************************************************************************
7  Crazy Eddie's GUI System (http://www.cegui.org.uk)
8  Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *************************************************************************/
24 #ifndef _CEGUIScrolledItemListBase_h_
25 #define _CEGUIScrolledItemListBase_h_
26 
27 #include "CEGUIItemListBase.h"
28 #include "CEGUIScrollbar.h"
29 #include "CEGUIScrolledItemListBaseProperties.h"
30 
31 #if defined(_MSC_VER)
32 # pragma warning(push)
33 # pragma warning(disable : 4251)
34 #endif
35 // begin CEGUI namespace
36 namespace CEGUI
37 {
38 
43 class CEGUIEXPORT ScrolledItemListBase : public ItemListBase
44 {
45 public:
46  static const String EventNamespace;
47 
48  /************************************************************************
49  Constants
50  *************************************************************************/
54 
57 
58  /************************************************************************
59  Accessors
60  *************************************************************************/
65  bool isVertScrollbarAlwaysShown(void) const {return d_forceVScroll;}
66 
71  bool isHorzScrollbarAlwaysShown(void) const {return d_forceHScroll;}
72 
77  Scrollbar* getVertScrollbar() const;
78 
83  Scrollbar* getHorzScrollbar() const;
84 
85  /************************************************************************
86  Manipulators
87  *************************************************************************/
92  void setShowVertScrollbar(bool mode);
93 
98  void setShowHorzScrollbar(bool mode);
99 
113  void ensureItemIsVisibleVert(const ItemEntry& item);
114 
128  void ensureItemIsVisibleHorz(const ItemEntry& item);
129 
130  /************************************************************************
131  Object Construction and Destruction
132  *************************************************************************/
137  ScrolledItemListBase(const String& type, const String& name);
138 
143  virtual ~ScrolledItemListBase(void);
144 
145  // overridden from ItemListBase
146  virtual void initialiseComponents(void);
147 
148 protected:
149  /************************************************************************
150  Implementation functions
151  ************************************************************************/
162  virtual bool testClassName_impl(const String& class_name) const
163  {
164  if (class_name=="ScrolledItemListBase")
165  {
166  return true;
167  }
168  return ItemListBase::testClassName_impl(class_name);
169  }
170 
175  void configureScrollbars(const Size& doc_size);
176 
177  /************************************************************************
178  New event handlers
179  ************************************************************************/
180  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
181  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
182 
183  /************************************************************************
184  Overridden event handlers
185  ************************************************************************/
186  virtual void onMouseWheel(MouseEventArgs& e);
187 
188  /************************************************************************
189  Event subscribers
190  ************************************************************************/
191  bool handle_VScroll(const EventArgs& e);
192  bool handle_HScroll(const EventArgs& e);
193 
194  /************************************************************************
195  Implementation data
196  ************************************************************************/
197  bool d_forceVScroll;
198  bool d_forceHScroll;
199 
200 private:
201  /************************************************************************
202  Static Properties for this class
203  ************************************************************************/
204  static ScrolledItemListBaseProperties::ForceVertScrollbar d_forceVertScrollbarProperty;
205  static ScrolledItemListBaseProperties::ForceHorzScrollbar d_forceHorzScrollbarProperty;
206 
207  void addScrolledItemListBaseProperties(void);
208 };
209 
210 } // end CEGUI namespace
211 
212 #if defined(_MSC_VER)
213 # pragma warning(pop)
214 #endif
215 
216 #endif // end of guard _CEGUIScrolledItemListBase_h_