Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

# WoopsiUI::Woopsi Class Reference

`#include <woopsi.h>`

Inheritance diagram for WoopsiUI::Woopsi:

List of all members.

## Public Member Functions
| Woopsi (GadgetStyle *style=NULL)
virtual | ~Woopsi ()
void | goModal ()
virtual void | processOneVBL (Gadget *gadget=NULL)
virtual bool | swapGadgetDepth (Gadget *gadget)
virtual bool | flipScreens (Gadget *gadget)
ContextMenu * | getContextMenu ()
void | shelveContextMenu ()
virtual int | main (int argc, char *argv[])
void | setClickedGadget (Gadget *gadget)
Gadget * | getClickedGadget ()
void | showKeyboard (KeyboardEventHandler *opener)
void | hideKeyboard ()
DamagedRectManager * | getDamagedRectManager ()
## Static Public Member Functions
static void | registerForVBL (WoopsiTimer *timer)
static void | unregisterFromVBL (WoopsiTimer *timer)
static void | addToDeleteQueue (Gadget *gadget)
static u32 | getVBLCount ()
## Static Public Attributes
static Woopsi * | singleton
## Protected Member Functions
virtual void | startup ()=0
virtual void | shutdown ()
void | handleClick (s16 x, s16 y, Gadget *gadget)
void | handleShiftClick (s16 x, s16 y, Gadget *gadget)
void | processDeleteQueue ()
virtual void | handleStylus (Gadget *gadget)
virtual void | handleKeys ()
void | handleKey (bool newPress, bool released, s32 &heldTime, KeyCode keyCode)
virtual void | handleLid ()
virtual void | handleVBL ()
| Woopsi (const Woopsi &woopsi)
## Protected Attributes
bool | _lidClosed
ContextMenu * | _contextMenu
Gadget * | _clickedGadget
WoopsiKeyboardScreen * | _keyboardScreen
DamagedRectManager * | _damagedRectManager
## Static Protected Attributes
static WoopsiArray< WoopsiTimer * > | _vblListeners
static WoopsiArray< Gadget * > | _deleteQueue
static u32 | _vblCount

## Detailed Description

Class providing a top-level gadget and an interface to the Woopsi gadget hierarchy.

## Constructor & Destructor Documentation

WoopsiUI::Woopsi::Woopsi | ( | GadgetStyle * | style = `NULL` | ) |

Constructor.

Parameters:

  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::Woopsi::~Woopsi | ( |  | ) | `[virtual]`

Destructor.

