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

#include <libwoopsi/include/gadget.h>

Inheritance diagram for WoopsiUI::Gadget:
WoopsiUI::AnimButton WoopsiUI::BitmapButton WoopsiUI::Calendar WoopsiUI::ContextMenu WoopsiUI::FileListBox WoopsiUI::Gradient WoopsiUI::Label WoopsiUI::ProgressBar WoopsiUI::RadioButtonGroup WoopsiUI::Screen WoopsiUI::ScrollbarHorizontal WoopsiUI::ScrollbarPanel WoopsiUI::ScrollbarVertical WoopsiUI::ScrollingListBox WoopsiUI::ScrollingPanel WoopsiUI::ScrollingTextBox WoopsiUI::SliderHorizontal WoopsiUI::SliderHorizontalGrip WoopsiUI::SliderVertical WoopsiUI::SliderVerticalGrip WoopsiUI::SuperBitmap WoopsiUI::Window WoopsiUI::Woopsi WoopsiUI::WoopsiKeyboard WoopsiUI::WoopsiTimer

List of all members.

Classes

struct  Flags
struct  GadgetBorderSize
struct  NameValuePair

Public Member Functions

 Gadget (s16 x, s16 y, u16 width, u16 height, GadgetStyle *style=NULL)
const s16 getX () const
const s16 getY () const
const s16 getRelativeX () const
const s16 getRelativeY () const
const u32 getRefcon () const
const bool hasFocus () const
const bool isDeleted () const
const bool isDrawingEnabled () const
const bool isHidden () const
const bool isEnabled () const
const bool isDecoration () const
const bool isPermeable () const
const bool isDoubleClickable () const
const bool isBorderless () const
const bool isClicked () const
const bool isBeingDragged () const
const bool isShelved () const
const bool isModal () const
const bool canReceiveFocus () const
u16 getWidth () const
u16 getHeight () const
GadgetgetParent () const
GadgetgetFocusedGadget ()
virtual const u8 getPhysicalScreenNumber () const
const bool raisesEvents () const
virtual void getPreferredDimensions (Rect &rect) const
void getClientRect (Rect &rect) const
void getRectClippedToHierarchy (Rect &rect) const
GraphicsPortnewGraphicsPort (bool isForeground)
GraphicsPortnewGraphicsPort (Rect clipRect)
WoopsiArray< Rect > * getForegroundRegions ()
FontBasegetFont () const
FontBasegetGlyphFont () const
const u16 getBackColour () const
const u16 getShineColour () const
const u16 getHighlightColour () const
const u16 getShadowColour () const
const u16 getFillColour () const
const u16 getDarkColour () const
const u16 getTextColour () const
u32 setRefcon (u32 refcon)
virtual void setBorderless (bool isBorderless)
void setDecoration (bool isDecoration)
void setDraggable (const bool isDraggable)
void setPermeable (const bool isPermeable)
void setDoubleClickable (const bool isDoubleClickable)
void addGadgetEventHandler (GadgetEventHandler *eventHandler)
void removeGadgetEventHandler (GadgetEventHandler *eventHandler)
void setRaisesEvents (const bool raisesEvents)
void setBackColour (const u16 colour)
void setShineColour (const u16 colour)
void setHighlightColour (const u16 colour)
void setShadowColour (const u16 colour)
void setFillColour (const u16 colour)
void setDarkColour (const u16 colour)
void setTextColour (const u16 colour)
virtual void setFont (FontBase *font)
virtual void setGlyphFont (FontBase *font)
void redraw (const Rect &rect)
bool enable ()
bool disable ()
void close ()
bool shelve ()
bool unshelve ()
bool show ()
bool hide ()
bool click (s16 x, s16 y)
virtual bool isDoubleClick (s16 x, s16 y)
bool doubleClick (s16 x, s16 y)
bool shiftClick (s16 x, s16 y)
bool release (s16 x, s16 y)
bool drag (s16 x, s16 y, s16 vX, s16 vY)
bool keyPress (KeyCode keyCode)
bool keyRepeat (KeyCode keyCode)
bool keyRelease (KeyCode keyCode)
void lidClose ()
void lidOpen ()
bool focus ()
bool blur ()
bool moveTo (s16 x, s16 y)
bool resize (u16 width, u16 height)
bool changeDimensions (s16 x, s16 y, u16 width, u16 height)
bool raiseToTop ()
bool lowerToBottom ()
bool raiseGadgetToTop (Gadget *gadget)
bool lowerGadgetToBottom (Gadget *gadget)
void moveGadgetToDeleteQueue (Gadget *gadget)
bool moveGadgetToShelvedList (Gadget *gadget)
bool moveShelvedToGadgetList (Gadget *gadget)
void setFocusedGadget (Gadget *gadget)
bool checkCollision (s16 x, s16 y) const
bool checkCollision (s16 x, s16 y, u16 width, u16 height) const
bool checkCollision (const Gadget *gadget) const
bool checkCollision (const Rect &rect) const
void invalidateLowerGadgetsVisibleRectCache (Gadget *gadget)
void addGadget (Gadget *gadget)
void insertGadget (Gadget *gadget)
void setParent (Gadget *parent)
void cacheVisibleRects () const
void invalidateVisibleRectCache ()
void clipRectToHierarchy (Rect &rect) const
bool changeGadgetDepth (s32 sourceIndex, s32 destinationIndex)
s32 getLowestCollidingGadgetIndex (const Gadget *gadget) const
s32 getHighestCollidingGadgetIndex (const Gadget *gadget) const
virtual bool swapDepth ()
void destroy ()
bool remove ()
bool removeGadget (Gadget *gadget)
void addContextMenuItem (const WoopsiString &name, u32 value)
void showContextMenu (s16 x, s16 y)
virtual bool handleContextMenuSelection (const ListDataItem *item)
void goModal ()
void stopModal ()
const s32 getGadgetIndex (const Gadget *gadget) const
GadgetgetGadget (u32 index) const
const s32 getGadgetCount () const
const s32 getDecorationCount () const
RectCachegetRectCache () const
void setBorderSize (const GadgetBorderSize &borderSize)
void markRectsDamaged ()
void markRectDamaged (const Rect &rect)

