Provides graphics context and message handling functionality.
This class provides themeing capabilities only for subclassed widgets.
widget type: none (managed through subclass)
object name: none (managed through subclass)
<widget> <type value="xxx"/> <object> <name value="xxx"/> <property color="textcolor" value="0x00FFFFFF"/> <property color="bordercolor0" value="0x00202020"/> <property color="bordercolor1" value="0x00E0E0E0"/> </object> </widget>
paratest.cpp, and sigc.cpp.
Public Types | |
enum | KeyAction { ACT_ACTIVATE, ACT_DEACTIVATE, ACT_OK, ACT_CANCEL, ACT_LEFT, ACT_RIGHT, ACT_UP, ACT_DOWN } |
Keyevent actions. More... | |
Public Member Functions | |
PG_Widget (PG_Widget *parent, const PG_Rect &rect=PG_Rect::null, bool bObjectSurface=false) | |
Creates a PG_Widget with an internal object surface. | |
virtual | ~PG_Widget () |
Destroys a PG_Widget. | |
void | LoadThemeStyle (const char *widgettype) |
Load a style from the theme definition. | |
virtual void | LoadThemeStyle (const char *widgettype, const char *objectname) |
Load a style from the theme definition. | |
void | StartWidgetDrag () |
Start to drag a widget. | |
void | WidgetDrag (int x, int y) |
Drag the widget to a given position (in screen coordinates). | |
void | EndWidgetDrag (int x, int y) |
Finishes a drag operation. | |
bool | MoveWidget (int x, int y, bool update=true) |
Move a widget. | |
bool | MoveWidget (const PG_Rect &r, bool update=true) |
Move and resize widget. | |
virtual bool | SizeWidget (Uint16 w, Uint16 h, bool update=true) |
Resize a widget. | |
PG_Point | ClientToScreen (int x, int y) |
Convert a client (widget) coordinate to a screen position. | |
PG_Point | ScreenToClient (int x, int y) |
Convert a screen position to a client (widget) coordinate. | |
SDL_Surface * | GetWidgetSurface () |
Return the pointer to the widget's drawing surface. | |
bool | IsVisible () |
Check if the object is visible. | |
PG_Widget * | GetParent () |
Get the parentwidget of a widget. | |
virtual void | AddChild (PG_Widget *child) |
Add a clientwidget (which will be embedded into this widget). | |
virtual bool | ProcessEvent (const SDL_Event *event, bool bModal=false) |
Process a native PG_ event. | |
void | SetID (int id) |
Set the widgetid. | |
int | GetID () |
Return the widgetid. | |
PG_Widget * | FindChild (int id) |
Find a child that is identified by the given ID. | |
PG_Widget * | FindChild (const char *name) |
Find a child that is identified by the given name. | |
bool | IsMouseInside () |
Check if the mousepointer is currently inside the widget. | |
bool | Redraw (bool update=true) |
Redraw the widget and all embedded child widgets. | |
virtual void | Blit (bool recursive=true, bool restore=true) |
Blit the widget to the screen. | |
void | Update (bool doBlit=true) |
Update the widget's screen area. | |
void | Show (bool fade=false) |
Make a widget visible. | |
void | Hide (bool fade=false) |
Hide a widget. | |
bool | IsInFrontOf (PG_Widget *) |
Check if the widget is in front of another one. | |
void | SendToBack () |
Send the widget back to the end of the list. | |
void | BringToFront () |
Reorder the widget in front of all others. | |
PG_Widget * | GetToplevelWidget () |
Get the toplevel widget. | |
void | RecalcClipRect () |
virtual bool | RestoreBackground (PG_Rect *clip=NULL, bool force=false) |
Restore the background (all widgets behind this one). | |
void | SetVisible (bool visible) |
Set the visiblility of a widget with updating the screen contents. | |
void | SetFadeSteps (int steps) |
Set the number of steps for fading in/out widgets. | |
void | SetChildTransparency (Uint8 t) |
Set the transparency of all child widgets. | |
PG_RectList * | GetChildList () |
Get a list of child widgets. | |
int | GetChildCount () |
Get the number of childwidgets. | |
void | MoveRect (int x, int y) |
virtual bool | Action (KeyAction action) |
void | SetName (const char *name) |
Set the name for the widget. | |
const char * | GetName () |
Get the name for the widget. | |
bool | LoadLayout (const char *name) |
Load layout from the XML file to the current widget. | |
bool | LoadLayout (const char *name, void(*WorkCallback)(int now, int max)) |
Load layout from the XML file to the current widget. | |
bool | LoadLayout (const char *name, void(*WorkCallback)(int now, int max), void *UserSpace) |
Load layout from the XML file to the current widget. | |
void | RemoveAllChilds () |
Removes all childs. | |
void | SetUserData (void *userdata, int size) |
Sets user data to the widget (malloc inside). | |
virtual int | GetUserDataSize () |
Sets user data to the widget (malloc inside). | |
virtual void | GetUserData (void *userdata) |
Gets user data from the widget. | |
void | ReleaseUserData () |
Releases user data. | |
virtual bool | RemoveChild (PG_Widget *child) |
virtual void | SetText (const char *text) |
Sets text. | |
void | AddText (const char *text, bool update=false) |
Adds text. | |
virtual void | SetTextFormat (const char *text,...) |
Sets formated text. | |
virtual const char * | GetText () |
Returns text. | |
void | GetTextSize (Uint16 &w, Uint16 &h, const char *text=NULL) |
int | GetTextWidth () |
int | GetTextHeight () |
int | GetFontAscender () |
int | GetFontHeight () |
PG_Color | GetFontColor () |
Return the current text color. | |
void | SetFontColor (const PG_Color &Color) |
Set font color. | |
void | SetFontAlpha (int Alpha, bool bRecursive=false) |
Set font transparency (!!!). | |
void | SetFontStyle (PG_Font::Style Style, bool bRecursive=false) |
Set font style. | |
void | SetFontSize (int Size, bool bRecursive=false) |
Set font size. | |
void | SetFontIndex (int Index, bool bRecursive=false) |
Set font index. | |
void | SetFontName (const char *Name, bool bRecursive=false) |
Set font name. | |
void | SetSizeByText (int Width=0, int Height=0, const char *Text=NULL) |
Set widget size by size of text (should be used before Show() or AddWidget()). | |
int | GetFontSize () |
Get the size of the font. | |
PG_Font * | GetFont () |
Get the current font parameters. | |
void | SetFont (PG_Font *font) |
Set the current font parameters. | |
void | DrawText (const PG_Rect &rect, const char *text) |
Render text inside the widget. | |
void | DrawText (int x, int y, const char *text) |
Render text inside the widget. | |
void | DrawText (int x, int y, const char *text, const PG_Rect &cliprect) |
Render text inside the widget and clip to a given clipping rectangle. | |
void | DrawText (const PG_Rect &rect, const char *text, const PG_Color &c) |
Render text inside the widget and set the font color. | |
void | DrawText (int x, int y, const char *text, const PG_Color &c) |
Render text inside the widget and set the font color. | |
void | DrawBorder (const PG_Rect &r, int size, bool up=true) |
virtual void | SetTransparency (Uint8 t, bool bRecursive=false) |
Set the transparency of the drawing object. | |
Uint8 | GetTransparency () |
Get the transparency of the drawing object. | |
void | SetClipRect (PG_Rect &r) |
Set the clipping rectangle for the object. | |
PG_Rect * | GetClipRect () |
Get the current clipping rectangle. | |
bool | IsClippingEnabled () |
Check if there is a clipping rectangle assigned to the object. | |
void | GetClipRects (PG_Rect &src, PG_Rect &dst) |
void | GetClipRects (PG_Rect &src, PG_Rect &dst, const PG_Rect &displayrect) |
void | SetPixel (int x, int y, const PG_Color &c) |
void | DrawHLine (int x, int y, int w, const PG_Color &c) |
void | DrawVLine (int x, int y, int h, const PG_Color &c) |
void | DrawRectWH (int x, int y, int w, int h, const PG_Color &c) |
void | DrawLine (Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const PG_Color &color, Uint8 width=1) |
virtual void | RunModal () |
Enter modal mode. | |
void | QuitModal () |
Quit modal mode. | |
bool | WillQuitModal () |
void | StopQuitModal () |
void | SetDirtyUpdate (bool bDirtyUpdate) |
Set the dirty update mode. | |
bool | GetDirtyUpdate () |
return if the dirty update mode is enabled | |
virtual void | eventMouseLeave () |
eventhandler for mouse movements. | |
virtual void | eventMouseEnter () |
eventhandler for mouse movements. | |
void | SetHidden (bool hidden) |
bool | IsHidden () |
Static Public Member Functions | |
void | UpdateRect (const PG_Rect &r) |
Update a screen area. | |
void | UpdateScreen () |
Update (render) the whole application screen. | |
void | HideAll () |
Hide all widgets of an application. | |
PG_Widget * | FindWidgetFromPos (int x, int y) |
void | BulkUpdate () |
void | BulkBlit () |
PG_RectList * | GetWidgetList () |
Get a list of all toplevel widgets. | |
void | GetTextSize (Uint16 &w, Uint16 &h, const char *text, PG_Font *font) |
Protected Member Functions | |
virtual void | eventMoveWidget (int x, int y) |
Callback for the MoveWidget event. | |
virtual void | eventSizeWidget (Uint16 w, Uint16 h) |
Callback for the SizeWidget event. | |
virtual void | eventDraw (SDL_Surface *surface, const PG_Rect &rect) |
overridable eventhandler to draw the object surface | |
virtual void | eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) |
overridable eventhandler to blit the widget contents to the screen | |
virtual void | eventShow () |
overridable eventhandler called whenever the widget gets shown. | |
virtual void | eventHide () |
overridable eventhandler called whenever the widget gets hidden. | |
virtual bool | eventQuitModal (int id, PG_MessageObject *widget, unsigned long data) |
overridable eventhandler called when leaving a modal eventloop | |
void | SetParent (PG_Widget *parent) |
void | FadeOut () |
void | FadeIn () |
bool | AcceptEvent (const SDL_Event *event) |
Overridable message filter function. | |
void | RemoveFromWidgetList () |
void | AddToWidgetList () |
Protected Attributes | |
SDL_Surface * | my_srfObject |
pointer to the widgets drawing surface or NULL | |
string | my_text |
text attached to the widget | |
PG_Color | my_colorBorder [2][2] |
array of border colors |
|
Keyevent actions.
|
|
Creates a PG_Widget with an internal object surface.
|
|
Destroys a PG_Widget. This is the destructor for the PG_Widget class |
|
Overridable message filter function. Derivated classes can filter special events. The default implementation returns 'false' which indicates that this message is not processed by this object.
Reimplemented from PG_MessageObject. |
|
Reimplemented in PG_LineEdit. |
|
Add a clientwidget (which will be embedded into this widget).
Reimplemented in PG_DropDown, PG_ListBox, PG_RichEdit, PG_ScrollArea, PG_ScrollWidget, and PG_WidgetList. |
|
Adds text.
|
|
|
|
Blit the widget to the screen.
|
|
Reorder the widget in front of all others.
|
|
|
|
|
|
Convert a client (widget) coordinate to a screen position.
|
|
|
|
|
|
|
|
|
|
Render text inside the widget and set the font color.
|
|
Render text inside the widget and set the font color.
|
|
Render text inside the widget and clip to a given clipping rectangle.
|
|
Render text inside the widget.
|
|
Render text inside the widget.
|
|
|
|
Finishes a drag operation.
|
|
overridable eventhandler to blit the widget contents to the screen
Reimplemented in PG_Button, PG_ColumnItem, PG_Image, PG_Label, PG_LineEdit, PG_ListBoxItem, PG_PopupMenu, PG_ProgressBar, PG_RichEdit, PG_ThemeWidget, and PG_Window. |
|
overridable eventhandler to draw the object surface
Reimplemented in PG_Image, PG_Label, and PG_ThemeWidget. |
|
overridable eventhandler called whenever the widget gets hidden.
Reimplemented in PG_DropDown, PG_LineEdit, PG_ListBoxBaseItem, and PG_PopupMenu. |
|
eventhandler for mouse movements. This overrideable handler is called everytime the mouse cursor is entering the widget area. Reimplemented in PG_Button, PG_ListBoxBaseItem, PG_PopupMenu, and PG_RadioButton. |
|
eventhandler for mouse movements. This overrideable handler is called everytime the mouse cursor is leaving the widget area. Reimplemented in PG_Button, PG_ListBoxBaseItem, PG_PopupMenu, and PG_RadioButton. |
|
Callback for the MoveWidget event.
Reimplemented in PG_DropDown, and PG_PopupMenu. |
|
overridable eventhandler called when leaving a modal eventloop
Reimplemented from PG_MessageObject. |
|
overridable eventhandler called whenever the widget gets shown.
Reimplemented in PG_DropDown, PG_PopupMenu, and PG_Window. |
|
Callback for the SizeWidget event.
Reimplemented in PG_Button, PG_DropDown, PG_ListBoxBaseItem, PG_ListBoxItem, PG_ScrollBar, PG_ScrollWidget, PG_ThemeWidget, and PG_Window. |
|
|
|
|
|
Find a child that is identified by the given name.
|
|
Find a child that is identified by the given ID.
|
|
|
|
Get the number of childwidgets.
|
|
Get a list of child widgets.
|
|
Get the current clipping rectangle.
|
|
|
|
|
|
return if the dirty update mode is enabled
|
|
Get the current font parameters.
|
|
|
|
Return the current text color.
|
|
|
|
Get the size of the font.
|
|
Return the widgetid.
|
|
Get the name for the widget.
|
|
Get the parentwidget of a widget.
Reimplemented in PG_ListBoxBaseItem. |
|
Returns text.
Reimplemented in PG_DropDown, and PG_RadioButton. |
|
|
|
|
|
|
|
|
|
Get the toplevel widget.
|
|
Get the transparency of the drawing object.
|
|
Gets user data from the widget.
|
|
Sets user data to the widget (malloc inside).
|
|
Get a list of all toplevel widgets.
|
|
Return the pointer to the widget's drawing surface.
|
|
Hide a widget.
|
|
Hide all widgets of an application.
|
|
Check if there is a clipping rectangle assigned to the object.
|
|
|
|
Check if the widget is in front of another one.
|
|
Check if the mousepointer is currently inside the widget.
|
|
Check if the object is visible.
|
|
Load layout from the XML file to the current widget.
|
|
Load layout from the XML file to the current widget.
|
|
Load layout from the XML file to the current widget.
|
|
Load a style from the theme definition.
Reimplemented in PG_Button, PG_Label, PG_LineEdit, PG_ListBoxItem, PG_PopupMenu, and PG_ThemeWidget. |
|
Load a style from the theme definition.
Reimplemented in PG_Button, PG_DropDown, PG_Label, PG_LineEdit, PG_MessageBox, PG_PopupMenu, PG_ProgressBar, PG_RadioButton, PG_ScrollBar, PG_ScrollWidget, PG_Slider, PG_ThemeWidget, and PG_Window. |
|
|
|
Move and resize widget.
|
|
Move a widget.
|
|
Process a native PG_ event.
Reimplemented in PG_DropDown. |
|
Quit modal mode.
|
|
|
|
Redraw the widget and all embedded child widgets.
|
|
Releases user data.
|
|
Removes all childs.
|
|
Reimplemented in PG_RichEdit, and PG_ScrollArea. |
|
|
|
Restore the background (all widgets behind this one).
|
|
Enter modal mode.
|
|
Convert a screen position to a client (widget) coordinate.
|
|
Send the widget back to the end of the list.
|
|
Set the transparency of all child widgets.
|
|
Set the clipping rectangle for the object.
|
|
Set the dirty update mode.
|
|
Set the number of steps for fading in/out widgets.
|
|
Set the current font parameters.
|
|
Set font transparency (!!!).
|
|
Set font color.
Reimplemented in PG_RadioButton. |
|
Set font index.
|
|
Set font name.
|
|
Set font size.
|
|
Set font style.
|
|
|
|
Set the widgetid.
|
|
Set the name for the widget.
|
|
|
|
|
|
Set widget size by size of text (should be used before Show() or AddWidget()).
Reimplemented in PG_RadioButton. |
|
Sets text.
Reimplemented in PG_DropDown, PG_LineEdit, PG_MaskEdit, PG_RadioButton, and PG_RichEdit. |
|
Sets formated text.
|
|
Set the transparency of the drawing object.
Reimplemented in PG_Button, and PG_ThemeWidget. |
|
Sets user data to the widget (malloc inside).
|
|
Set the visiblility of a widget with updating the screen contents.
|
|
Make a widget visible.
|
|
Resize a widget.
|
|
Start to drag a widget. StartWidgetDrag prepares to widget to be dragged. |
|
|
|
Update the widget's screen area.
|
|
Update a screen area.
|
|
Update (render) the whole application screen.
|
|
Drag the widget to a given position (in screen coordinates).
|
|
|
|
array of border colors
|
|
pointer to the widgets drawing surface or NULL
|
|
text attached to the widget
|