Crazy Eddies GUI System  0.7.1
CEGUIScrollablePane.h
1 /***********************************************************************
2  filename: CEGUIScrollablePane.h
3  created: 1/3/2005
4  author: Paul D Turner
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 _CEGUIScrollablePane_h_
29 #define _CEGUIScrollablePane_h_
30 
31 #include "../CEGUIBase.h"
32 #include "../CEGUIWindow.h"
33 #include "CEGUIScrollablePaneProperties.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 {
44 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
45 {
46 public:
49 
58  virtual Rect getViewableArea(void) const = 0;
59 };
60 
69 class CEGUIEXPORT ScrollablePane : public Window
70 {
71 public:
73  static const String WidgetTypeName;
75  static const String EventNamespace;
92 
94  ScrollablePane(const String& type, const String& name);
95 
97  ~ScrollablePane(void);
98 
111  const ScrolledContainer* getContentPane(void) const;
112 
121  bool isVertScrollbarAlwaysShown(void) const;
122 
136  void setShowVertScrollbar(bool setting);
137 
146  bool isHorzScrollbarAlwaysShown(void) const;
147 
161  void setShowHorzScrollbar(bool setting);
162 
172  bool isContentPaneAutoSized(void) const;
173 
186  void setContentPaneAutoSized(bool setting);
187 
196  const Rect& getContentPaneArea(void) const;
197 
213  void setContentPaneArea(const Rect& area);
214 
224  float getHorizontalStepSize(void) const;
225 
238  void setHorizontalStepSize(float step);
239 
249  float getHorizontalOverlapSize(void) const;
250 
263  void setHorizontalOverlapSize(float overlap);
264 
273  float getHorizontalScrollPosition(void) const;
274 
286  void setHorizontalScrollPosition(float position);
287 
297  float getVerticalStepSize(void) const;
298 
311  void setVerticalStepSize(float step);
312 
322  float getVerticalOverlapSize(void) const;
323 
336  void setVerticalOverlapSize(float overlap);
337 
346  float getVerticalScrollPosition(void) const;
347 
359  void setVerticalScrollPosition(float position);
360 
369  Rect getViewableArea(void) const;
370 
382  Scrollbar* getVertScrollbar() const;
383 
395  Scrollbar* getHorzScrollbar() const;
396 
397  // Overridden from Window
398  void initialiseComponents(void);
399  void destroy(void);
400 
401 protected:
408  void configureScrollbars(void);
409 
418  bool isVertScrollbarNeeded(void) const;
419 
428  bool isHorzScrollbarNeeded(void) const;
429 
435  void updateContainerPosition(void);
436 
437 
449  virtual bool testClassName_impl(const String& class_name) const
450  {
451  if (class_name=="ScrollablePane")
452  return true;
453 
454  return Window::testClassName_impl(class_name);
455  }
456 
468  ScrolledContainer* getScrolledContainer() const;
469 
470  // validate window renderer
471  virtual bool validateWindowRenderer(const String& name) const
472  {
473  return (name == "ScrollablePane");
474  }
475 
476  /*************************************************************************
477  Event triggers
478  *************************************************************************/
490  virtual void onContentPaneChanged(WindowEventArgs& e);
491 
503  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
504 
516  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
517 
529  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
530 
542  virtual void onContentPaneScrolled(WindowEventArgs& e);
543 
544  /*************************************************************************
545  Event handler methods
546  *************************************************************************/
552  bool handleScrollChange(const EventArgs& e);
553 
559  bool handleContentAreaChange(const EventArgs& e);
560 
566  bool handleAutoSizePaneChanged(const EventArgs& e);
567 
568  // Overridden from Window
569  void addChild_impl(Window* wnd);
570  void removeChild_impl(Window* wnd);
571  void onSized(WindowEventArgs& e);
572  void onMouseWheel(MouseEventArgs& e);
573 
581  float d_vertStep;
585  float d_horzStep;
592 
593 private:
594  static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
595  static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
596  static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
597  static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
598  static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
599  static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
600  static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
601  static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
602  static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
603  static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
604 
605  void addScrollablePaneProperties(void);
606 };
607 
608 } // End of CEGUI namespace section
609 
610 #if defined(_MSC_VER)
611 # pragma warning(pop)
612 #endif
613 
614 #endif // end of guard _CEGUIScrollablePane_h_