WoopsiUI::Woopsi Class Reference
#include <woopsi.h>
List of all members.
Public Member Functions |
| Woopsi (FontBase *font=NULL) |
virtual | ~Woopsi () |
virtual void | startup () |
void | goModal () |
virtual void | shutdown () |
virtual void | processOneVBL (Gadget *gadget=NULL) |
virtual void | draw (Rect clipRect) |
virtual bool | click (s16 x, s16 y) |
virtual bool | shiftClick (s16 x, s16 y) |
virtual bool | release (s16 x, s16 y) |
virtual bool | drag (s16 x, s16 y, s16 vX, s16 vY) |
virtual bool | swapGadgetDepth (Gadget *gadget) |
virtual bool | flipScreens (Gadget *gadget) |
virtual void | eraseRect (Rect rect) |
ContextMenu * | getContextMenu () |
void | shelveContextMenu () |
virtual int | main (int argc, char *argv[]) |
void | setClickedGadget (Gadget *gadget) |
Gadget * | getClickedGadget () |
Static Public Member Functions |
static FontBase * | getSystemFont () |
static void | registerForVBL (WoopsiTimer *timer) |
static void | unregisterFromVBL (WoopsiTimer *timer) |
static void | addToDeleteQueue (Gadget *gadget) |
static u32 | getVBLCount () |
Static Public Attributes |
static Woopsi * | singleton = NULL |
Protected Member Functions |
virtual void | closeChild (Gadget *gadget) |
virtual void | shelveChild (Gadget *gadget) |
void | processDeleteQueue () |
virtual void | handleStylus (Gadget *gadget) |
virtual void | handleKeys () |
virtual void | handleLid () |
virtual void | handleVBL () |
virtual bool | click (s16 x, s16 y, Gadget *gadget) |
virtual bool | shiftClick (s16 x, s16 y, Gadget *gadget) |
| Woopsi (const Woopsi &woopsi) |
Static Protected Member Functions |
static void | deleteSystemFont () |
Protected Attributes |
bool | _lidClosed |
ContextMenu * | _contextMenu |
Gadget * | _clickedGadget |
Static Protected Attributes |
static WoopsiArray< WoopsiTimer * > | _vblListeners |
static WoopsiArray< Gadget * > | _deleteQueue |
static FontBase * | _systemFont = NULL |
static u32 | _vblCount = 0 |
Detailed Description
Class providing a top-level gadget and an interface to the Woopsi gadget hierarchy.
Constructor & Destructor Documentation
Woopsi::Woopsi |
( |
FontBase * |
font = NULL |
) |
|
Constructor.
- Parameters:
-
| font | Pointer to a font object for use within this class. |
Woopsi::~Woopsi |
( |
|
) |
[virtual] |
WoopsiUI::Woopsi::Woopsi |
( |
const Woopsi & |
woopsi |
) |
[inline, protected] |
Copy constructor is protected to prevent usage.
Member Function Documentation
void 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. |
bool Woopsi::click |
( |
s16 |
x, |
|
|
s16 |
y, |
|
|
Gadget * |
gadget | |
|
) |
| | [protected, virtual] |
Click the specified gadget at the supplied co-ordinates.
- Parameters:
-
| x | X co-ordinate of the click. |
| y | Y co-ordinate of the click. |
| gadget | Pointer to the gadget to click. |
- Returns:
- True if the click was successful.
bool Woopsi::click |
( |
s16 |
x, |
|
|
s16 |
y | |
|
) |
| | [virtual] |
Receive stylus clicks and process them.
- Parameters:
-
| x | The x co-ordinate of the click. |
| y | The y co-ordinate of the click. |
- Returns:
- True if clicked.
Reimplemented from WoopsiUI::Gadget.
void Woopsi::closeChild |
( |
Gadget * |
gadget |
) |
[protected, virtual] |
Closes a child gadget.
- Parameters:
-
| gadget | The child gadget to close. |
void Woopsi::deleteSystemFont |
( |
|
) |
[static, protected] |
bool Woopsi::drag |
( |
s16 |
x, |
|
|
s16 |
y, |
|
|
s16 |
vX, |
|
|
s16 |
vY | |
|
) |
| | [virtual] |
Receive stylus drags and process them.
- Parameters:
-
| x | The current x co-ordinate of the stylus. |
| y | The current y co-ordinate of the stylus. |
| vX | The horizontal distance dragged. |
| vY | The vertical distance dragged. |
- Returns:
- True if dragged.
Reimplemented from WoopsiUI::Gadget.
Draw a specific rectangle of the GUI. The supplied region will be drawn with no further clipping checks. For use only within Woopsi gadgets.
- Parameters:
-
| clipRect | The region to draw. |
Reimplemented from WoopsiUI::Gadget.
void Woopsi::eraseRect |
( |
Rect |
rect |
) |
[virtual] |
Redraws any dirty regions within the supplied region.
- Parameters:
-
| rect | The region to redraw |
bool Woopsi::flipScreens |
( |
Gadget * |
gadget |
) |
[virtual] |
Flips the supplied gadget from its current screen to the other screen. This functions 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.
FontBase * Woopsi::getSystemFont |
( |
|
) |
[static] |
Get a pointer to the system font.
- Returns:
- A pointer to the system font.
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 Woopsi::handleKeys |
( |
|
) |
[protected, virtual] |
Process keypad events and send throughout the hierarchy.
void Woopsi::handleLid |
( |
|
) |
[protected, virtual] |
Process lid events and send throughout the hierarchy.
void 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. |
void Woopsi::handleVBL |
( |
|
) |
[protected, virtual] |
Process VBLs and send to all registered gadgets.
virtual int WoopsiUI::Woopsi::main |
( |
int |
argc, |
|
|
char * |
argv[] | |
|
) |
| | [inline, virtual] |
Main entry point for a Woopsi application.
void Woopsi::processDeleteQueue |
( |
|
) |
[protected] |
Delete any gadgets in the deletion queue.
void 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. |
void 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. |
bool Woopsi::release |
( |
s16 |
x, |
|
|
s16 |
y | |
|
) |
| | [virtual] |
Receive stylus releases and process them.
- Parameters:
-
| x | The x co-ordinate of the release. |
| y | The y co-ordinate of the release. |
- Returns:
- True if released.
Reimplemented from WoopsiUI::Gadget.
void WoopsiUI::Woopsi::setClickedGadget |
( |
Gadget * |
gadget |
) |
[inline] |
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 Woopsi::shelveChild |
( |
Gadget * |
gadget |
) |
[protected, virtual] |
Shelves a child gadget.
- Parameters:
-
| gadget | The child gadget to shelve. |
void Woopsi::shelveContextMenu |
( |
|
) |
|
Shelve the context menu. Hides it without destroying the object and without it remaining an active, but hidden, gadget.
bool Woopsi::shiftClick |
( |
s16 |
x, |
|
|
s16 |
y, |
|
|
Gadget * |
gadget | |
|
) |
| | [protected, virtual] |
Shift-click this gadget at the supplied co-ordinates.
- Parameters:
-
| x | X co-ordinate of the click. |
| y | Y co-ordinate of the click. |
| gadget | Pointer to the gadget to click. |
- Returns:
- True if the click was successful.
bool Woopsi::shiftClick |
( |
s16 |
x, |
|
|
s16 |
y | |
|
) |
| | [virtual] |
Receive stylus shift clicks and process them.
- Parameters:
-
| x | The x co-ordinate of the click. |
| y | The y co-ordinate of the click. |
- Returns:
- True if clicked.
Reimplemented from WoopsiUI::Gadget.
virtual void WoopsiUI::Woopsi::shutdown |
( |
|
) |
[inline, 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 |
( |
|
) |
[inline, virtual] |
Initialise the application. All initial GUI creation, hardware setup, etc, should be done in an override of this method. The base method should be called as the first instruction in the overridden function. This method must call enableDrawing() and draw() at some point or nothing will be visible.
bool 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.
void 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
Pointer to the gadget that is clicked
Pointer to the context menu
Array of gadgets awaiting deletion
Remembers the current state of the lid
Pointer to the default font
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 files:
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/woopsi.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/woopsi.cpp