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_
static const String VertScrollbarNameSuffix
Widget name suffix for the vertical scrollbar component.
Definition: CEGUIScrollablePane.h:106
Property to access the setting which controls whether the content pane is automatically resized accor...
Definition: CEGUIScrollablePaneProperties.h:56
Base class for the ScrollablePane widget.
Definition: CEGUIScrollablePane.h:69
Property to access the overlap size for the vertical Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:256
Event::Connection d_autoSizeChangedConn
Event connection to content pane.
Definition: CEGUIScrollablePane.h:610
Property to access the current content pane area rectangle (as window relative pixels).
Definition: CEGUIScrollablePaneProperties.h:83
Property to access the step size for the vertical Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:232
Property to access the scroll position of the vertical Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:280
Base class used as the argument to all subscribers Event object.
Definition: CEGUIEventArgs.h:52
Base scroll bar class.
Definition: CEGUIScrollbar.h:98
static const String EventAutoSizeSettingChanged
Definition: CEGUIScrollablePane.h:99
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIWindow.h:3928
float d_horzOverlap
horizontal scroll overlap fraction.
Definition: CEGUIScrollablePane.h:606
Base-class for the assignable WindowRenderer object.
Definition: CEGUIWindowRenderer.h:51
float d_vertStep
vertical scroll step fraction.
Definition: CEGUIScrollablePane.h:600
bool d_forceVertScroll
true if vertical scrollbar should always be displayed
Definition: CEGUIScrollablePane.h:594
Base class for ScrollablePane window renderer objects.
Definition: CEGUIScrollablePane.h:44
static const String ScrolledContainerNameSuffix
Widget name suffix for the scrolled container component.
Definition: CEGUIScrollablePane.h:110
float d_vertOverlap
vertical scroll overlap fraction.
Definition: CEGUIScrollablePane.h:602
Property to access the setting which controls whether the horizontal scroll bar will always be displa...
Definition: CEGUIScrollablePaneProperties.h:136
float d_horzStep
horizontal scroll step fraction.
Definition: CEGUIScrollablePane.h:604
Property to access the step size for the horizontal Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:160
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIScrollablePane.h:468
virtual bool validateWindowRenderer(const String &name) const
Function used in checking if a WindowRenderer is valid for this window.
Definition: CEGUIScrollablePane.h:490
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: CEGUIWindow.h:138
static const String EventNamespace
Namespace for global events.
Definition: CEGUIScrollablePane.h:75
Property to access the setting which controls whether the vertical scroll bar will always be displaye...
Definition: CEGUIScrollablePaneProperties.h:109
bool d_forceHorzScroll
true if horizontal scrollbar should always be displayed
Definition: CEGUIScrollablePane.h:596
static const String WidgetTypeName
Window factory name.
Definition: CEGUIScrollablePane.h:73
static const String EventHorzScrollbarModeChanged
Definition: CEGUIScrollablePane.h:93
static const String HorzScrollbarNameSuffix
Widget name suffix for the horizontal scrollbar component.
Definition: CEGUIScrollablePane.h:108
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: CEGUIInputEvent.h:245
Event::Connection d_contentChangedConn
Event connection to content pane.
Definition: CEGUIScrollablePane.h:608
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: CEGUIInputEvent.h:274
Property to access the scroll position of the horizontal Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:208
static const String EventVertScrollbarModeChanged
Definition: CEGUIScrollablePane.h:87
Helper container window class which is used in the implementation of the ScrollablePane widget class...
Definition: CEGUIScrolledContainer.h:49
Rect d_contentRect
holds content area so we can track changes.
Definition: CEGUIScrollablePane.h:598
static const String EventContentPaneScrolled
Definition: CEGUIScrollablePane.h:104
Property to access the overlap size for the horizontal Scrollbar.
Definition: CEGUIScrollablePaneProperties.h:184
Class encapsulating operations on a Rectangle.
Definition: CEGUIRect.h:44
String class used within the GUI system.
Definition: CEGUIString.h:57
static const String EventContentPaneChanged
Definition: CEGUIScrollablePane.h:81