Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions | Protected Member Functions | Protected Attributes
WoopsiUI::ScrollingPanel Class Reference

#include <libwoopsi/include/scrollingpanel.h>

Inheritance diagram for WoopsiUI::ScrollingPanel:
WoopsiUI::Gadget WoopsiUI::ScrollableBase WoopsiUI::ListBox WoopsiUI::MultiLineTextBox

List of all members.

Public Member Functions

 ScrollingPanel (s16 x, s16 y, u16 width, u16 height, 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,
GadgetStyle style = NULL 
)

Constructor.

Parameters:
xThe x co-ordinate of the gadget.
yThe y co-ordinate of the gadget.
widthThe width of the gadget.
heightThe height of the gadget.
styleThe 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:
portThe 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:
clipRectThe 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:
portThe 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:
xThe new x co-ordinate of the scrolling region.
yThe 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:
xThe x co-ordinate of the click.
yThe 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:
xThe x co-ordinate of the stylus.
yThe y co-ordinate of the stylus.
vXThe horizontal drag distance.
vYThe 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:
dxThe horizontal distance to scroll.
dyThe 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:
dxThe horizontal distance to scroll.
dyThe vertical distance to scroll.
void WoopsiUI::ScrollingPanel::setAllowsHorizontalScroll ( bool  allow) [inline, virtual]

Set whether or not horizontal scrolling is allowed.

Parameters:
allowTrue 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:
allowTrue 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:
heightThe 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:
widthThe 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:
scrolledTrue to enable content scrolling; false to disable it.

Member Data Documentation

True if horizontal scrolling is allowed.

True if vertical scrolling is allowed.

Height of the virtual canvas.

Width of the virtual canvas.

X co-ordinate of the vitual canvas.

Y co-ordinate of the virtual canvas.

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:
 All Classes Functions Variables Enumerations Enumerator