Protected Member Functions

virtual ~Gadget ()
virtual void drawContents (GraphicsPort *port)
virtual void drawBorder (GraphicsPort *port)
bool checkCollisionWithForegroundRects (s16 x, s16 y) const
const s16 calculatePhysicalScreenY (s16 y) const
const u8 calculatePhysicalScreenNumber (s16 y) const
void closeGadget (Gadget *gadget)
void shelveGadget (Gadget *gadget)
GraphicsPortnewInternalGraphicsPort (Rect clipRect)
const s32 getHigherVisibleGadget (const s32 startIndex) const
const s32 getLowerVisibleGadget (const s32 startIndex) const
void startDragging (s16 x, s16 y)
void stopDragging (s16 x, s16 y)
 Gadget (const Gadget &gadget)
virtual void onClick (s16 x, s16 y)
virtual void onDoubleClick (s16 x, s16 y)
virtual void onShiftClick (s16 x, s16 y)
virtual void onRelease (s16 x, s16 y)
virtual void onReleaseOutside (s16 x, s16 y)
virtual void onDrag (s16 x, s16 y, s16 vX, s16 vY)
virtual void onDragStart ()
virtual void onDragStop ()
virtual void onKeyPress (KeyCode keyCode)
virtual void onKeyRelease (KeyCode keyCode)
virtual void onKeyRepeat (KeyCode keyCode)
virtual void onFocus ()
virtual void onBlur ()
virtual void onLidOpen ()
virtual void onLidClose ()
virtual void onEnable ()
virtual void onDisable ()
virtual void onResize (u16 width, u16 height)

Protected Attributes

Rect _rect
u32 _refcon
s16 _grabPointX
s16 _grabPointY
s16 _newX
s16 _newY
GadgetStyle _style
Flags _flags
GadgetEventHandlerList_gadgetEventHandlers
u32 _lastClickTime
s16 _lastClickX
s16 _lastClickY
s16 _doubleClickBounds
Gadget_parent
Gadget_focusedGadget
WoopsiArray< Gadget * > _gadgets
WoopsiArray< Gadget * > _shelvedGadgets
s32 _decorationCount
RectCache_rectCache
GadgetBorderSize _borderSize
WoopsiArray< NameValuePair_contextMenuItems

Detailed Description

Class providing all the basic functionality of a Woopsi gadget. All Woopsi gadgets must inherit from this class.


Constructor & Destructor Documentation

