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

MUIWidget Class Reference

Base class for all visible widgets. More...

#include <MUIWidget.h>

Inheritance diagram for MUIWidget:

CUIButton CUICheckBox CUIInput CUILabel CUIRadioButton CUISlider CUIWidgetGroup CUIBitmapButton CUIBitmap CUIListBox CUIScreen CUICheckListBox CUIRadioButtonListBox CUIStringListBox List of all members.

Public Types

typedef unsigned int EDrawTextOptions
enum  { KRoundRadius = 4 }
 Default radius for rounding the boxes.

enum  EDrawTextOption { KCenterX = 0x01, KCenterY = 0x02, KMultiLine = 0x04, KSplitString = 0x08 }
 Possible options for DrawTextEx() method. More...


Public Member Functions

 MUIWidget (const CUIRect &aRectangle, const char *aTitle, MUIWidgetEvents *aObserver)
 Basic constructor for all widgets.

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

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

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

virtual void SetTitle (const char *aTitle)
 Sets the title of this widget.

virtual void SetColorScheme (MColorScheme *aColorScheme)
 Sets the custom color scheme for this widget.

virtual void SetFont (MFont *aFont)
 Sets the custom font for this widget.

virtual bool SetEnabled (bool aEnabled)
 Changes widget's enabled state. Keyboard and touchscreen events are not sent to disabled widgets.

virtual void SetToolTip (const char *aToolTip)
 Sets the tooltip for this widget.

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

virtual bool IsVisible ()
 Returns true if the widget is visible.

bool DrawText (const char *aText, const CUIPoint &aPoint, CDesktop::TColor aColor)
 Draws given text with current font.

bool DrawTextCentered (const char *aText, const CUIRect &aRect, CDesktop::TColor aColor, EDrawTextOptions aOptions)
 Draws given text in given rectangle with current and centers the output in given rectangle.

bool DrawTextEx (const char *aText, const CUIRect &aRect, CDesktop::TColor aColor, EDrawTextOptions aOptions)
 Draws given text in given rectangle with current font using supplied drawing mode.

MFontGetFont () const
 Returns the pointer to MFont to draw this widget with. Returned pointer should not be deleted.

MColorSchemeGetColorScheme () const
 Returns the pointer to MColorScheme to draw this widget with. Returned pointer should not be deleted.


Public Attributes

CUIRect iRectangle
MColorScheme const * iColorScheme
MUIWidgetEventsiObserver
const char * iTitle
EDrawTextOptions iTitleOptions
MFont const * iFont
bool iEnabled
const char * iToolTip
bool iActive
MUISkin::EFontType iSkinFontType
int iTag
MVirtualScreeniFrameBuffer
CUIWidgetGroupiParent

Detailed Description

Base class for all visible widgets.

This class defines the base interface and behavior for all visual widgets

All other standard visible widgets and custom user widgets should be derived from this class To crate a custom widget, the user should at least overload abstract methods of this class in his derived classes. See Examples directory for an example implementation of CUIButton.


Member Typedef Documentation

typedef unsigned int MUIWidget::EDrawTextOptions
 

Option set for DrawTextEx


Member Enumeration Documentation

enum MUIWidget::EDrawTextOption
 

Possible options for DrawTextEx() method.

Enumeration values:
KCenterX  Centers given text horizontally
KCenterY  Centers given text vertically,
Note:
Has no effect if KMultiLine or KSplitString option is specified
KMultiLine  Splits the given text into multiple lines at
character position. This option does not perform clipping
KSplitString  KMultiLine + splits the given string into lines and performs clipping so it always fit the given bounding rectangle


Constructor & Destructor Documentation

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

Basic constructor for all widgets.

Parameters:
aRectangle Absolute widget position and size
aTitle Widget title
aObserver An optional observer for widget events
Note that some widgets do require their title or observer to be set. If their constructors are called with NULL as parameters for those required values, the library will generate an assert and the application will terminate


Member Function Documentation

