# WoopsiUI::ScrollingPanel Class Reference

`#include <scrollingpanel.h>`

Inheritance diagram for WoopsiUI::ScrollingPanel:

List of all members.

## Public Member Functions
| ScrollingPanel (s16 x, s16 y, u16 width, u16 height, u32 flags, GadgetStyle *style=NULL)
virtual void | scroll (s32 dx, s32 dy)
virtual void | jump (s32 x, s32 y)
bool | allowsVerticalScroll () const
bool | allowsHorizontalScroll () const
virtual const s32 | getCanvasX () const
virtual const s32 | getCanvasY () const
virtual const s32 | getCanvasWidth () const
virtual const s32 | getCanvasHeight () const
void | setAllowsVerticalScroll (bool allow)
void | setAllowsHorizontalScroll (bool allow)
void | setContentScrolled (bool scrolled)
bool | IsContentScrolled ()
virtual void | setCanvasWidth (const s32 width)
virtual void | setCanvasHeight (const s32 height)
## Protected Member Functions
virtual void | drawContents (GraphicsPort *port)
virtual void | drawBorder (GraphicsPort *port)
virtual void | onDrag (s16 x, s16 y, s16 vX, s16 vY)
virtual void | onClick (s16 x, s16 y)
void | scrollChildren (s32 dx, s32 dy)
void | drawChildren (Rect clipRect)
virtual | ~ScrollingPanel ()
| ScrollingPanel (const ScrollingPanel &scrollingPanel)
## Protected Attributes
s32 | _canvasX
s32 | _canvasY
s32 | _canvasWidth
s32 | _canvasHeight
bool | _allowVerticalScroll
bool | _allowHorizontalScroll
bool | _isContentScrolled

## Detailed Description

Class containing a scrollable region. Responds to stylus movement. Uses hardware- accelerated copying to reduce the amount of drawing required, where possible. Can contain sub-gadgets which will also be scrolled.

## Constructor & Destructor Documentation

WoopsiUI::ScrollingPanel::ScrollingPanel | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u32 | flags,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the gadget.
  | y | The y co-ordinate of the gadget.
  | width | The width of the gadget.
  | height | The height of the gadget.
  | flags | The usual gadget flags.
  | style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

