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

#include <libwoopsi/include/woopsi.h>

Inheritance diagram for WoopsiUI::Woopsi:
WoopsiUI::Gadget

List of all members.

Public Member Functions

 Woopsi (GadgetStyle *style=NULL)
virtual ~Woopsi ()
virtual void processOneVBL (Gadget *gadget=NULL)
virtual bool flipScreens (Gadget *gadget)
void registerForVBL (WoopsiTimer *timer)
void unregisterFromVBL (WoopsiTimer *timer)
void addToDeleteQueue (Gadget *gadget)
u32 getVBLCount ()
ContextMenugetContextMenu ()
void shelveContextMenu ()
virtual int main (int argc, char *argv[])
void setClickedGadget (Gadget *gadget)
GadgetgetClickedGadget ()
void showKeyboard (KeyboardEventHandler *opener)
void hideKeyboard ()
DamagedRectManagergetDamagedRectManager ()

Static Public Attributes

static Woopsisingleton

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
WoopsiArray< WoopsiTimer * > _vblListeners
WoopsiArray< Gadget * > _deleteQueue
u32 _vblCount
ContextMenu_contextMenu
Gadget_clickedGadget
WoopsiKeyboardScreen_keyboardScreen
DamagedRectManager_damagedRectManager

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

Destructor.

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

Copy constructor is protected to prevent usage.


Member Function Documentation

void WoopsiUI::Woopsi::addToDeleteQueue ( Gadget gadget)

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

Parameters:
gadgetThe 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:
gadgetThe 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.
u32 WoopsiUI::Woopsi::getVBLCount ( ) [inline]

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::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:
xStylus x co-ordinate.
yStylus y co-ordinate.
gadgetPointer 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:
newPressIndicates whether or not this is a new press.
releasedIndicates whether or not the keypad has been released.
heldTimeThe number of frames that the key has been held down.
keyCodeThe 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:
xStylus x co-ordinate.
yStylus y co-ordinate.
gadgetPointer 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:
gadgetSub-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:
gadgetSub-gadget to run, used for modal gadgets; omit this parameter to run the whole system.
void WoopsiUI::Woopsi::registerForVBL ( WoopsiTimer timer)

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:
timerA 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:
gadgetThe 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:
openerThe 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.

void WoopsiUI::Woopsi::unregisterFromVBL ( WoopsiTimer timer)

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:
timerA pointer to the timer to remove from the VBL list.

Member Data Documentation

Pointer to the gadget that is clicked.

Pointer to the context menu.

Maintains damaged rect list and controls redraws.

Array of gadgets awaiting deletion.

Screen containing the popup keyboard.

bool WoopsiUI::Woopsi::_lidClosed [protected]

Remembers the current state of the lid.

u32 WoopsiUI::Woopsi::_vblCount [protected]

Count of VBLs since Woopsi was first run.

Array of timers that receive VBL events.

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