Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
widgets/ScrollablePane.h
1 /***********************************************************************
2  created: 1/3/2005
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIScrollablePane_h_
28 #define _CEGUIScrollablePane_h_
29 
30 #include "../Base.h"
31 #include "../Window.h"
32 
33 #if defined(_MSC_VER)
34 # pragma warning(push)
35 # pragma warning(disable : 4251)
36 #endif
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
42 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
43 {
44 public:
47 
56  virtual Rectf getViewableArea(void) const = 0;
57 };
58 
67 class CEGUIEXPORT ScrollablePane : public Window
68 {
69 public:
71  static const String WidgetTypeName;
73  static const String EventNamespace;
104  static const String VertScrollbarName;
106  static const String HorzScrollbarName;
109 
111  ScrollablePane(const String& type, const String& name);
112 
114  ~ScrollablePane(void);
115 
128  const ScrolledContainer* getContentPane(void) const;
129 
138  bool isVertScrollbarAlwaysShown(void) const;
139 
153  void setShowVertScrollbar(bool setting);
154 
163  bool isHorzScrollbarAlwaysShown(void) const;
164 
178  void setShowHorzScrollbar(bool setting);
179 
189  bool isContentPaneAutoSized(void) const;
190 
203  void setContentPaneAutoSized(bool setting);
204 
213  const Rectf& getContentPaneArea(void) const;
214 
230  void setContentPaneArea(const Rectf& area);
231 
241  float getHorizontalStepSize(void) const;
242 
255  void setHorizontalStepSize(float step);
256 
266  float getHorizontalOverlapSize(void) const;
267 
280  void setHorizontalOverlapSize(float overlap);
281 
290  float getHorizontalScrollPosition(void) const;
291 
303  void setHorizontalScrollPosition(float position);
304 
314  float getVerticalStepSize(void) const;
315 
328  void setVerticalStepSize(float step);
329 
339  float getVerticalOverlapSize(void) const;
340 
353  void setVerticalOverlapSize(float overlap);
354 
363  float getVerticalScrollPosition(void) const;
364 
376  void setVerticalScrollPosition(float position);
377 
386  Rectf getViewableArea(void) const;
387 
399  Scrollbar* getVertScrollbar() const;
400 
412  Scrollbar* getHorzScrollbar() const;
413 
414  // Overridden from Window
415  void initialiseComponents(void);
416  void destroy(void);
417 
418 protected:
425  void configureScrollbars(void);
426 
435  bool isVertScrollbarNeeded(void) const;
436 
445  bool isHorzScrollbarNeeded(void) const;
446 
452  void updateContainerPosition(void);
453 
465  ScrolledContainer* getScrolledContainer() const;
466 
467  // validate window renderer
468  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
469 
470  /*************************************************************************
471  Event triggers
472  *************************************************************************/
484  virtual void onContentPaneChanged(WindowEventArgs& e);
485 
497  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
498 
510  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
511 
523  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
524 
536  virtual void onContentPaneScrolled(WindowEventArgs& e);
537 
538  /*************************************************************************
539  Event handler methods
540  *************************************************************************/
546  bool handleScrollChange(const EventArgs& e);
547 
553  bool handleContentAreaChange(const EventArgs& e);
554 
560  bool handleAutoSizePaneChanged(const EventArgs& e);
561 
562  // Overridden from Window
563  void addChild_impl(Element* element);
564  void removeChild_impl(Element* element);
565 
566  void onSized(ElementEventArgs& e);
567  void onMouseWheel(MouseEventArgs& e);
568 
570  NamedElement* getChildByNamePath_impl(const String& name_path) const;
571 
579  float d_vertStep;
583  float d_horzStep;
590 
591 private:
592  void addScrollablePaneProperties(void);
593 };
594 
595 } // End of CEGUI namespace section
596 
597 #if defined(_MSC_VER)
598 # pragma warning(pop)
599 #endif
600 
601 #endif // end of guard _CEGUIScrollablePane_h_
Base class for the ScrollablePane widget.
Definition: widgets/ScrollablePane.h:67
Event::Connection d_autoSizeChangedConn
Event connection to content pane.
Definition: widgets/ScrollablePane.h:589
Adds name to the Element class, including name path traversal.
Definition: NamedElement.h:74
A positioned and sized rectangular node in a tree graph.
Definition: Element.h:242
Base class used as the argument to all subscribers Event object.
Definition: EventArgs.h:49
Base scroll bar class.
Definition: widgets/Scrollbar.h:89
static const String EventAutoSizeSettingChanged
Definition: widgets/ScrollablePane.h:97
float d_horzOverlap
horizontal scroll overlap fraction.
Definition: widgets/ScrollablePane.h:585
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:50
float d_vertStep
vertical scroll step fraction.
Definition: widgets/ScrollablePane.h:579
bool d_forceVertScroll
true if vertical scrollbar should always be displayed
Definition: widgets/ScrollablePane.h:573
Base class for ScrollablePane window renderer objects.
Definition: widgets/ScrollablePane.h:42
float d_vertOverlap
vertical scroll overlap fraction.
Definition: widgets/ScrollablePane.h:581
float d_horzStep
horizontal scroll step fraction.
Definition: widgets/ScrollablePane.h:583
static const String ScrolledContainerName
Widget name for the scrolled container component.
Definition: widgets/ScrollablePane.h:108
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
static const String EventNamespace
Namespace for global events.
Definition: widgets/ScrollablePane.h:73
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: Element.h:210
bool d_forceHorzScroll
true if horizontal scrollbar should always be displayed
Definition: widgets/ScrollablePane.h:575
static const String WidgetTypeName
Window factory name.
Definition: widgets/ScrollablePane.h:71
static const String EventHorzScrollbarModeChanged
Definition: widgets/ScrollablePane.h:91
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:251
Rectf d_contentRect
holds content area so we can track changes.
Definition: widgets/ScrollablePane.h:577
Event::Connection d_contentChangedConn
Event connection to content pane.
Definition: widgets/ScrollablePane.h:587
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: InputEvent.h:280
static const String HorzScrollbarName
Widget name for the horizontal scrollbar component.
Definition: widgets/ScrollablePane.h:106
static const String EventVertScrollbarModeChanged
Definition: widgets/ScrollablePane.h:85
Helper container window class which is used in the implementation of the ScrollablePane widget class...
Definition: ScrolledContainer.h:47
static const String EventContentPaneScrolled
Definition: widgets/ScrollablePane.h:102
String class used within the GUI system.
Definition: String.h:62
static const String EventContentPaneChanged
Definition: widgets/ScrollablePane.h:79
static const String VertScrollbarName
Widget name for the vertical scrollbar component.
Definition: widgets/ScrollablePane.h:104