virtual WoopsiUI::ScrollingPanel::~ScrollingPanel | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::ScrollingPanel::ScrollingPanel | ( | const ScrollingPanel & | scrollingPanel | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

bool WoopsiUI::ScrollingPanel::allowsHorizontalScroll | ( |  | ) | const`[inline, virtual]`

Returns true if horizontal scrolling is allowed.

Returns:
  True if horizontal scrolling is allowed.

Implements WoopsiUI::ScrollableBase.

bool WoopsiUI::ScrollingPanel::allowsVerticalScroll | ( |  | ) | const`[inline, virtual]`

Returns true if vertical scrolling is allowed.

Returns:
  True if vertical scrolling is allowed.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingPanel::drawBorder | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  | port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::ListBox, and WoopsiUI::MultiLineTextBox.

void WoopsiUI::ScrollingPanel::drawChildren | ( | Rect | clipRect | ) | `[protected]`

Draws all child gadgets within the supplied clipping region.

Parameters:

  | clipRect | The clipping region to draw within.

virtual void WoopsiUI::ScrollingPanel::drawContents | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  | port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::ListBox, and WoopsiUI::MultiLineTextBox.

virtual const s32 WoopsiUI::ScrollingPanel::getCanvasHeight | ( |  | ) | const`[inline, virtual]`

Gets the height of the virtual canvas.

Returns:
  The height of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingPanel::getCanvasWidth | ( |  | ) | const`[inline, virtual]`

Gets the width of the virtual canvas.

Returns:
  The width of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingPanel::getCanvasX | ( |  | ) | const`[inline, virtual]`

Gets the x co-ordinate of the virtual canvas.

Returns:
  The x co-ordinate of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingPanel::getCanvasY | ( |  | ) | const`[inline, virtual]`

Gets the y co-ordinate of the virtual canvas.

Returns:
  The y co-ordinate of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

bool WoopsiUI::ScrollingPanel::IsContentScrolled | ( |  | ) | `[inline]`

Check if the content of the panel, drawn via the draw() method, is scrolled.

Returns:
  True if the content is scrolled; false if not.

virtual void WoopsiUI::ScrollingPanel::jump | ( | s32 | x,
|  | s32 | y |
| ) |  |  | `[virtual]`

Reposition the panel's scrolling region to the specified co-ordinates.

Parameters:

  | x | The new x co-ordinate of the scrolling region.
  | y | The new y co-ordinate of the scrolling region.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingPanel::onClick | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[protected, virtual]`

Starts the dragging system.

Parameters:

  | x | The x co-ordinate of the click.
  | y | The y co-ordinate of the click.

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::ListBox, and WoopsiUI::MultiLineTextBox.

virtual void WoopsiUI::ScrollingPanel::onDrag | ( | s16 | x,
|  | s16 | y,
|  | s16 | vX,
|  | s16 | vY |
| ) |  |  | `[protected, virtual]`

Scrolls the panel to match the drag.

Parameters:

  | x | The x co-ordinate of the stylus.
  | y | The y co-ordinate of the stylus.
  | vX | The horizontal drag distance.
  | vY | The vertical drag distance.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ScrollingPanel::scroll | ( | s32 | dx,
|  | s32 | dy |
| ) |  |  | `[virtual]`

Scroll the panel by the specified amounts.

Parameters:

  | dx | The horizontal distance to scroll.
  | dy | The vertical distance to scroll.

Implements WoopsiUI::ScrollableBase.

void WoopsiUI::ScrollingPanel::scrollChildren | ( | s32 | dx,
|  | s32 | dy |
| ) |  |  | `[protected]`

Scroll all child gadgets by the specified amounts. Actually uses the gadget's moveTo() function to reposition them.

Parameters:

  | dx | The horizontal distance to scroll.
  | dy | The vertical distance to scroll.

void WoopsiUI::ScrollingPanel::setAllowsHorizontalScroll | ( | bool | allow | ) | `[inline, virtual]`

Set whether or not horizontal scrolling is allowed.

Parameters:

  | allow | True to allow horizontal scrolling; false to deny it.

Implements WoopsiUI::ScrollableBase.

void WoopsiUI::ScrollingPanel::setAllowsVerticalScroll | ( | bool | allow | ) | `[inline, virtual]`

Set whether or not horizontal scrolling is allowed.

Parameters:

  | allow | True to allow horizontal scrolling; false to deny it.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingPanel::setCanvasHeight | ( | const s32 | height | ) | `[inline, virtual]`

Sets the height of the virtual canvas.

Parameters:

  | height | The height of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingPanel::setCanvasWidth | ( | const s32 | width | ) | `[inline, virtual]`

Sets the width of the virtual canvas.

Parameters:

  | width | The width of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

void WoopsiUI::ScrollingPanel::setContentScrolled | ( | bool | scrolled | ) | `[inline]`

Set whether or not the content of the panel is scrolled. Content is anything drawn to the panel in the draw() method. This property is disabled by default, which will result in faster scrolling of child objects. If the panel contains no child objects, just draw() method content, consider using a SuperBitmap class instead.

Parameters:

  | scrolled | True to enable content scrolling; false to disable it.

## Member Data Documentation

bool WoopsiUI::ScrollingPanel::_allowHorizontalScroll`[protected]`

True if horizontal scrolling is allowed.

bool WoopsiUI::ScrollingPanel::_allowVerticalScroll`[protected]`

True if vertical scrolling is allowed.

s32 WoopsiUI::ScrollingPanel::_canvasHeight`[protected]`

Height of the virtual canvas.

s32 WoopsiUI::ScrollingPanel::_canvasWidth`[protected]`

Width of the virtual canvas.

s32 WoopsiUI::ScrollingPanel::_canvasX`[protected]`

X co-ordinate of the vitual canvas.

s32 WoopsiUI::ScrollingPanel::_canvasY`[protected]`

Y co-ordinate of the virtual canvas.

bool WoopsiUI::ScrollingPanel::_isContentScrolled`[protected]`

True if the content drawn to the panel is scrolled (ie. everything drawn in the draw() method); false if just child objects are scrolled.

The documentation for this class was generated from the following file:

- scrollingpanel.h