Crazy Eddie's GUI System  0.8.5
widgets/ScrollablePane.h
1 /***********************************************************************
2  created: 1/3/2005
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2015 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 
116  virtual int writeChildWindowsXML(XMLSerializer& xml_stream) const;
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 Rectf& getContentPaneArea(void) const;
216 
232  void setContentPaneArea(const Rectf& 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  Rectf 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 
467  ScrolledContainer* getScrolledContainer() const;
468 
469  // validate window renderer
470  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
471 
472  /*************************************************************************
473  Event triggers
474  *************************************************************************/
486  virtual void onContentPaneChanged(WindowEventArgs& e);
487 
499  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
500 
512  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
513 
525  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
526 
538  virtual void onContentPaneScrolled(WindowEventArgs& e);
539 
540  /*************************************************************************
541  Event handler methods
542  *************************************************************************/
548  bool handleScrollChange(const EventArgs& e);
549 
555  bool handleContentAreaChange(const EventArgs& e);
556 
562  bool handleAutoSizePaneChanged(const EventArgs& e);
563 
564  // Overridden from Window
565  void addChild_impl(Element* element);
566  void removeChild_impl(Element* element);
567 
568  void onSized(ElementEventArgs& e);
569  void onMouseWheel(MouseEventArgs& e);
570 
572  NamedElement* getChildByNamePath_impl(const String& name_path) const;
573 
581  float d_vertStep;
585  float d_horzStep;
592 
593 private:
594  void addScrollablePaneProperties(void);
595 };
596 
597 } // End of CEGUI namespace section
598 
599 #if defined(_MSC_VER)
600 # pragma warning(pop)
601 #endif
602 
603 #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:591
Adds name to the Element class, including name path traversal.
Definition: NamedElement.h:74
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
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:587
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:50
float d_vertStep
vertical scroll step fraction.
Definition: widgets/ScrollablePane.h:581
bool d_forceVertScroll
true if vertical scrollbar should always be displayed
Definition: widgets/ScrollablePane.h:575
Base class for ScrollablePane window renderer objects.
Definition: widgets/ScrollablePane.h:42
float d_vertOverlap
vertical scroll overlap fraction.
Definition: widgets/ScrollablePane.h:583
float d_horzStep
horizontal scroll step fraction.
Definition: widgets/ScrollablePane.h:585
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:577
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:579
Event::Connection d_contentChangedConn
Event connection to content pane.
Definition: widgets/ScrollablePane.h:589
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
Class used to create XML Document.
Definition: XMLSerializer.h:85
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