WoopsiUI::Gadget::Gadget ( 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. data. If no object is specified the gadget will use the default style.
See also:
GadgetFlagType.
virtual WoopsiUI::Gadget::~Gadget ( ) [protected, virtual]

Destructor.

WoopsiUI::Gadget::Gadget ( const Gadget gadget) [inline, protected]

Copy constructor is protected to prevent usage.


Member Function Documentation

void WoopsiUI::Gadget::addContextMenuItem ( const WoopsiString name,
u32  value 
)

Add a context menu item definition to the gadget.

Parameters:
nameThe name of the menu item.
valueThe value of the menu item.
void WoopsiUI::Gadget::addGadget ( Gadget gadget)

Adds a gadget to this gadget's child stack. The gadget is added to the top of the stack. Note that the gadget can only be added if it is not already a child of another gadget.

If the gadget is a decoration, the gadget will be inserted to the bottom of the stack instead of the top. Decorations are always at the bottom of the gadget stack. This is automatic and cannot be overridden.

Once a gadget has been added to another, it becomes the responsibility of Woopsi to delete it once it it no longer needed. Attempts to manually call "delete" on child gadgets will result in crashes due to dereferencing deleted objects.

Parameters:
gadgetA pointer to the gadget to add to the child list.
See also:
insertGadget()
remove()
void WoopsiUI::Gadget::addGadgetEventHandler ( GadgetEventHandler eventHandler) [inline]

Adds a gadget event handler. The event handler will receive all events raised by this gadget.

Parameters:
eventHandlerA pointer to the event handler.
bool WoopsiUI::Gadget::blur ( )

Remove focus from the gadget.

Returns:
True if the gadget lost focus correctly.
See also:
focus()
void WoopsiUI::Gadget::cacheVisibleRects ( ) const

Rebuild the list of this gadget's visible regions. If the cache is already up to date this function will just exit.

const u8 WoopsiUI::Gadget::calculatePhysicalScreenNumber ( s16  y) const [protected]

Get the current physical display number for the supplied y co-ordinate. Should be used in conjunction with calculatePhysicalScreenY() to convert to a y co-ordinate that can be displayed.

Parameters:
yThe y co-ordinate to check.
Returns:
0 if the co-ordinate falls within the bottom screen; 1 if it falls within the top screen.
See also:
calculatePhysicalScreenY()
const s16 WoopsiUI::Gadget::calculatePhysicalScreenY ( s16  y) const [protected]

Get the current physical display co-ordinate for the supplied y co-ordinate. Woopsi treats the two displays as two viewports on the same logical space. The lower half of the range of y co-ordinates is displayed on the bottom screen, whilst the upper half of the range of y co-ordinates is displayed on the top screen. This function converts back into a value that can be displayed on one of the screens. Should be used in conjunction with calculatePhysicalScreenNumber() to work out which screen to draw on.

Parameters:
yThe y co-ordinate to check.
Returns:
The converted y co-ordinate.
See also:
calculatePhysicalScreenNumber()
const bool WoopsiUI::Gadget::canReceiveFocus ( ) const

Check if the gadget can receive focus or not.

Returns:
True if the gadget can receive focus.
bool WoopsiUI::Gadget::changeDimensions ( s16  x,
s16  y,
u16  width,
u16  height 
)

Resize and move the gadget in one operation.

Parameters:
xThe new x co-ordinate.
yThe new y co-ordinate.
widthThe new width.
heightThe new height.
Returns:
True if the gadget was adjusted successfully.
bool WoopsiUI::Gadget::changeGadgetDepth ( s32  sourceIndex,
s32  destinationIndex 
)

Moves the the supplied child gadget from its current location in the child list to the new location.

Parameters:
sourceIndexThe current index of the child gadget.
destinationIndexThe new index for the child gadget.
Returns:
True if the swap was successful.
bool WoopsiUI::Gadget::checkCollision ( s16  x,
s16  y 
) const

Checks if the supplied co-ordinates collide with this gadget. Co-ordinates must be in Woopsi-space.

Parameters:
xThe x co-ordinate to check.
yThe y co-ordinate to check.
Returns:
True if a collision occurred.
bool WoopsiUI::Gadget::checkCollision ( s16  x,
s16  y,
u16  width,
u16  height 
) const

Checks if the supplied rectangle definition collides with this gadget. Co-ordinates must be in Woopsi-space.

Parameters:
xThe x co-ordinate of the rectangle to check.
yThe y co-ordinate of the rectangle to check.
widthThe width of the rectangle to check.
heightThe height of the rectangle to check.
Returns:
True if a collision occurred.
bool WoopsiUI::Gadget::checkCollision ( const Gadget gadget) const

Checks if the supplied gadget collides with this gadget.

Parameters:
gadgetA pointer to another gadget to check for collisions with.
Returns:
True if a collision occurred.
bool WoopsiUI::Gadget::checkCollision ( const Rect rect) const

Checks if the supplied rect collides with this gadget. Co-ordinates must be in Woopsi-space.

Parameters:
rectA rect to check for collisions with.
Returns:
True if a collision occurred.
bool WoopsiUI::Gadget::checkCollisionWithForegroundRects ( s16  x,
s16  y 
) const [protected]

Checks if the supplied co-ordinates collide with a portion of this gadget that is not obscured by its siblings or ancestors, but that may be obscured by its children. Co-ordinates should be in Woopsi-space.

Parameters:
xX co-ordinate of the click.
yY co-ordinate of the click.
Returns:
True if a collision occurred; false if not.
bool WoopsiUI::Gadget::click ( s16  x,
s16  y 
)

Click this gadget at the supplied co-ordinates.

Parameters:
xX co-ordinate of the click.
yY co-ordinate of the click.
Returns:
True if the click was successful.
void WoopsiUI::Gadget::clipRectToHierarchy ( Rect rect) const

Clips a rectangular region to the dimensions of this gadget and its ancestors.

Parameters:
rectThe region that needs to be clipped.
void WoopsiUI::Gadget::close ( )

Erases the gadget, marks it as deleted, and moves it to Woopsi's deletion queue. Gadgets are automatically deleted by the framework and should not be deleted externally.

void WoopsiUI::Gadget::closeGadget ( Gadget gadget) [protected]

Erase and remove the supplied child gadget from this gadget and send it to the deletion queue.

Parameters:
gadgetThe gadget to close.
See also:
close().
void WoopsiUI::Gadget::destroy ( ) [inline]

Delete this gadget. This should never be called in user code; gadget deletion is handled by Woopsi.

bool WoopsiUI::Gadget::disable ( )

Disabled the gadget.

Returns:
True if the gadget was disabled.
See also:
enable()
bool WoopsiUI::Gadget::doubleClick ( s16  x,
s16  y 
)

Double-click this gadget at the supplied co-ordinates.

Parameters:
xX co-ordinate of the click.
yY co-ordinate of the click.
Returns:
True if the click was successful.
bool WoopsiUI::Gadget::drag ( s16  x,
s16  y,
s16  vX,
s16  vY 
)

Drag the gadget to the supplied co-ordinates.

Parameters:
xThe x co-ordinate of the stylus.
yThe y co-ordinate of the stylus.
vXThe horizontal distance that the stylus was dragged.
vYThe vertical distance that the stylus was dragged.
Returns:
True if the drag was successful.
virtual void WoopsiUI::Gadget::drawBorder ( GraphicsPort port) [inline, protected, virtual]
virtual void WoopsiUI::Gadget::drawContents ( GraphicsPort port) [inline, protected, virtual]
bool WoopsiUI::Gadget::enable ( )

Enables the gadget.

Returns:
True if the gadget was enabled.
See also:
disable()
bool WoopsiUI::Gadget::focus ( )

Give the gadget focus.

Returns:
True if the gadget received focus correctly.
See also:
blur()
const u16 WoopsiUI::Gadget::getBackColour ( ) const [inline]

Gets the colour used as the background fill.

Returns:
Background fill colour.
void WoopsiUI::Gadget::getClientRect ( Rect rect) const

Insert the properties of the space within this gadget that is available for children into the rect passed in as a parameter. All co-ordinates are relative to this gadget.

Parameters:
rectReference to a rect to populate with data.
const u16 WoopsiUI::Gadget::getDarkColour ( ) const [inline]

Gets the colour used as the fill in scrollbar gutters.

Returns:
Dark colour.
const s32 WoopsiUI::Gadget::getDecorationCount ( ) const [inline]

Get the quantity of decoration gadgets.

Returns:
The number of decoration gadgets belonging to this gadget.
See also:
getGadgetCount()
const u16 WoopsiUI::Gadget::getFillColour ( ) const [inline]

Gets the colour used as the fill in unfocused window borders.

Returns:
Fill colour.
Gadget* WoopsiUI::Gadget::getFocusedGadget ( ) [inline]

Get a pointer to this gadget's focused child.

Returns:
This gadget's focused child.
FontBase* WoopsiUI::Gadget::getFont ( ) const

Gets a pointer to the gadget's font.

Returns:
A pointer to the gadget's font.
WoopsiArray<Rect>* WoopsiUI::Gadget::getForegroundRegions ( )

Gets a pointer to the vector of all of the visible regions of this gadget, including any covered by children.

Returns:
A pointer to a vector of all visible regions.
Gadget* WoopsiUI::Gadget::getGadget ( u32  index) const

Get the child gadget at the specified index.

Parameters:
indexIndex of the child to retrieve.
Returns:
Pointer to the child at the specified index.
const s32 WoopsiUI::Gadget::getGadgetCount ( ) const [inline]

Get the quantity of child gadgets, including decoration gadgets. The quantity of child gadgets not including decorations can be found by calling getChildCount() - getDecorationCount().

Returns:
The number of child gadgets belonging to this gadget.
See also:
getDecorationCount()
const s32 WoopsiUI::Gadget::getGadgetIndex ( const Gadget gadget) const

Get the index of the specified child gadget.

Parameters:
gadgetThe gadget to get the index of.
Returns:
The index of the gadget. -1 if the gadget is not found.
FontBase* WoopsiUI::Gadget::getGlyphFont ( ) const

Gets a pointer to the gadget's glyph font.

Returns:
A pointer to the gadget's glyph font.
u16 WoopsiUI::Gadget::getHeight ( ) const [inline]

Get the height of the gadget.

Returns:
The gadget height.
const s32 WoopsiUI::Gadget::getHigherVisibleGadget ( const s32  startIndex) const [protected]

Get the index of the next visible gadget higher up the z-order.

Parameters:
startIndexThe starting index.
Returns:
The index of the next highest visible gadget.
s32 WoopsiUI::Gadget::getHighestCollidingGadgetIndex ( const Gadget gadget) const

Gets the highest non-decoration gadget in the child list that collides with the specified gadget.

Parameters:
gadgetThe gadget to check for collisions.
Returns:
The index of the highest colliding gadget, or -1 if no gadgets collide with the specified gadget.
const u16 WoopsiUI::Gadget::getHighlightColour ( ) const [inline]

Gets the colour used as the fill in focused window borders.

Returns:
Highlight colour.
const s32 WoopsiUI::Gadget::getLowerVisibleGadget ( const s32  startIndex) const [protected]

Get the index of the next visible gadget lower down the z-order.

Parameters:
startIndexThe starting index.
Returns:
The index of the next lowest visible gadget.
s32 WoopsiUI::Gadget::getLowestCollidingGadgetIndex ( const Gadget gadget) const

Gets the lowest non-decoration gadget in the child list that collides with the specified gadget.

Parameters:
gadgetThe gadget to check for collisions.
Returns:
The index of the lowest colliding gadget, or -1 if no gadgets collide with the specified gadget.
Gadget* WoopsiUI::Gadget::getParent ( ) const [inline]

Get a pointer to this gadget's parent.

Returns:
This gadget's parent.
virtual const u8 WoopsiUI::Gadget::getPhysicalScreenNumber ( ) const [virtual]

Get the number of the screen that this gadget is currently displayed on.

Returns:
0 for the touch screen, 1 for the top screen.

Reimplemented in WoopsiUI::Screen.

virtual void WoopsiUI::Gadget::getPreferredDimensions ( Rect rect) const [virtual]

Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent.

Parameters:
rectReference to a rect to populate with data.

Reimplemented in WoopsiUI::AnimButton, WoopsiUI::BitmapButton, WoopsiUI::Calendar, WoopsiUI::ContextMenu, WoopsiUI::CycleButton, WoopsiUI::Label, WoopsiUI::ListBox, WoopsiUI::RadioButtonGroup, WoopsiUI::ScrollingListBox, and WoopsiUI::TextBox.

RectCache* WoopsiUI::Gadget::getRectCache ( ) const [inline]

Get a pointer to the cache of visible rects.

Returns:
A pointer to the cache of visible rects.
void WoopsiUI::Gadget::getRectClippedToHierarchy ( Rect rect) const

Clips the supplied rect to the boundaries defined by this gadget and this gadget's parents. Co-ordinates are in Woopsi-space.

Parameters:
rectReference to a rect to populate with data.
const u32 WoopsiUI::Gadget::getRefcon ( ) const [inline]

Get the reference constant for this gadget.

Returns:
The reference constant.
const s16 WoopsiUI::Gadget::getRelativeX ( ) const

Get the x co-ordinate of the gadget relative to its parent.

Returns:
Parent-space x co-ordinate.
const s16 WoopsiUI::Gadget::getRelativeY ( ) const

Get the y co-ordinate of the gadget relative to its parent.

Returns:
Parent-space y co-ordinate.
const u16 WoopsiUI::Gadget::getShadowColour ( ) const [inline]

Gets the colour used as the dark edge in bevelled boxes.

Returns:
Shadow colour.
const u16 WoopsiUI::Gadget::getShineColour ( ) const [inline]

Gets the colour used as the light edge in bevelled boxes.

Returns:
Shine colour.
const u16 WoopsiUI::Gadget::getTextColour ( ) const [inline]

Gets the colour used for text.

Returns:
Text colour. 0 indicates the font default will be used.
u16 WoopsiUI::Gadget::getWidth ( ) const [inline]

Get the width of the gadget.

Returns:
The gadget width.
const s16 WoopsiUI::Gadget::getX ( ) const

Get the x co-ordinate of the gadget in "Woopsi space".

Returns:
Woopsi space x co-ordinate.
const s16 WoopsiUI::Gadget::getY ( ) const

Get the y co-ordinate of the gadget in "Woopsi space".

Returns:
Woopsi space y co-ordinate.
void WoopsiUI::Gadget::goModal ( )

Run the gadget modally. All other gadgets will become non-responsive and only this gadget will be interactive. Useful for requesters that must be dealt with before the application can continue.

virtual bool WoopsiUI::Gadget::handleContextMenuSelection ( const ListDataItem item) [virtual]

Raises the context menu selection event to the gadget's event handlers.

Parameters:
itemThe selected menu item.
const bool WoopsiUI::Gadget::hasFocus ( ) const [inline]

Is the gadget active? A value of true indicates that this gadget has focus or is an ancestor of the gadget with focus.

Returns:
True if active.
bool WoopsiUI::Gadget::hide ( )

Erases the gadget and makes it invisible. Does not re-assign focus to another gadget.

Returns:
True if the gadget was hidden.
See also:
show()
void WoopsiUI::Gadget::insertGadget ( Gadget gadget)

Inserts a gadget into this gadget's child stack at the bottom of the stack. Note that the gadget can only be added if it is not already a child of another gadget.

Once a gadget has been added to another, it becomes the responsibility of Woopsi to delete it once it it no longer needed. Attempts to manually call "delete" on child gadgets will result in crashes due to dereferencing deleted objects.

Parameters:
gadgetA pointer to the gadget to add to the child list.
See also:
addGadget()
remove()
void WoopsiUI::Gadget::invalidateLowerGadgetsVisibleRectCache ( Gadget gadget)

Invalidate the visible region cache for all gadgets below the supplied gadget in this gadget's child stack. This will cause those gadgets to recalculate their visible regions next time they try to draw themselves. This should be called when the gadget passed as a pointer has swapped positions with another gadget in the gadget array (ie. it has moved towards the front of the screen or towards the back).

Parameters:
gadgetA pointer to a child gadget.
void WoopsiUI::Gadget::invalidateVisibleRectCache ( )

Mark this gadget's visible region cache as invalid, and do the same to its child gadgets.

const bool WoopsiUI::Gadget::isBeingDragged ( ) const [inline]

Is the gadget being dragged?

Returns:
True if the gadget is currently being dragged.
const bool WoopsiUI::Gadget::isBorderless ( ) const [inline]

Does the gadget have a border?

Returns:
True if the gadget does not have a border.
const bool WoopsiUI::Gadget::isClicked ( ) const [inline]

Is the gadget clicked?

Returns:
True if the gadget is currently clicked.
const bool WoopsiUI::Gadget::isDecoration ( ) const [inline]

Is the gadget a decoration? Decoration gadgets are children of, but also an essential component of, another gadget. They are always at the start of the child gadget array, so will always be at the bottom of the gadget stack. They can be thought of as background gadgets.

Returns:
True if the gadget is a decoration.
const bool WoopsiUI::Gadget::isDeleted ( ) const

Has the gadget been marked for deletion? This function recurses up the gadget hierarchy and only returns true if all of the gadgets in the ancestor chain are not deleted. Gadgets marked for deletion are automatically deleted and should not be interacted with.

Returns:
True if marked for deletion.
virtual bool WoopsiUI::Gadget::isDoubleClick ( s16  x,
s16  y 
) [virtual]

Check if the click is a double-click.

Parameters:
xX co-ordinate of the click.
yY co-ordinate of the click.
Returns:
True if the click is a double-click.

Reimplemented in WoopsiUI::ListBox.

const bool WoopsiUI::Gadget::isDoubleClickable ( ) const [inline]

Is the gadget double-clickable? If this is false, double-clicks will be detected and processed as single-clicks.

Returns:
True if the gadget watches for double-clicks.
const bool WoopsiUI::Gadget::isDrawingEnabled ( ) const

Is the gadget allowed to draw? This function recurses up the gadget hierarchy and only returns true if all of the gadgets in the ancestor chain are visible.

Returns:
True if drawing is enabled.
const bool WoopsiUI::Gadget::isEnabled ( ) const

Is the gadget enabled? This function recurses up the gadget hierarchy and only returns true if all of the gadgets in the ancestor chain are enabled.

Returns:
True if enabled.
const bool WoopsiUI::Gadget::isHidden ( ) const

Is the gadget hidden? This function recurses up the gadget hierarchy and returns true if any of the gadgets in the ancestor chain are hidden.

Returns:
True if hidden.
const bool WoopsiUI::Gadget::isModal ( ) const

Is the gadget modal? Only true if the Woopsi singleton is also modal.

Returns:
True if the gadget is modal.
const bool WoopsiUI::Gadget::isPermeable ( ) const [inline]

Are the gadget's edges permeable or solid? Permeable gadgets do not enforce their dimensions on the co-ordinates and dimensions of child gadgets. For example, windows belonging to non-permeable screens cannot be dragged outside the screen. Windows belonging to permeable screens *can* be dragged outside their parent screen.

Returns:
True if permeable.
const bool WoopsiUI::Gadget::isShelved ( ) const [inline]

Is the gadget shelved?

Returns:
True if the gadget is shelved.
bool WoopsiUI::Gadget::keyPress ( KeyCode  keyCode)

Send a keypress to the gadget.

Parameters:
keyCodeThe keycode to send to the gadget.
Returns:
True if the keypress was processed.
bool WoopsiUI::Gadget::keyRelease ( KeyCode  keyCode)

Send a key release to the gadget.

Parameters:
keyCodeThe keycode to send to the gadget.
Returns:
True if the key release was processed.
bool WoopsiUI::Gadget::keyRepeat ( KeyCode  keyCode)

Send a key repeat to the gadget.

Parameters:
keyCodeThe keycode to send to the gadget.
Returns:
True if the key repeat was processed.
void WoopsiUI::Gadget::lidClose ( )

Inform the gadget that the lid has closed.

See also:
lidOpened()
void WoopsiUI::Gadget::lidOpen ( )

Inform the gadget that the lid has opened.

See also:
lidClosed()
bool WoopsiUI::Gadget::lowerGadgetToBottom ( Gadget gadget)

Lowers the supplied gadget to the bottom of this gadget's child stack. The supplied gadget pointer must be a child of this gadget.

Parameters:
gadgetA pointer to the child gadget to lower.
Returns:
True if the lower was successful.
bool WoopsiUI::Gadget::lowerToBottom ( )

Lowers the gadget to the bottom of its parent's gadget stack.

Returns:
True if the lower was successful.
void WoopsiUI::Gadget::markRectDamaged ( const Rect rect)

Marks a particular rect for drawing. Can be called instead of markRectsDamaged() if only a portion of a gadget has changed. The rect is automatically clipped to the visible portions of the gadget. Its co-ordinates should be in gadget co-ordinates (ie. relative to the top-left corner of the gadget, which is (0,0)). It will automatically be converted to Woopsi co-ordinates.

Parameters:
rectRect to queue for redraw.
void WoopsiUI::Gadget::markRectsDamaged ( )

Marks all visible portions of the gadget for redrawing. Should be called when a gadget's appearance has changed.

void WoopsiUI::Gadget::moveGadgetToDeleteQueue ( Gadget gadget)

Moves the supplied child gadget to the deletion queue. For framework use only.

Parameters:
gadgetA pointer to the child gadget.
bool WoopsiUI::Gadget::moveGadgetToShelvedList ( Gadget gadget)

Moves the supplied child gadget to the shelved gadget list. For framework use only.

Parameters:
gadgetA pointer to the child gadget.
Returns:
True if the gadget was moved successfully.
See also:
moveShelvedToGadgetList()
hide()
bool WoopsiUI::Gadget::moveShelvedToGadgetList ( Gadget gadget)

Moves the supplied child gadget from the shelved list back to the child gadget list. For framework use only.

Parameters:
gadgetA pointer to the shelved gadget.
Returns:
True if the gadget was moved successfully.
See also:
moveGadgetToShelvedList()
show()
bool WoopsiUI::Gadget::moveTo ( s16  x,
s16  y 
)

Move the gadget to the new co-ordinates. Co-ordinates are relative to the parent gadget.

Parameters:
xThe new x co-ordinate.
yThe new y co-ordinate.
Returns:
True if the move was successful.
GraphicsPort* WoopsiUI::Gadget::newGraphicsPort ( Rect  clipRect)

Gets a pointer to a new instance of the GraphicsPort class to allow drawing within this gadget's client space. The GraphicsPort can only draw within the supplied region.

The GraphicsPort object must be deleted when it is no longer required. Drawing is clipped only to the supplied rect. If the rect is not within the visible regions of this gadget graphical anomalies will occur. This should only be called by the Woopsi hierarchy.

Parameters:
clipRectThe region to clip to. Co-ordinates are in Woopsi- space.
Returns:
A pointer to a new GraphicsPort object.
GraphicsPort* WoopsiUI::Gadget::newGraphicsPort ( bool  isForeground)

Gets a pointer to a new instance of the GraphicsPort class to allow drawing within this gadget's client space. The GraphicsPort object must be deleted when it is no longer required.

Parameters:
isForegroundTrue to use the foreground clipping list (draw over all space, including that overlapped by children) or background clipping list (not including that overlapped by children).
Returns:
A pointer to a new GraphicsPort object.
GraphicsPort* WoopsiUI::Gadget::newInternalGraphicsPort ( Rect  clipRect) [protected]

Get a graphics port that can draw within the region of the supplied clipping rect. The port must be deleted when it is no longer required.

Note that the clipping rect should be clipped to the gadget's visible region before creating the graphics port. The rect should be in Woopsi-space co-ordinates.

Returns:
A new graphics port object.
virtual void WoopsiUI::Gadget::onBlur ( ) [inline, protected, virtual]

Called when the gadget loses focus. Override this when creating new gadgets if the gadget should exhibit additional behaviour when losing focus.

Reimplemented in WoopsiUI::AmigaWindow, and WoopsiUI::TextBox.

virtual void WoopsiUI::Gadget::onClick ( s16  x,
s16  y 
) [inline, protected, virtual]

Called when the gadget is clicked. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is clicked.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.

Reimplemented in WoopsiUI::AmigaScreen, WoopsiUI::AmigaWindow, WoopsiUI::AnimButton, WoopsiUI::BitmapButton, WoopsiUI::Button, WoopsiUI::CheckBox, WoopsiUI::ListBox, WoopsiUI::MultiLineTextBox, WoopsiUI::RadioButton, WoopsiUI::ScrollingPanel, WoopsiUI::SliderHorizontal, WoopsiUI::SliderHorizontalGrip, WoopsiUI::SliderVertical, WoopsiUI::SliderVerticalGrip, WoopsiUI::SuperBitmap, and WoopsiUI::TextBox.

virtual void WoopsiUI::Gadget::onDisable ( ) [inline, protected, virtual]

Called when the gadget is disabled. Override this when creating new gadgets if the gadget should exhibit additional behaviour when disabled.

Reimplemented in WoopsiUI::AnimButton.

virtual void WoopsiUI::Gadget::onDoubleClick ( s16  x,
s16  y 
) [inline, protected, virtual]

Called when the gadget is double-clicked. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is double-clicked. To change the conditions that apply in detecting a double-click, override the isDoubleClicked() method.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.

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

virtual void WoopsiUI::Gadget::onDrag ( s16  x,
s16  y,
s16  vX,
s16  vY 
) [inline, protected, virtual]

Called when the gadget is dragged. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is dragged.

Parameters:
xThe x co-ordinate of the stylus.
yThe y co-ordinate of the stylus.
vXX distance dragged.
vYY distance dragged.

Reimplemented in WoopsiUI::Screen, WoopsiUI::ScrollingPanel, WoopsiUI::SliderHorizontalGrip, WoopsiUI::SliderVerticalGrip, WoopsiUI::SuperBitmap, and WoopsiUI::Window.

virtual void WoopsiUI::Gadget::onDragStart ( ) [inline, protected, virtual]

Called when the gadget starts being dragged. Override this when creating new gadgets if the gadget should exhibit additional behaviour when dragging starts.

Reimplemented in WoopsiUI::Window.

virtual void WoopsiUI::Gadget::onDragStop ( ) [inline, protected, virtual]

Called when the gadget stops being dragged. Override this when creating new gadgets if the gadget should exhibit additional behaviour when dragging stops.

Reimplemented in WoopsiUI::Window.

virtual void WoopsiUI::Gadget::onEnable ( ) [inline, protected, virtual]

Called when the gadget is enabled. Override this when creating new gadgets if the gadget should exhibit additional behaviour when enabled.

Reimplemented in WoopsiUI::AnimButton.

virtual void WoopsiUI::Gadget::onFocus ( ) [inline, protected, virtual]

Called when the gadget gains focus. Override this when creating new gadgets if the gadget should exhibit additional behaviour when gaining focus.

Reimplemented in WoopsiUI::AmigaWindow, WoopsiUI::DecorationGlyphButton, and WoopsiUI::Screen.

virtual void WoopsiUI::Gadget::onKeyPress ( KeyCode  keyCode) [inline, protected, virtual]

Called when the a key (d-pad or physical button) is pressed. Override this when creating new gadgets if the gadget should exhibit additional behaviour when a key is pressed.

Parameters:
keyCodeThe key that was pressed.

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

virtual void WoopsiUI::Gadget::onKeyRelease ( KeyCode  keyCode) [inline, protected, virtual]

Called when a key (d-pad or physical button) is released. Override this when creating new gadgets if the gadget should exhibit additional behaviour when a key is released.

Parameters:
keyCodeThe key that was released.
virtual void WoopsiUI::Gadget::onKeyRepeat ( KeyCode  keyCode) [inline, protected, virtual]

Called when a key (d-pad or physical button) is pressed and repeats. Override this when creating new gadgets if the gadget should exhibit additional behaviour when a key repeats.

Parameters:
keyCodeThe key that repeated.

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

virtual void WoopsiUI::Gadget::onLidClose ( ) [inline, protected, virtual]

Called when the lid is closed. Override this when creating new gadgets if the gadget should exhibit additional behaviour when the lid is closed.

virtual void WoopsiUI::Gadget::onLidOpen ( ) [inline, protected, virtual]

Called when the lid is opened. Override this when creating new gadgets if the gadget should exhibit additional behaviour when the lid is opened.

virtual void WoopsiUI::Gadget::onRelease ( s16  x,
s16  y 
) [inline, protected, virtual]

Called when the gadget is released. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is released.

Parameters:
xThe x co-ordinate of the stylus when released.
yThe y co-ordinate of the stylus when released.

Reimplemented in WoopsiUI::AnimButton, WoopsiUI::BitmapButton, WoopsiUI::Button, WoopsiUI::CycleButton, WoopsiUI::SliderHorizontalGrip, and WoopsiUI::SliderVerticalGrip.

virtual void WoopsiUI::Gadget::onReleaseOutside ( s16  x,
s16  y 
) [inline, protected, virtual]

Called when the gadget is released outside of its boundaries. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is released outside of its boundaries.

Parameters:
xThe x co-ordinate of the stylus when released.
yThe y co-ordinate of the stylus when released.

Reimplemented in WoopsiUI::AnimButton, WoopsiUI::BitmapButton, WoopsiUI::Button, WoopsiUI::CycleButton, WoopsiUI::SliderHorizontalGrip, and WoopsiUI::SliderVerticalGrip.

virtual void WoopsiUI::Gadget::onResize ( u16  width,
u16  height 
) [inline, protected, virtual]
virtual void WoopsiUI::Gadget::onShiftClick ( s16  x,
s16  y 
) [inline, protected, virtual]

Called when the gadget is shift-clicked. Override this when creating new gadgets if the gadget should exhibit additional behaviour when it is shift-clicked.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.
bool WoopsiUI::Gadget::raiseGadgetToTop ( Gadget gadget)

Raises the supplied gadget to the top of this gadget's child stack. The supplied gadget pointer must be a child of this gadget.

Parameters:
gadgetA pointer to the child gadget to raise.
Returns:
True if the raise was successful.
const bool WoopsiUI::Gadget::raisesEvents ( ) const [inline]

Check if this gadget raises events or not.

Returns:
True if events are enabled.
bool WoopsiUI::Gadget::raiseToTop ( )

Raises the gadget to the top of its parent's gadget stack.

Returns:
True if the raise was successful.
void WoopsiUI::Gadget::redraw ( const Rect rect)

Redraws the region of the gadget represented by rect. Rect should be supplied in Woopsi-space co-ordinates and should be pre-clipped to the visible regions of the gadget. This function should only ever be called by the DisplayController.

Parameters:
rectThe rect to draw.
bool WoopsiUI::Gadget::release ( s16  x,
s16  y 
)

Release this gadget at the supplied co-ordinates.

Parameters:
xX co-ordinate of the release.
yY co-ordinate of the release.
Returns:
True if the release was successful.
bool WoopsiUI::Gadget::remove ( )

Remove this gadget from Woopsi's gadget hierarchy. Returns responsibility for deleting the gadget back to the developer. Does not unregister the gadget from the VBL system.

Returns:
True if the gadget was successfully removed.
See also:
removeGadget()
bool WoopsiUI::Gadget::removeGadget ( Gadget gadget)

Remove a child gadget from Woopsi's gadget hierarchy. Returns responsibility for deleting the gadget back to the developer. Does not unregister the gadget from the VBL system.

Parameters:
gadgetPointer to the gadget to remove from the hierarchy.
Returns:
True if the gadget was succesfully removed.
See also:
remove()
void WoopsiUI::Gadget::removeGadgetEventHandler ( GadgetEventHandler eventHandler) [inline]

Remove a gadget event handler.

Parameters:
eventHandlerA pointer to the event handler to remove.
bool WoopsiUI::Gadget::resize ( u16  width,
u16  height 
)

Resize the gadget to the new dimensions.

Parameters:
widthThe new width.
heightThe new height.
Returns:
True if the resize was successful.
void WoopsiUI::Gadget::setBackColour ( const u16  colour) [inline]

Sets the background colour.

Parameters:
colourThe new background colour.
virtual void WoopsiUI::Gadget::setBorderless ( bool  isBorderless) [virtual]

Sets this gadget's border state.

Parameters:
isBorderlessThe border state.

Reimplemented in WoopsiUI::AmigaScreen, WoopsiUI::AmigaWindow, and WoopsiUI::Label.

void WoopsiUI::Gadget::setBorderSize ( const GadgetBorderSize borderSize)

Sets the border size. The border cannot be drawn over in the drawContents() method.

Parameters:
borderSizeThe new border size.
void WoopsiUI::Gadget::setDarkColour ( const u16  colour) [inline]

Sets the dark colour.

Parameters:
colourThe new dark colour.
void WoopsiUI::Gadget::setDecoration ( bool  isDecoration)

Sets this gadget as a decoration or otherwise.

Parameters:
isDecorationThe gadget's decoration state.
void WoopsiUI::Gadget::setDoubleClickable ( const bool  isDoubleClickable) [inline]

Sets whether or not the gadgets processes double-clicks.

Parameters:
isDoubleClickableThe double-clickable state.
void WoopsiUI::Gadget::setDraggable ( const bool  isDraggable) [inline]

Sets whether or not this gadget can be dragged.

Parameters:
isDraggableThe draggable state.
void WoopsiUI::Gadget::setFillColour ( const u16  colour) [inline]

Sets the fill colour.

Parameters:
colourThe new fill colour.
void WoopsiUI::Gadget::setFocusedGadget ( Gadget gadget)

Sets the supplied gadget as the focused child. The gadget must be a child of this gadget.

Parameters:
gadgetA pointer to the child gadget.
See also:
getFocusedGadget()
virtual void WoopsiUI::Gadget::setFont ( FontBase font) [virtual]

Sets the font.

Parameters:
fontA pointer to the font to use.

Reimplemented in WoopsiUI::Label, WoopsiUI::MultiLineTextBox, WoopsiUI::ScrollingListBox, and WoopsiUI::ScrollingTextBox.

virtual void WoopsiUI::Gadget::setGlyphFont ( FontBase font) [virtual]

Sets the glyph font.

Parameters:
fontA pointer to the font to use.
void WoopsiUI::Gadget::setHighlightColour ( const u16  colour) [inline]

Sets the highlight colour.

Parameters:
colourThe new highlight colour.
void WoopsiUI::Gadget::setParent ( Gadget parent) [inline]

Set the gadget's parent to the gadget passed in as a parameter. Called automatically when a gadget is added as a child. It shouldn't be called in user code.

Parameters:
parentA pointer to the parent gadget.
void WoopsiUI::Gadget::setPermeable ( const bool  isPermeable) [inline]

Sets whether or not child gadgets can exceed this gadget's dimensions.

Parameters:
isPermeableThe permeable state.
void WoopsiUI::Gadget::setRaisesEvents ( const bool  raisesEvents) [inline]

Enables or disables event firing for this gadget.

Parameters:
raisesEventsTrue to enable events, false to disable.
u32 WoopsiUI::Gadget::setRefcon ( u32  refcon)

Sets this gadget's reference constant. This should be unique, at least amongst this gadget's siblings.

Parameters:
refconThe reference constant.
void WoopsiUI::Gadget::setShadowColour ( const u16  colour) [inline]

Sets the shadow colour.

Parameters:
colourThe new shadow colour.
void WoopsiUI::Gadget::setShineColour ( const u16  colour) [inline]

Sets the shine colour.

Parameters:
colourThe new shine colour.
void WoopsiUI::Gadget::setTextColour ( const u16  colour) [inline]

Sets the text colour.

Parameters:
colourThe new text colour. 0 specifies the font default.
bool WoopsiUI::Gadget::shelve ( )

Erases the gadget, removes it from the main hierarchy and sets it to invisible. Gadgets hidden in this way will be partioned off from other gadgets and will no longer be processed.

Returns:
True if the gadget was shelved.
See also:
unshelve()
void WoopsiUI::Gadget::shelveGadget ( Gadget gadget) [protected]

Erase the supplied child gadget and move it out of the main child list into the shelved list. The gadget remains in memory and can be restored by calling "unshelve()" on the gadget.

Parameters:
gadgetThe gadget to hide.
See also:
shelve()
unshelve()
shelveGadget()
bool WoopsiUI::Gadget::shiftClick ( s16  x,
s16  y 
)

Shift-click this gadget at the supplied co-ordinates.

Parameters:
xX co-ordinate of the click.
yY co-ordinate of the click.
Returns:
True if the click was successful.
bool WoopsiUI::Gadget::show ( )

Draws the gadget and makes it visible. Does not steal focus from other gadgets.

Returns:
True if the gadget was shown.
See also:
hide()
void WoopsiUI::Gadget::showContextMenu ( s16  x,
s16  y 
)

Show the context menu for this gadget at the specified co-ordinates.

Parameters:
xThe x co-ordinate of the context menu, relative to the topmost screen on the bottom display.
yThe y co-ordinate of the context menu, relative to the topmost screen on the bottom display.
void WoopsiUI::Gadget::startDragging ( s16  x,
s16  y 
) [protected]

Notify this gadget that it is being dragged, and set its drag point.

Parameters:
xThe x co-ordinate of the drag position relative to this gadget.
yThe y co-ordinate of the drag position relative to this gadget.
void WoopsiUI::Gadget::stopDragging ( s16  x,
s16  y 
) [protected]

Notify this gadget that it is no longer being dragged.

Parameters:
xThe x co-ordinate at which dragging stopped.
yThe y co-ordinate at which dragging stopped.
void WoopsiUI::Gadget::stopModal ( ) [inline]

Stop the gadget running modally.

virtual bool WoopsiUI::Gadget::swapDepth ( ) [virtual]

Swap the depth of this gadget. Compares the gadget's depth with all non-decoration sibling gadgets that it overlaps. If it is not at the front of the overlapping pile, it is moved to the front. If it is at the front of the overlapping pile, it moves the gadget to the back of the pile.

Returns:
True if the swap was successful.
See also:
swapGadgetDepth()
bool WoopsiUI::Gadget::unshelve ( )

Moves the gadget back into the hierarchy and marks it for redraw. Gadgets shown in this way will be unpartioned and will be processed again.

Returns:
True if the gadget was unshelved.
See also:
shelve()

Member Data Documentation

Size of the gadget borders.

List of all context menu name/value pairs.

Total number of decoration child gadgets.

Area in which a click is assumed to be a double-click.

Flags struct.

Pointer to the child gadget that has focus.

List of event handlers.

List of child gadgets.

Physical space x co-ordinate where dragging began.

Physical space y co-ordinate where dragging began.

VBL count when last clicked.

X co-ordinate of last click.

Y co-ordinate of last click.

s16 WoopsiUI::Gadget::_newX [protected]

Physical x co-ordinate where gadget is being dragged to.

s16 WoopsiUI::Gadget::_newY [protected]

Physical y co-ordinate where gadget is being dragged to.

Pointer to the gadget's parent.

Rect describing the gadget.

List of the gadget's visible regions.

u32 WoopsiUI::Gadget::_refcon [protected]

Identifying number of the gadget.

List of shelved child gadgets.

All style information used by a gadget.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator