This class provides themeing capabilities only for subclassed widgets.
|
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 std::string &widgettype) |
| | Load a style from the theme definition.
|
| virtual void | LoadThemeStyle (const std::string &widgettype, const std::string &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 void | InsertAfter (PG_Widget *child, PG_Widget *after) |
| 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, bool recursive=false) |
| | Find a child that is identified by the given ID.
|
| PG_Widget * | FindChild (const std::string &name, bool recursive=false) |
| | 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.
|
| virtual void | Show (bool fade=false) |
| | Make a widget visible (if you want a widget to show up the first time, use this method).
|
| virtual 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 std::string &name) |
| | Set the name for the widget.
|
| const std::string & | GetName () |
| | Get the name for the widget.
|
| bool | LoadLayout (const std::string &name) |
| | Load layout from the XML file to the current widget.
|
| bool | LoadLayout (const std::string &name, void(*WorkCallback)(int now, int max)) |
| | Load layout from the XML file to the current widget.
|
| bool | LoadLayout (const std::string &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 std::string &text) |
| | Sets text.
|
| void | AddText (const std::string &text, bool update=false) |
| | Adds text.
|
| virtual void | SetTextFormat (const char *text,...) |
| | Sets formated text.
|
| virtual const PG_String & | GetText () |
| | Returns text.
|
| void | GetTextSize (Uint16 &w, Uint16 &h, const std::string &text=PG_NULLSTR) |
| int | GetTextWidth () |
| int | GetTextHeight () |
| int | GetFontAscender () |
| int | GetFontHeight () |
| PG_Color | GetFontColor () |
| | Return the current text color.
|
| void | SetFontColor (const PG_Color &Color, bool bRecursive=false) |
| | 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 std::string &Name, bool bRecursive=false) |
| | Set font name.
|
| void | SetSizeByText (int Width=0, int Height=0, const std::string &Text=PG_NULLSTR) |
| | 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 PG_String &text) |
| | Render text inside the widget.
|
| void | DrawText (int x, int y, const PG_String &text) |
| | Render text inside the widget.
|
| void | DrawText (int x, int y, const PG_String &text, const PG_Rect &cliprect) |
| | Render text inside the widget and clip to a given clipping rectangle.
|
| void | DrawText (const PG_Rect &rect, const PG_String &text, const PG_Color &c) |
| | Render text inside the widget and set the font color.
|
| void | DrawText (int x, int y, const PG_String &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 (const 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 int | RunModal () |
| | Enter modal mode.
|
| bool | QuitModal () |
| | Quit modal mode.
|
| bool | WillQuitModal () |
| void | StopQuitModal () |
| void | SetDirtyUpdate (bool bDirtyUpdate) |
| | Set the dirty update mode.
|
| void | UpdateOverlappingSiblings (bool enable, bool recursive=true) |
| | Set the sibling 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 () |
| void | SetModalStatus (int status) |
| | Set the return status of the modal eventloop.
|
| void | EnableReceiver (bool enable, bool bRecursive=false) |
| void | SetParent (PG_Widget *parent) |
| | change the parent of the widget.
|
| void | SetBorderSize (int b) |
| | Set the bordersize of the widget.
|
| int | GetBorderSize () |
| | Get the bordersize of the widget.
|
Static Public Member Functions |
| static void | UpdateRect (const PG_Rect &r) |
| | Update a screen area.
|
| static void | UpdateScreen () |
| | Update (render) the whole application screen.
|
| static void | HideAll () |
| | Hide all widgets of an application.
|
| static PG_Widget * | FindWidgetFromPos (int x, int y) |
| static void | BulkBlit () |
| static PG_RectList * | GetWidgetList () |
| | Get a list of all toplevel widgets.
|
| static void | GetTextSize (Uint16 &w, Uint16 &h, const PG_String &text, PG_Font *font) |
Public Attributes |
| SignalMouseEnter | sigMouseEnter |
| SignalMouseLeave | sigMouseLeave |
| SignalShow | sigShow |
| SignalHide | sigHide |
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 | 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
|
| PG_String | my_text |
| | text attached to the widget
|
| PG_Color | my_colorBorder [2][2] |
| | array of border colors
|
| int | my_bordersize |
Classes |
| class | SignalHide |
| class | SignalMouseEnter |
| class | SignalMouseLeave |
| class | SignalShow |