Crazy Eddies GUI System  0.6.0
CEGUIScrollablePane.h
1 /***********************************************************************
2  filename: CEGUIScrollablePane.h
3  created: 1/3/2005
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2006 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 "elements/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 {
47  class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
48  {
49  public:
55 
64  virtual Rect getViewableArea(void) const = 0;
65  };
66 
75  class CEGUIEXPORT ScrollablePane : public Window
76  {
77  public:
78  /*************************************************************************
79  Constants
80  *************************************************************************/
81  static const String WidgetTypeName;
82  static const String EventNamespace;
88 
89  /*************************************************************************
90  Child Widget name suffix constants
91  *************************************************************************/
95 
96  /*************************************************************************
97  Construction / Destruction
98  *************************************************************************/
103  ScrollablePane(const String& type, const String& name);
104 
109  ~ScrollablePane(void);
110 
111  /*************************************************************************
112  Public interface
113  *************************************************************************/
126  const ScrolledContainer* getContentPane(void) const;
127 
136  bool isVertScrollbarAlwaysShown(void) const;
148  void setShowVertScrollbar(bool setting);
149 
158  bool isHorzScrollbarAlwaysShown(void) const;
159 
171  void setShowHorzScrollbar(bool setting);
172 
181  bool isContentPaneAutoSized(void) const;
182 
194  void setContentPaneAutoSized(bool setting);
195 
204  const Rect& getContentPaneArea(void) const;
205 
221  void setContentPaneArea(const Rect& area);
222 
232  float getHorizontalStepSize(void) const;
233 
246  void setHorizontalStepSize(float step);
247 
257  float getHorizontalOverlapSize(void) const;
258 
271  void setHorizontalOverlapSize(float overlap);
272 
281  float getHorizontalScrollPosition(void) const;
282 
294  void setHorizontalScrollPosition(float position);
295 
305  float getVerticalStepSize(void) const;
306 
319  void setVerticalStepSize(float step);
320 
330  float getVerticalOverlapSize(void) const;
331 
344  void setVerticalOverlapSize(float overlap);
345 
354  float getVerticalScrollPosition(void) const;
355 
367  void setVerticalScrollPosition(float position);
368 
377  Rect getViewableArea(void) const;
378 
390  Scrollbar* getVertScrollbar() const;
391 
403  Scrollbar* getHorzScrollbar() const;
404 
405  /*************************************************************************
406  Overridden from Window
407  *************************************************************************/
408  void initialiseComponents(void);
409  void destroy(void);
410 
411  protected:
412  /*************************************************************************
413  Abstract interface
414  *************************************************************************/
423  //virtual Rect getViewableArea_impl(void) const = 0;
424 
425  /*************************************************************************
426  Implementation Methods
427  *************************************************************************/
433  void configureScrollbars(void);
434 
443  bool isVertScrollbarNeeded(void) const;
444 
453  bool isHorzScrollbarNeeded(void) const;
454 
460  void updateContainerPosition(void);
461 
462 
473  virtual bool testClassName_impl(const String& class_name) const
474  {
475  if (class_name=="ScrollablePane") return true;
476  return Window::testClassName_impl(class_name);
477  }
478 
490  ScrolledContainer* getScrolledContainer() const;
491 
492  // validate window renderer
493  virtual bool validateWindowRenderer(const String& name) const
494  {
495  return (name == "ScrollablePane");
496  }
497 
498  /*************************************************************************
499  Event triggers
500  *************************************************************************/
512  virtual void onContentPaneChanged(WindowEventArgs& e);
513 
525  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
526 
538  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
539 
551  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
552 
564  virtual void onContentPaneScrolled(WindowEventArgs& e);
565 
566  /*************************************************************************
567  Event handler methods
568  *************************************************************************/
574  bool handleScrollChange(const EventArgs& e);
575 
581  bool handleContentAreaChange(const EventArgs& e);
582 
588  bool handleAutoSizePaneChanged(const EventArgs& e);
589 
590  /*************************************************************************
591  Overridden from Window
592  *************************************************************************/
593  void addChild_impl(Window* wnd);
594  void removeChild_impl(Window* wnd);
595  void onSized(WindowEventArgs& e);
596  void onMouseWheel(MouseEventArgs& e);
597 
598  /*************************************************************************
599  Data fields
600  *************************************************************************/
604  float d_vertStep;
606  float d_horzStep;
610 
611  private:
612  /*************************************************************************
613  Static Properties for this class
614  *************************************************************************/
615  static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
616  static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
617  static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
618  static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
619  static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
620  static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
621  static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
622  static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
623  static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
624  static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
625 
626  /*************************************************************************
627  Private methods
628  *************************************************************************/
629  void addScrollablePaneProperties(void);
630  };
631 
632 
633 } // End of CEGUI namespace section
634 
635 
636 #if defined(_MSC_VER)
637 # pragma warning(pop)
638 #endif
639 
640 #endif // end of guard _CEGUIScrollablePane_h_