virtual void MUIWidget::Draw  )  [pure 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

Implemented in CUIBitmap, CUIBitmapButton, CUIButton, CUICheckBox, CUIInput, CUILabel, CUIListBox, CUIRadioButton, CUIScreen, CUISlider, and CUIWidgetGroup.

bool MUIWidget::DrawText const char *  aText,
const CUIPoint aPoint,
CDesktop::TColor  aColor
 

Draws given text with current font.

This method does not split the text into multiple lines. It returns true if all characters were rendered successfully.

Parameters:
aText A text to draw
aPoint Drawing position
aColor Text color

bool MUIWidget::DrawTextCentered const char *  aText,
const CUIRect aRect,
CDesktop::TColor  aColor,
EDrawTextOptions  aOptions
 

Draws given text in given rectangle with current and centers the output in given rectangle.

This method does not split the text into multiple lines nor performs cropping. It returns true if all characters were rendered successfully.

Parameters:
aText A text to draw
aRect Cropping rectangle
aColor Text color
aOptions Drawing options, can be only KCenterX or KCenterY

bool MUIWidget::DrawTextEx const char *  aText,
const CUIRect aRect,
CDesktop::TColor  aColor,
EDrawTextOptions  aOptions
 

Draws given text in given rectangle with current font using supplied drawing mode.

Depending from given option set, this method splits the text into multiple lines or performs cropping. It returns true if all characters were rendered successfully. To draw an empty line, use the construction like this: "\n \n"

Parameters:
aText A text to draw
aRect Cropping rectangle
aColor Text color
aOptions Drawing options
Warning:
DrawTextEx() method takes more time to execute than other text drawing methods. So if you know that your string does not contain line break characters or fits completely into the rectangle, use DrawText() or DrawTextCentered()

virtual bool MUIWidget::HandleKeyEvent MInputReader::TKeyEventData aData  )  [pure 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

Implemented in CUIButton, CUICheckBox, CUIInput, CUILabel, CUIListBox, CUIRadioButton, CUISlider, and CUIWidgetGroup.

virtual bool MUIWidget::HandlePenEvent MInputReader::TTouchEventData aData  )  [pure 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

Implemented in CUIButton, CUICheckBox, CUIInput, CUILabel, CUIListBox, CUIRadioButton, CUISlider, and CUIWidgetGroup.

virtual bool MUIWidget::IsVisible  )  [virtual]
 

Returns true if the widget is visible.

Note that this method also could return true if the CUIScreen this widget is associated with is invisible

virtual bool MUIWidget::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 in CUILabel, and CUIListBox.

virtual void MUIWidget::SetColorScheme MColorScheme aColorScheme  )  [virtual]
 

Sets the custom color scheme for this widget.

Parameters:
aColorScheme A pointer to MColorScheme interface. Can be NULL to reset to default color scheme

Reimplemented in CUIWidgetGroup.

virtual bool MUIWidget::SetEnabled bool  aEnabled  )  [virtual]
 

Changes widget's enabled state. Keyboard and touchscreen events are not sent to disabled widgets.

Returns true is the state was changed

Reimplemented in CUILabel.

virtual void MUIWidget::SetFont MFont aFont  )  [virtual]
 

Sets the custom font for this widget.

Parameters:
aFont A pointer to MFont interface. Can be NULL to reset to default font

Reimplemented in CUIWidgetGroup.

virtual void MUIWidget::SetTitle const char *  aTitle  )  [virtual]
 

Sets the title of this widget.

Parameters:
aTitle New title. Can be NULL

virtual void MUIWidget::SetToolTip const char *  aToolTip  )  [virtual]
 

Sets the tooltip for this widget.

Parameters:
aToolTip New tooltip. Can be NULL


Member Data Documentation

bool MUIWidget::iActive
 

Active flag

MColorScheme const* MUIWidget::iColorScheme
 

Color scheme. If NULL, default color scheme is used. Custom color scheme is not deleted in the destructor

Reimplemented in CUIScreen.

bool MUIWidget::iEnabled
 

Enabled flag

MFont const* MUIWidget::iFont
 

Font. If NULL, default font is used. Custom font is not deleted in the destructor

MVirtualScreen& MUIWidget::iFrameBuffer
 

Reference to MFrameBuffer this widget draws itself. All widgets use frame buffer returned by MVirtualScreen::GetVirtualSceen() method

MUIWidgetEvents* MUIWidget::iObserver
 

Observer for events

CUIWidgetGroup* MUIWidget::iParent
 

Pointer to a MWidgetGroup this widget belongs to

CUIRect MUIWidget::iRectangle
 

Absolute widget position and size

MUISkin::EFontType MUIWidget::iSkinFontType
 

Default font type.

int MUIWidget::iTag
 

A user-defined parameter

const char* MUIWidget::iTitle
 

Title of this widget. Note that it's advisory to use SetTitle() method to change the title, because it does all necessary memory management

EDrawTextOptions MUIWidget::iTitleOptions
 

Options to draw the widget's title

const char* MUIWidget::iToolTip
 

Tooltip. Note that it's advisory to use SetTooltip() method to change the tooltip, because it does all necessary memory management


The documentation for this class was generated from the following file:
Generated on Fri Jul 15 16:46:44 2005 for TomTom GO User Interface library by doxygen 1.3.5