OptionsSelector Class Reference

#include <OptionsSelector.h>

Inheritance diagram for OptionsSelector:
ListenerObject

# Public Types

enum  OptionTypes
enum  OptionsAlignment

# Public Member Functions

void constructor (uint16 cols, uint16 rows, char *font, char *leftMark, char *rightMark)
void setColumnWidth (uint8 width)
void setMarkCharacters (char *leftMark, char *rightMark)
void setOptions (VirtualList options)
bool setSelectedOption (int32 optionIndex)
void selectNext ()
 Select the next option.
void selectPrevious ()
 Select the previous option.
int32 getSelectedOption ()
int32 getNumberOfOptions ()
void print (uint8 x, uint8 y, uint32 alignment, uint8 spacing)

# Protected Attributes

VirtualList pages
 List of pages, each being a VirtualLists of Options.
VirtualNode currentPage
 Current page's node.
VirtualNode currentOption
 Current option's node.
int32 totalOptions
 Total number of options.
int32 currentPageIndex
 Current page index.
int32 currentOptionIndex
int8 x
 Screen x coordinate where to print.
int8 y
 Screen y coordinate where to print.
int8 optionsLength
 The maximum length of all the options.
uint32 alignment
 Text alignement.
int8 spacing
 Text row spacing.
uint16 cols
 Number of columns per page.
uint16 rows
 Number of rows per page.
uint8 columnWidth
 Width of a column (in chars)
char * leftMark
 Left selection mark character.
char * rightMark
 Right selection mark character.
char * font
 Font to use for printing the options.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool onEvent (ListenerObject eventFirer, uint16 eventCode)
virtual bool handleMessage (Telegram telegram)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class Sprite

Inherits from VisualComponent

Implements a simple interactive menu.

Definition at line 82 of file OptionsSelector.h.

# Member Enumeration Documentation

# OptionsAlignment

Types of text alignments

Definition at line 66 of file OptionsSelector.h.

# OptionTypes

Types of Options

Definition at line 50 of file OptionsSelector.h.

# Member Function Documentation

# constructor()

void OptionsSelector::constructor ( uint16 cols,
uint16 rows,
char * font,
char * leftMark,
char * rightMark )

Class' constructor

Parameters
colsNumber of columns per page
rowsNumber of rows per page
fontFont to use for printing the options
leftMarkLeft selection mark character
rightMarkRight selection mark character

Definition at line 89 of file OptionsSelector.c.

# getNumberOfOptions()

int32 OptionsSelector::getNumberOfOptions ( )

Retrieve the total number of options.

Returns
The total number of options

Definition at line 340 of file OptionsSelector.c.

# getSelectedOption()

int32 OptionsSelector::getSelectedOption ( )

Retrieve the selected option's index.

Returns
Index of the selected option

Definition at line 333 of file OptionsSelector.c.

# print()

void OptionsSelector::print ( uint8 x,
uint8 y,
uint32 alignment,
uint8 spacing )

Print the options.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print
alignmentText alignment
spacingText spacing

Definition at line 347 of file OptionsSelector.c.

# selectNext()

void OptionsSelector::selectNext ( )

Select the next option.

Definition at line 227 of file OptionsSelector.c.

# selectPrevious()

void OptionsSelector::selectPrevious ( )

Select the previous option.

Definition at line 280 of file OptionsSelector.c.

# setColumnWidth()

void OptionsSelector::setColumnWidth ( uint8 width)

Set the maximum with of each column.

Parameters
widthColumns' with

Definition at line 125 of file OptionsSelector.c.

# setMarkCharacters()

void OptionsSelector::setMarkCharacters ( char * leftMark,
char * rightMark )

Set the markers characters.

Parameters
leftMarkLeft selection mark character
rightMarkRight selection mark character

Definition at line 140 of file OptionsSelector.c.

# setOptions()

void OptionsSelector::setOptions ( VirtualList options)

Set the available options.

Parameters
optionsList of options to set

Definition at line 148 of file OptionsSelector.c.

# setSelectedOption()

bool OptionsSelector::setSelectedOption ( int32 optionIndex)

Set the selection option.

Parameters
optionIndexIndex of the option to select

Definition at line 195 of file OptionsSelector.c.

# Member Data Documentation

# alignment

uint32 OptionsSelector::alignment
protected

Text alignement.

Definition at line 114 of file OptionsSelector.h.

# cols

uint16 OptionsSelector::cols
protected

Number of columns per page.

Definition at line 120 of file OptionsSelector.h.

# columnWidth

uint8 OptionsSelector::columnWidth
protected

Width of a column (in chars)

Definition at line 126 of file OptionsSelector.h.

# currentOption

VirtualNode OptionsSelector::currentOption
protected

Current option's node.

Definition at line 93 of file OptionsSelector.h.

# currentOptionIndex

int32 OptionsSelector::currentOptionIndex
protected

Definition at line 102 of file OptionsSelector.h.

# currentPage

VirtualNode OptionsSelector::currentPage
protected

Current page's node.

Definition at line 90 of file OptionsSelector.h.

# currentPageIndex

int32 OptionsSelector::currentPageIndex
protected

Current page index.

Definition at line 99 of file OptionsSelector.h.

# font

char* OptionsSelector::font
protected

Font to use for printing the options.

Definition at line 135 of file OptionsSelector.h.

# leftMark

char* OptionsSelector::leftMark
protected

Left selection mark character.

Definition at line 129 of file OptionsSelector.h.

# optionsLength

int8 OptionsSelector::optionsLength
protected

The maximum length of all the options.

Definition at line 111 of file OptionsSelector.h.

# pages

VirtualList OptionsSelector::pages
protected

List of pages, each being a VirtualLists of Options.

Definition at line 87 of file OptionsSelector.h.

# rightMark

char* OptionsSelector::rightMark
protected

Right selection mark character.

Definition at line 132 of file OptionsSelector.h.

# rows

uint16 OptionsSelector::rows
protected

Number of rows per page.

Definition at line 123 of file OptionsSelector.h.

# spacing

int8 OptionsSelector::spacing
protected

Text row spacing.

Definition at line 117 of file OptionsSelector.h.

# totalOptions

int32 OptionsSelector::totalOptions
protected

Total number of options.

Definition at line 96 of file OptionsSelector.h.

# x

int8 OptionsSelector::x
protected

Screen x coordinate where to print.

Definition at line 105 of file OptionsSelector.h.

# y

int8 OptionsSelector::y
protected

Screen y coordinate where to print.

Definition at line 108 of file OptionsSelector.h.


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