WoopsiUI::Woopsi::Woopsi | ( | const Woopsi & | woopsi | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

static void WoopsiUI::Woopsi::addToDeleteQueue | ( | Gadget * | gadget | ) | `[static]`

Add a gadget to the list of gadgets to be deleted. Must never be called by anything other than the framework itself.

Parameters:

  gadget | The gadget to add to the delete queue.

virtual bool WoopsiUI::Woopsi::flipScreens | ( | Gadget * | gadget | ) | `[virtual]`

Flips the supplied gadget from its current screen to the other screen. This function presumes that all child gadgets are screens.

Parameters:

  gadget | The gadget (must be a screen) to flip.

Returns:
  True if the flip occurred.

Gadget* WoopsiUI::Woopsi::getClickedGadget | ( |  | ) | `[inline]`

Get the clicked gadget pointer.

Returns:
  Pointer to the clicked gadget.

ContextMenu* WoopsiUI::Woopsi::getContextMenu | ( |  | ) | `[inline]`

Get a pointer to the context menu.

Returns:
  Pointer to the context menu.

DamagedRectManager* WoopsiUI::Woopsi::getDamagedRectManager | ( |  | ) | `[inline]`

Get a pointer to the damaged rect manager.

Returns:
  A pointer to the damaged rect manager.

static u32 WoopsiUI::Woopsi::getVBLCount | ( |  | ) | `[inline, static]`

Return the number of VBLs that have occurred since Woopsi began running. The count will eventually overflow the 32-bit int and reset to 0. Developers must allow for this.

Returns:
  The VBL count.

void WoopsiUI::Woopsi::goModal | ( |  | ) |

Run the gadget modally. This will run the Woopsi application until stopModal() is called.

Reimplemented from WoopsiUI::Gadget.

void WoopsiUI::Woopsi::handleClick | ( | s16 | x,
|  | s16 | y,
|  | Gadget * | gadget
| ) |  | `[protected]`

Pass clicks to the gadget hierarchy. Closes the context menu if the clicked gadget is not the context menu. If a single gadget is supplied, only that gadget is sent the click. That gadget should be running modally.

Parameters:

  x | Stylus x co-ordinate.
  y | Stylus y co-ordinate.
  gadget | Pointer to a modally-running gadget or NULL.

void WoopsiUI::Woopsi::handleKey | ( | bool | newPress,
|  | bool | released,
|  | s32 & | heldTime,
|  | KeyCode | keyCode
| ) |  | `[protected]`

Processes a single keypad event and sends it throughout the hierarchy. Called by handleKeys().

Parameters:

  newPress | Indicates whether or not this is a new press.
  released | Indicates whether or not the keypad has been released.
  heldTime | The number of frames that the key has been held down.
  keyCode | The code of the button that has been pressed.

virtual void WoopsiUI::Woopsi::handleKeys | ( |  | ) | `[protected, virtual]`

Process keypad events and send throughout the hierarchy.

virtual void WoopsiUI::Woopsi::handleLid | ( |  | ) | `[protected, virtual]`

Process lid events and send throughout the hierarchy.

void WoopsiUI::Woopsi::handleShiftClick | ( | s16 | x,
|  | s16 | y,
|  | Gadget * | gadget
| ) |  | `[protected]`

Pass shift-clicks to the gadget hierarchy. If a single gadget is supplied, only that gadget is sent the click. That gadget should be running modally.

Parameters:

  x | Stylus x co-ordinate.
  y | Stylus y co-ordinate.
  gadget | Pointer to a modally-running gadget or NULL.

virtual void WoopsiUI::Woopsi::handleStylus | ( | Gadget * | gadget | ) | `[protected, virtual]`

Process stylus events and send throughout the hierarchy.

Parameters:

  gadget | Sub-gadget to process, used for modal gadgets; omit this parameter to run the whole system.

virtual void WoopsiUI::Woopsi::handleVBL | ( |  | ) | `[protected, virtual]`

Process VBLs and send to all registered gadgets.

void WoopsiUI::Woopsi::hideKeyboard | ( |  | ) |

Closes the keyboard screen. Flips the screen that was flipped to the top display by the call to showKeyboard() back down to the bottom display.

virtual int WoopsiUI::Woopsi::main | ( | int | argc,
|  | char * | argv[]
| ) |  | `[inline, virtual]`

Main entry point for a Woopsi application.

void WoopsiUI::Woopsi::processDeleteQueue | ( |  | ) | `[protected]`

Delete any gadgets in the deletion queue.

virtual void WoopsiUI::Woopsi::processOneVBL | ( | Gadget * | gadget = `NULL` | ) | `[virtual]`

Run all code that needs to take place once a frame. This should be called every VBL in order for Woopsi to work.

Parameters:

  gadget | Sub-gadget to run, used for modal gadgets; omit this parameter to run the whole system.

static void WoopsiUI::Woopsi::registerForVBL | ( | WoopsiTimer * | timer | ) | `[static]`

Add the supplied timer to the list of timers that receive VBL notifications. This is handled automatically by the WoopsiTimer constructor and should not be used in user code.

Parameters:

  timer | A pointer to the timer to add to the VBL list.

void WoopsiUI::Woopsi::setClickedGadget | ( | Gadget * | gadget | ) |

Set the clicked gadget pointer. Note that this should not be called by code other than within the Woopsi library itself.

Parameters:

  gadget | The new clicked gadget.

void WoopsiUI::Woopsi::shelveContextMenu | ( |  | ) |

Shelve the context menu. Hides it without destroying the object and without it remaining an active, but hidden, gadget.

void WoopsiUI::Woopsi::showKeyboard | ( | KeyboardEventHandler * | opener | ) |

Creates a keyboard screen. Opens it on the bottom display and flips the screen currently on the bottom display up to the top screen. Automatically sets opener to be an event handler of the keyboard.

Parameters:

  opener | The keyboard event handler that called the method.

virtual void WoopsiUI::Woopsi::shutdown | ( |  | ) | `[inline, protected, virtual]`

Shut down the application. All non-gadget objects should be deleted in an override of this function, and all hardware should be shut down, etc. This base method will shut down the SDL system, so it must be called as the last function if overridden in an SDL application. If you don't want to let Woopsi shut down SDL (if you have another chunk of code to run later, for example), you will need to shut down SDL yourself.

virtual void WoopsiUI::Woopsi::startup | ( |  | ) | `[protected, pure virtual]`

Initialise the application. All initial GUI creation, hardware setup, etc, should be done in an override of this method.

virtual bool WoopsiUI::Woopsi::swapGadgetDepth | ( | Gadget * | gadget | ) | `[virtual]`

Swaps the depth of the supplied gadget. This function presumes that all child gadgets are screens.

Parameters:

  gadget | The gadget to be depth-swapped.

Returns:
  True if the depth swap occurred.

Reimplemented from WoopsiUI::Gadget.

static void WoopsiUI::Woopsi::unregisterFromVBL | ( | WoopsiTimer * | timer | ) | `[static]`

Remove the supplied timer from the list of timers that receive VBL notifications. This is handled automatically by the WoopsiTimer destructor and should not be used in user code.

Parameters:

  timer | A pointer to the timer to remove from the VBL list.

## Member Data Documentation

Gadget* WoopsiUI::Woopsi::_clickedGadget`[protected]`

Pointer to the gadget that is clicked.

ContextMenu* WoopsiUI::Woopsi::_contextMenu`[protected]`

Pointer to the context menu.

DamagedRectManager* WoopsiUI::Woopsi::_damagedRectManager`[protected]`

Maintains damaged rect list and controls redraws.

WoopsiArray<Gadget*> WoopsiUI::Woopsi::_deleteQueue`[static, protected]`

Array of gadgets awaiting deletion.

WoopsiKeyboardScreen* WoopsiUI::Woopsi::_keyboardScreen`[protected]`

Screen containing the popup keyboard.

bool WoopsiUI::Woopsi::_lidClosed`[protected]`

Remembers the current state of the lid.

u32 WoopsiUI::Woopsi::_vblCount`[static, protected]`

Count of VBLs since Woopsi was first run.

WoopsiArray<WoopsiTimer*> WoopsiUI::Woopsi::_vblListeners`[static, protected]`

Array of timers that receive VBL events.

Woopsi* WoopsiUI::Woopsi::singleton`[static]`

The singleton provides an instance of Woopsi that should be instantiated and used as the only Woopsi instance. The Debug class in particular interacts with this singleton.

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

- woopsi.h