Crazy Eddie's GUI System  0.8.7
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 
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 
402 
415 
416  // Overridden from Window
418  void destroy(void);
419 
420 protected:
428 
437  bool isVertScrollbarNeeded(void) const;
438 
447  bool isHorzScrollbarNeeded(void) const;
448 
455 
468 
469  // validate window renderer
470  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
471 
472  /*************************************************************************
473  Event triggers
474  *************************************************************************/
487 
500 
513 
526 
539 
540  /*************************************************************************
541  Event handler methods
542  *************************************************************************/
549 
556 
563 
564  // Overridden from Window
565  void addChild_impl(Element* element);
566  void removeChild_impl(Element* element);
567 
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_
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: Element.h:211
A positioned and sized rectangular node in a tree graph.
Definition: Element.h:246
Base class used as the argument to all subscribers Event object.
Definition: EventArgs.h:51
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:281
Adds name to the Element class, including name path traversal.
Definition: NamedElement.h:76
Base class for ScrollablePane window renderer objects.
Definition: widgets/ScrollablePane.h:43
ScrollablePaneWindowRenderer(const String &name)
Constructor.
virtual Rectf getViewableArea(void) const =0
Return a Rect that described the pane's viewable area, relative to this Window, in pixels.
Base class for the ScrollablePane widget.
Definition: widgets/ScrollablePane.h:68
Event::Connection d_autoSizeChangedConn
Event connection to content pane.
Definition: widgets/ScrollablePane.h:591
void setContentPaneAutoSized(bool setting)
Set whether the content pane should be auto-sized.
static const String HorzScrollbarName
Widget name for the horizontal scrollbar component.
Definition: widgets/ScrollablePane.h:106
virtual void onHorzScrollbarModeChanged(WindowEventArgs &e)
Event trigger method called when the setting that controls whether the horizontal scrollbar is always...
void setHorizontalOverlapSize(float overlap)
Sets the horizontal scrollbar overlap size as a fraction of one complete view page.
void initialiseComponents(void)
Initialises the Window based object ready for use.
bool isContentPaneAutoSized(void) const
Return whether the content pane is auto sized.
void setHorizontalStepSize(float step)
Sets the horizontal scrollbar step size as a fraction of one complete view page.
float d_horzStep
horizontal scroll step fraction.
Definition: widgets/ScrollablePane.h:585
void setVerticalScrollPosition(float position)
Sets the vertical scroll position as a fraction of the complete scrollable height.
static const String VertScrollbarName
Widget name for the vertical scrollbar component.
Definition: widgets/ScrollablePane.h:104
float d_vertStep
vertical scroll step fraction.
Definition: widgets/ScrollablePane.h:581
bool d_forceHorzScroll
true if horizontal scrollbar should always be displayed
Definition: widgets/ScrollablePane.h:577
virtual bool validateWindowRenderer(const WindowRenderer *renderer) const
Function used in checking if a WindowRenderer is valid for this window.
void setShowVertScrollbar(bool setting)
Set whether the vertical scroll bar should always be shown.
float getHorizontalScrollPosition(void) const
Returns the horizontal scroll position as a fraction of the complete scrollable width.
~ScrollablePane(void)
Destructor for the ScrollablePane base class.
bool d_forceVertScroll
true if vertical scrollbar should always be displayed
Definition: widgets/ScrollablePane.h:575
void setContentPaneArea(const Rectf &area)
Set the current content pane area for the ScrollablePane.
void setShowHorzScrollbar(bool setting)
Set whether the horizontal scroll bar should always be shown.
Event::Connection d_contentChangedConn
Event connection to content pane.
Definition: widgets/ScrollablePane.h:589
float getVerticalOverlapSize(void) const
Returns the vertical scrollbar overlap size as a fraction of one complete view page.
ScrollablePane(const String &type, const String &name)
Constructor for the ScrollablePane base class.
void updateContainerPosition(void)
Update the content container position according to the current state of the widget (like scrollbar po...
Scrollbar * getVertScrollbar() const
Return a pointer to the vertical scrollbar component widget for this ScrollablePane.
Rectf d_contentRect
holds content area so we can track changes.
Definition: widgets/ScrollablePane.h:579
virtual void onVertScrollbarModeChanged(WindowEventArgs &e)
Event trigger method called when the setting that controls whether the vertical scrollbar is always s...
virtual void onContentPaneScrolled(WindowEventArgs &e)
Notification method called whenever the content pane is scrolled via changes in the scrollbar positio...
float getHorizontalOverlapSize(void) const
Returns the horizontal scrollbar overlap size as a fraction of one complete view page.
bool handleScrollChange(const EventArgs &e)
Handler method which gets subscribed to the scrollbar position change events.
void setHorizontalScrollPosition(float position)
Sets the horizontal scroll position as a fraction of the complete scrollable width.
static const String EventVertScrollbarModeChanged
Definition: widgets/ScrollablePane.h:85
void setVerticalStepSize(float step)
Sets the vertical scrollbar step size as a fraction of one complete view page.
static const String EventHorzScrollbarModeChanged
Definition: widgets/ScrollablePane.h:91
virtual void onContentPaneChanged(WindowEventArgs &e)
Event trigger method called when some pane content has changed size or location.
void destroy(void)
Internal destroy method which actually just adds the window and any parent destructed child windows t...
bool isHorzScrollbarAlwaysShown(void) const
Return whether the horizontal scroll bar is always shown.
Rectf getViewableArea(void) const
Return a Rect that described the pane's viewable area, relative to this Window, in pixels.
NamedElement * getChildByNamePath_impl(const String &name_path) const
Retrieves a child at name_path or 0 if none such exists.
static const String WidgetTypeName
Window factory name.
Definition: widgets/ScrollablePane.h:71
ScrolledContainer * getScrolledContainer() const
Return a pointer to the ScrolledContainer component widget for this ScrollablePane.
void removeChild_impl(Element *element)
Remove given element from child list.
float getHorizontalStepSize(void) const
Returns the horizontal scrollbar step size as a fraction of one complete view page.
static const String EventContentPaneChanged
Definition: widgets/ScrollablePane.h:79
static const String EventContentPaneScrolled
Definition: widgets/ScrollablePane.h:102
bool isVertScrollbarAlwaysShown(void) const
Return whether the vertical scroll bar is always shown.
void onMouseWheel(MouseEventArgs &e)
Handler called when the mouse wheel (z-axis) position changes within this window's area.
static const String EventAutoSizeSettingChanged
Definition: widgets/ScrollablePane.h:97
static const String ScrolledContainerName
Widget name for the scrolled container component.
Definition: widgets/ScrollablePane.h:108
void addChild_impl(Element *element)
Add given element to child list at an appropriate position.
bool isHorzScrollbarNeeded(void) const
Return whether the horizontal scrollbar is needed.
const ScrolledContainer * getContentPane(void) const
Returns a pointer to the window holding the pane contents.
void configureScrollbars(void)
display required integrated scroll bars according to current size of the ScrollablePane view area and...
const Rectf & getContentPaneArea(void) const
Return the current content pane area for the ScrollablePane.
bool handleAutoSizePaneChanged(const EventArgs &e)
Handler method which gets subscribed to the ScrolledContainer auto-size setting changes.
float d_vertOverlap
vertical scroll overlap fraction.
Definition: widgets/ScrollablePane.h:583
void onSized(ElementEventArgs &e)
Handler called when the window's size changes.
float getVerticalScrollPosition(void) const
Returns the vertical scroll position as a fraction of the complete scrollable height.
void setVerticalOverlapSize(float overlap)
Sets the vertical scrollbar overlap size as a fraction of one complete view page.
bool handleContentAreaChange(const EventArgs &e)
Handler method which gets subscribed to the ScrolledContainer content change events.
float getVerticalStepSize(void) const
Returns the vertical scrollbar step size as a fraction of one complete view page.
Scrollbar * getHorzScrollbar() const
Return a pointer to the horizontal scrollbar component widget for this ScrollablePane.
bool isVertScrollbarNeeded(void) const
Return whether the vertical scrollbar is needed.
float d_horzOverlap
horizontal scroll overlap fraction.
Definition: widgets/ScrollablePane.h:587
static const String EventNamespace
Namespace for global events.
Definition: widgets/ScrollablePane.h:73
virtual void onAutoSizeSettingChanged(WindowEventArgs &e)
Notification method called whenever the setting that controls whether the content pane is automatical...
Base scroll bar class.
Definition: widgets/Scrollbar.h:90
Helper container window class which is used in the implementation of the ScrollablePane widget class.
Definition: ScrolledContainer.h:48
String class used within the GUI system.
Definition: String.h:64
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:252
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:52
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Class used to create XML Document.
Definition: XMLSerializer.h:87
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1