Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

CUIListBox Class Reference

Abstract List Box class. More...

#include <CUIListBox.h>

Inheritance diagram for CUIListBox:

CUIWidgetGroup MUIWidget CUICheckListBox CUIRadioButtonListBox CUIStringListBox List of all members.

Public Types

enum  EListBoxOptions { KTransparentDraw = 0x01, KConstItemHeight = 0x02, KDefaultOptions = KTransparentDraw | KConstItemHeight }
 ListBox behavior options. More...


Public Member Functions

 CUIListBox (const CUIRect &aRectangle, const char *aTitle, MUIWidgetEvents *aObserver)
 Constructs the CUIListBox class.

virtual void Draw ()
 Draws this widget on the virtual screen.

virtual bool HandlePenEvent (MInputReader::TTouchEventData &aData)
 Reacts on touch screen event.

virtual bool HandleKeyEvent (MInputReader::TKeyEventData &aData)
 Reacts on keyboard or remote control input event.

virtual bool SetActive (bool aActive)
 Changes the iActive property of this widget.

virtual void RestoreBackground (CUIRect &aRect)
 Redraws the background in given rectangle.

virtual unsigned int GetItemsNumber ()=0
 Returns the number of items in the ListBox.

virtual unsigned int GetItemHeight (unsigned int aItemIndex)=0
 Returns the height of item with given index.

virtual void DrawItem (unsigned int aItemIndex, CUIRect &aRect)=0
 Draws specified item in a given rectangle.

void CalculateParameters ()
 Calculates basic list parameters such as number of items per pare, etc.


Public Attributes

unsigned int iNrItemsPerPage
unsigned int iPage
int iSelected
EListBoxOptions iOptions

Detailed Description

Abstract List Box class.

List Box is a control that can show a number of items (strings or other widgets) in a separate window on the screen. It is not necessary that all items are always visible the controls also shows scrolling bars allowing the user to scroll among its items.

CUIListBox implements basic drawing, control management and events constumption mechanism. Derived classes should implement its abstract methods in order to be instantiated. See GetItemsNumber(), GetItemHeight() and DrawItem()


Member Enumeration Documentation

enum CUIListBox::EListBoxOptions
 

ListBox behavior options.

Enumeration values:
KTransparentDraw  Draws the control transparently over its owner
KConstItemHeight  Instructs the List Box that all its items have the same height. Variable item height is not implemented right now


Constructor & Destructor Documentation

CUIListBox::CUIListBox const CUIRect aRectangle,
const char *  aTitle,
MUIWidgetEvents *  aObserver
 

Constructs the CUIListBox class.

Parameters:
aRectangle Control position and size
aTitle Title, can be NULL
aObserver Observer for events, can be NULL


Member Function Documentation

void CUIListBox::CalculateParameters  ) 
 

Calculates basic list parameters such as number of items per pare, etc.

Should be called in the constructor of derived class. Calls GetItemHeight(0) See also GetItemHeight()

virtual void CUIListBox::Draw  )  [virtual]
 

Draws this widget on the virtual screen.

The library does not provide any clipping mechanism, so the widget is completely responsible for drawing in its iRectangle. If the widget should be drawn fully or partially transparently over its iParent, it should call iParent->RestoreBackground() for every transparent region

Reimplemented from CUIWidgetGroup.

virtual unsigned int CUIListBox::GetItemHeight unsigned int  aItemIndex  )  [pure virtual]
 

Returns the height of item with given index.

If KConstItemHeight is among the iOptions only GetItemHeight(0) is called by the CUIListBox. GetItemHeight( 0 ) is also called from the CalculateParameters() so the derived class must be ready to return a correct value even if the ListBox contains no items yet.

Implemented in CUIStringListBox, CUIRadioButtonListBox, and CUICheckListBox.

virtual bool CUIListBox::HandleKeyEvent MInputReader::TKeyEventData aData  )  [virtual]
 

Reacts on keyboard or remote control input event.

It is permitted to re-draw this or other widgets as a response on this event. In this case the CUIEventLoop flushes the virtual screen automatically to ensure that it is displayed. In some cases it's necessary to completely re-draw the whole screen. If it's needed, the handling code should set CUIEventLoop::GetEventLoop().iForceFullRedraw to true.

Warning:
The full screen redraw could be very time consuming and should be used carefully

Reimplemented from CUIWidgetGroup.

virtual bool CUIListBox::HandlePenEvent MInputReader::TTouchEventData aData  )  [virtual]
 

Reacts on touch screen event.

Returns true if the event was consumed.

It is permitted to re-draw this or other widgets as a response on this event. In this case the CUIEventLoop flushes the virtual screen automatically to ensure that it is displayed. In some cases it's necessary to completely re-draw the whole screen. If it's needed, the handling code should set CUIEventLoop::GetEventLoop().iForceFullRedraw to true. Note that because of nature of the touchscreen, the widget could receive PenUp event (aData.iPressure == 0) with the aData.iX and aData.iY pointing outside of iRectangle of this widget. In this case the widget should not react for such an event or perform necessary cleanup if it has reacted on PenDown event (aData.iPressure != 0 ).

Warning:
The full screen redraw could be very time consuming and should be used carefully

Reimplemented from CUIWidgetGroup.

virtual void CUIListBox::RestoreBackground CUIRect aRect  )  [virtual]
 

Redraws the background in given rectangle.

This method is used by transparent children that need to redraw itself. Full screen redraw is very expensive and much oftet it's only needed to redraw a small screen part

Parameters:
aRect CUIRect to redraw

Implements CUIWidgetGroup.

virtual bool CUIListBox::SetActive bool  aActive  )  [virtual]
 

Changes the iActive property of this widget.

Returns true if the state was changed

Active widgets may Draw themselves with differently and they receive keyboard and remote control events. Only one visible widget could be active at a time.

Reimplemented from MUIWidget.


Member Data Documentation

unsigned int CUIListBox::iNrItemsPerPage
 

Number of items per page

EListBoxOptions CUIListBox::iOptions
 

ListBox options

unsigned int CUIListBox::iPage
 

Currently active page number

int CUIListBox::iSelected
 

Index of selected item, -1 when no item is selected


The documentation for this class was generated from the following file:
Generated on Mon Dec 18 18:57:25 2006 for TomTom GO User Interface library by doxygen 1.3.5