Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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;
111 
113  ScrollablePane(const String& type, const String& name);
114 
116  ~ScrollablePane(void);
117 
130  const ScrolledContainer* getContentPane(void) const;
131 
140  bool isVertScrollbarAlwaysShown(void) const;
141 
155  void setShowVertScrollbar(bool setting);
156 
165  bool isHorzScrollbarAlwaysShown(void) const;
166 
180  void setShowHorzScrollbar(bool setting);
181 
191  bool isContentPaneAutoSized(void) const;
192 
205  void setContentPaneAutoSized(bool setting);
206 
215  const Rect& getContentPaneArea(void) const;
216 
232  void setContentPaneArea(const Rect& area);
233 
243  float getHorizontalStepSize(void) const;
244 
257  void setHorizontalStepSize(float step);
258 
268  float getHorizontalOverlapSize(void) const;
269 
282  void setHorizontalOverlapSize(float overlap);
283 
292  float getHorizontalScrollPosition(void) const;
293 
305  void setHorizontalScrollPosition(float position);
306 
316  float getVerticalStepSize(void) const;
317 
330  void setVerticalStepSize(float step);
331 
341  float getVerticalOverlapSize(void) const;
342 
355  void setVerticalOverlapSize(float overlap);
356 
365  float getVerticalScrollPosition(void) const;
366 
378  void setVerticalScrollPosition(float position);
379 
388  Rect getViewableArea(void) const;
389 
401  Scrollbar* getVertScrollbar() const;
402 
414  Scrollbar* getHorzScrollbar() const;
415 
416  // Overridden from Window
417  void initialiseComponents(void);
418  void destroy(void);
419 
420 protected:
427  void configureScrollbars(void);
428 
437  bool isVertScrollbarNeeded(void) const;
438 
447  bool isHorzScrollbarNeeded(void) const;
448 
454  void updateContainerPosition(void);
455 
456 
468  virtual bool testClassName_impl(const String& class_name) const
469  {
470  if (class_name=="ScrollablePane")
471  return true;
472 
473  return Window::testClassName_impl(class_name);
474  }
475 
487  ScrolledContainer* getScrolledContainer() const;
488 
489  // validate window renderer
490  virtual bool validateWindowRenderer(const String& name) const
491  {
492  return (name == "ScrollablePane");
493  }
494 
495  /*************************************************************************
496  Event triggers
497  *************************************************************************/
509  virtual void onContentPaneChanged(WindowEventArgs& e);
510 
522  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
523 
535  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
536 
548  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
549 
561  virtual void onContentPaneScrolled(WindowEventArgs& e);
562 
563  /*************************************************************************
564  Event handler methods
565  *************************************************************************/
571  bool handleScrollChange(const EventArgs& e);
572 
578  bool handleContentAreaChange(const EventArgs& e);
579 
585  bool handleAutoSizePaneChanged(const EventArgs& e);
586 
587  // Overridden from Window
588  void addChild_impl(Window* wnd);
589  void removeChild_impl(Window* wnd);
590  void onSized(WindowEventArgs& e);
591  void onMouseWheel(MouseEventArgs& e);
592 
600  float d_vertStep;
604  float d_horzStep;
611 
612 private:
613  static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
614  static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
615  static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
616  static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
617  static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
618  static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
619  static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
620  static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
621  static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
622  static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
623 
624  void addScrollablePaneProperties(void);
625 };
626 
627 } // End of CEGUI namespace section
628 
629 #if defined(_MSC_VER)
630 # pragma warning(pop)
631 #endif
632 
633 #endif // end of guard _CEGUIScrollablePane_h_