#include <MUIWidget.h>
Inheritance diagram for MUIWidget:
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. | |
MFont * | GetFont () const |
Returns the pointer to MFont to draw this widget with. Returned pointer should not be deleted. | |
MColorScheme * | GetColorScheme () const |
Returns the pointer to MColorScheme to draw this widget with. Returned pointer should not be deleted. | |
Public Attributes | |
CUIRect | iRectangle |
MColorScheme const * | iColorScheme |
MUIWidgetEvents * | iObserver |
const char * | iTitle |
EDrawTextOptions | iTitleOptions |
MFont const * | iFont |
bool | iEnabled |
const char * | iToolTip |
bool | iActive |
MUISkin::EFontType | iSkinFontType |
int | iTag |
MVirtualScreen & | iFrameBuffer |
CUIWidgetGroup * | iParent |
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.
|
Option set for DrawTextEx |
|
Possible options for DrawTextEx() method.
|
|
Basic constructor for all widgets.
|
|
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. |
|
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.
|
|
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.
|
|
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"
|
|
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.
Implemented in CUIButton, CUICheckBox, CUIInput, CUILabel, CUIListBox, CUIRadioButton, CUISlider, and CUIWidgetGroup. |
|
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 ).
Implemented in CUIButton, CUICheckBox, CUIInput, CUILabel, CUIListBox, CUIRadioButton, CUISlider, and CUIWidgetGroup. |
|
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 |
|
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. |
|
Sets the custom color scheme for this widget.
Reimplemented in CUIWidgetGroup. |
|
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. |
|
Sets the custom font for this widget.
Reimplemented in CUIWidgetGroup. |
|
Sets the title of this widget.
|
|
Sets the tooltip for this widget.
|
|
Active flag |
|
Color scheme. If NULL, default color scheme is used. Custom color scheme is not deleted in the destructor Reimplemented in CUIScreen. |
|
Enabled flag |
|
Font. If NULL, default font is used. Custom font is not deleted in the destructor |
|
Reference to MFrameBuffer this widget draws itself. All widgets use frame buffer returned by MVirtualScreen::GetVirtualSceen() method |
|
Observer for events |
|
Pointer to a MWidgetGroup this widget belongs to |
|
Absolute widget position and size |
|
Default font type. |
|
A user-defined parameter |
|
Title of this widget. Note that it's advisory to use SetTitle() method to change the title, because it does all necessary memory management |
|
Options to draw the widget's title |
|
Tooltip. Note that it's advisory to use SetTooltip() method to change the tooltip, because it does all necessary memory management |