29 |
#ifndef PG_WIDGET_H |
#ifndef PG_WIDGET_H |
30 |
#define PG_WIDGET_H |
#define PG_WIDGET_H |
31 |
|
|
|
#ifdef SWIG |
|
|
%include "swigcommon.h" |
|
|
%module pgwidget |
|
|
%{ |
|
|
#include "pgwidget.h" |
|
|
%} |
|
|
#endif |
|
|
|
|
32 |
#include "pgmessageobject.h" |
#include "pgmessageobject.h" |
33 |
#include "pgrectlist.h" |
#include "pgrectlist.h" |
34 |
#include "pgfont.h" |
#include "pgfont.h" |
73 |
|
|
74 |
class DECLSPEC PG_Widget : public PG_MessageObject, public PG_Rect { |
class DECLSPEC PG_Widget : public PG_MessageObject, public PG_Rect { |
75 |
public: |
public: |
76 |
|
|
77 |
|
|
78 |
|
//! Keyevent actions |
79 |
|
typedef enum { |
80 |
|
ACT_ACTIVATE, //!< Widget got the input focus |
81 |
|
ACT_DEACTIVATE, //!< Widget has lost the input focus |
82 |
|
ACT_OK, //!< Widget action event (e.g. button press on a PG_Button object) |
83 |
|
ACT_CANCEL, //!< Widget cancel-action |
84 |
|
ACT_LEFT, //!< Cursor left was pressed |
85 |
|
ACT_RIGHT, //!< Cursor right was pressed |
86 |
|
ACT_UP, //!< Cursor up was pressed |
87 |
|
ACT_DOWN //!< Cursor down was pressed |
88 |
|
} KeyAction; |
89 |
|
|
90 |
/** |
/** |
91 |
Creates a PG_Widget without an object-surface |
Creates a PG_Widget without an object-surface |
92 |
|
|
104 |
@param rect initial position for the widget |
@param rect initial position for the widget |
105 |
@param bObjectSurface flag if a surface for the object should be created |
@param bObjectSurface flag if a surface for the object should be created |
106 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(PG_WidgetEx) PG_Widget(PG_Widget* parent, const PG_Rect& rect, bool bObjectSurface); |
|
|
#else |
|
|
|
|
107 |
PG_Widget(PG_Widget* parent, const PG_Rect& rect, bool bObjectSurface); |
PG_Widget(PG_Widget* parent, const PG_Rect& rect, bool bObjectSurface); |
|
#endif |
|
108 |
|
|
109 |
/** |
/** |
110 |
Destroys a PG_Widget |
Destroys a PG_Widget |
122 |
*/ |
*/ |
123 |
void LoadThemeStyle(const char* widgettype); |
void LoadThemeStyle(const char* widgettype); |
124 |
|
|
|
#ifndef SWIG |
|
125 |
/** |
/** |
126 |
Load a style from the theme definition |
Load a style from the theme definition |
127 |
|
|
131 |
Loads the defined style of a given widgettype and objectname. |
Loads the defined style of a given widgettype and objectname. |
132 |
*/ |
*/ |
133 |
virtual void LoadThemeStyle(const char* widgettype, const char* objectnmae); |
virtual void LoadThemeStyle(const char* widgettype, const char* objectnmae); |
|
#endif |
|
134 |
|
|
135 |
/** |
/** |
136 |
Start to drag a widget |
Start to drag a widget |
186 |
|
|
187 |
This function moves and resizes the widget to fit the given rectangle. |
This function moves and resizes the widget to fit the given rectangle. |
188 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(MoveWidgetRect) bool MoveWindow(const PG_Rect& r); |
|
|
#else |
|
189 |
bool MoveWidget(const PG_Rect& r); |
bool MoveWidget(const PG_Rect& r); |
|
#endif |
|
190 |
|
|
191 |
/** |
/** |
192 |
Move and resize widget -- OBSOLETE |
Move and resize widget -- OBSOLETE |
197 |
This function moves and resizes the widget to fit the given rectangle. |
This function moves and resizes the widget to fit the given rectangle. |
198 |
CAUTION: This function will be removed in the final version. Please use MoveWidget(const PG_Rect& r) |
CAUTION: This function will be removed in the final version. Please use MoveWidget(const PG_Rect& r) |
199 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(MoveWindowRect) bool MoveWindow(const PG_Rect& r); |
|
|
#else |
|
200 |
bool MoveWindow(const PG_Rect& r); |
bool MoveWindow(const PG_Rect& r); |
|
#endif |
|
201 |
|
|
202 |
/** |
/** |
203 |
Resize a widget -- OBSOLETE |
Resize a widget -- OBSOLETE |
306 |
@param id the id of the child to return |
@param id the id of the child to return |
307 |
@return A pointer to the child with the given ID or 0 if no such child exists. |
@return A pointer to the child with the given ID or 0 if no such child exists. |
308 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name (FindChildID) PG_Widget* FindChild(int id); |
|
|
#else |
|
309 |
PG_Widget* FindChild(int id); |
PG_Widget* FindChild(int id); |
|
#endif |
|
310 |
|
|
311 |
/** |
/** |
312 |
Find a child that is identified by the given name. |
Find a child that is identified by the given name. |
445 |
// Navigation |
// Navigation |
446 |
|
|
447 |
/** */ |
/** */ |
448 |
virtual bool Action(PG_ACTION action); |
virtual bool Action(KeyAction action); |
449 |
|
|
450 |
/** |
/** |
451 |
Get a list of all toplevel widgets |
Get a list of all toplevel widgets |
478 |
@param WorkCallback address of function to show progress of loading layout |
@param WorkCallback address of function to show progress of loading layout |
479 |
@return returns non-zero on success or 0 if not succes |
@return returns non-zero on success or 0 if not succes |
480 |
*/ |
*/ |
|
#ifndef SWIG |
|
481 |
bool LoadLayout(const char *name, void (* WorkCallback)(int now, int max)); |
bool LoadLayout(const char *name, void (* WorkCallback)(int now, int max)); |
|
#endif |
|
482 |
|
|
483 |
/** |
/** |
484 |
Load layout from the XML file to the current widget |
Load layout from the XML file to the current widget |
487 |
@param UserSpace address of user data witch are passed to Processing Instruction handler etc. |
@param UserSpace address of user data witch are passed to Processing Instruction handler etc. |
488 |
@return returns non-zero on success or 0 if not succes |
@return returns non-zero on success or 0 if not succes |
489 |
*/ |
*/ |
|
#ifndef SWIG |
|
490 |
bool LoadLayout(const char *name, void (* WorkCallback)(int now, int max), void *UserSpace); |
bool LoadLayout(const char *name, void (* WorkCallback)(int now, int max), void *UserSpace); |
|
#endif |
|
491 |
|
|
492 |
/** |
/** |
493 |
Removes all childs |
Removes all childs |
534 |
*/ |
*/ |
535 |
void AddText(const char* text, bool update = false); |
void AddText(const char* text, bool update = false); |
536 |
|
|
|
#ifndef SWIG |
|
537 |
/** |
/** |
538 |
Sets formated text |
Sets formated text |
539 |
@param text Set the widget text (like printf) and update widget |
@param text Set the widget text (like printf) and update widget |
540 |
*/ |
*/ |
541 |
virtual void SetTextFormat(const char* text, ...); |
virtual void SetTextFormat(const char* text, ...); |
|
#endif |
|
542 |
|
|
543 |
/** Returns text |
/** Returns text |
544 |
@return Pointer to the text of the widget (read-only) |
@return Pointer to the text of the widget (read-only) |
547 |
|
|
548 |
void GetTextSize(Uint16& w, Uint16& h, const char* text = NULL); |
void GetTextSize(Uint16& w, Uint16& h, const char* text = NULL); |
549 |
|
|
|
#ifdef SWIG |
|
|
%name(GetTextSize2) static void GetTextSize(Uint16& w, Uint16& h, const char* text, PG_Font* font); |
|
|
#else |
|
550 |
static void GetTextSize(Uint16& w, Uint16& h, const char* text, PG_Font* font); |
static void GetTextSize(Uint16& w, Uint16& h, const char* text, PG_Font* font); |
|
#endif |
|
551 |
|
|
552 |
int GetTextWidth(); |
int GetTextWidth(); |
553 |
|
|
642 |
@param x y-position where the text should appear |
@param x y-position where the text should appear |
643 |
@param text pointer to text string |
@param text pointer to text string |
644 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(DrawTextXY) void DrawText(int x, int y, const char* text); |
|
|
#else |
|
645 |
void DrawText(int x, int y, const char* text); |
void DrawText(int x, int y, const char* text); |
|
#endif |
|
646 |
|
|
647 |
/** |
/** |
648 |
Render text inside the widget and clip to a given clipping rectangle |
Render text inside the widget and clip to a given clipping rectangle |
651 |
@param text pointer to text string |
@param text pointer to text string |
652 |
@param cliprect text bounding rectangle |
@param cliprect text bounding rectangle |
653 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(DrawTextXYClip) void DrawText(int x, int y, const char* text, const PG_Rect& cliprect); |
|
|
#else |
|
654 |
void DrawText(int x, int y, const char* text, const PG_Rect& cliprect); |
void DrawText(int x, int y, const char* text, const PG_Rect& cliprect); |
|
#endif |
|
655 |
|
|
656 |
/** |
/** |
657 |
Render text inside the widget and set the font color |
Render text inside the widget and set the font color |
659 |
@param text pointer to text string |
@param text pointer to text string |
660 |
@param color color of the rendered text |
@param color color of the rendered text |
661 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(DrawTextColor) void DrawText(const PG_Rect& rect, const char* text, const PG_Color& c); |
|
|
#else |
|
662 |
void DrawText(const PG_Rect& rect, const char* text, const PG_Color& c); |
void DrawText(const PG_Rect& rect, const char* text, const PG_Color& c); |
|
#endif |
|
663 |
|
|
664 |
/** |
/** |
665 |
Render text inside the widget and set the font color |
Render text inside the widget and set the font color |
668 |
@param text pointer to text string |
@param text pointer to text string |
669 |
@param color color of the rendered text |
@param color color of the rendered text |
670 |
*/ |
*/ |
|
#ifdef SWIG |
|
|
%name(DrawTextXYColor) void DrawText(int x, int y, const char* text, const PG_Color& c); |
|
|
#else |
|
671 |
void DrawText(int x, int y, const char* text, const PG_Color& c); |
void DrawText(int x, int y, const char* text, const PG_Color& c); |
|
#endif |
|
672 |
|
|
673 |
/** */ |
/** */ |
674 |
void DrawBorder(const PG_Rect& r, int size, bool up = true); |
void DrawBorder(const PG_Rect& r, int size, bool up = true); |
709 |
/** */ |
/** */ |
710 |
void GetClipRects(PG_Rect& src, PG_Rect& dst); |
void GetClipRects(PG_Rect& src, PG_Rect& dst); |
711 |
|
|
|
#ifndef SWIG |
|
712 |
/** */ |
/** */ |
713 |
void GetClipRects(PG_Rect& src, PG_Rect& dst, const PG_Rect& displayrect); |
void GetClipRects(PG_Rect& src, PG_Rect& dst, const PG_Rect& displayrect); |
|
#endif |
|
714 |
|
|
715 |
/** */ |
/** */ |
716 |
void SetPixel(int x, int y, const PG_Color& c); |
void SetPixel(int x, int y, const PG_Color& c); |
781 |
@return this eventhandler should return "true" if the message was proccessed. |
@return this eventhandler should return "true" if the message was proccessed. |
782 |
This messagehandler can be overridden to perform custom operations. |
This messagehandler can be overridden to perform custom operations. |
783 |
*/ |
*/ |
784 |
bool eventMessage(MSG_MESSAGE* msg); |
//bool eventMessage(MSG_MESSAGE* msg); |
785 |
|
|
786 |
/** |
/** |
787 |
Callback for the MoveWidget event |
Callback for the MoveWidget event |
899 |
//void AddChildToCache(PG_Widget *child, const char *name); |
//void AddChildToCache(PG_Widget *child, const char *name); |
900 |
//void AddChildToCache(PG_Widget *child, int id); |
//void AddChildToCache(PG_Widget *child, int id); |
901 |
|
|
|
#ifndef SWIG |
|
902 |
PG_Widget(const PG_Widget&); |
PG_Widget(const PG_Widget&); |
903 |
PG_Widget& operator=(const PG_Widget&); |
PG_Widget& operator=(const PG_Widget&); |
|
#endif |
|
904 |
|
|
905 |
static bool bBulkUpdate; |
static bool bBulkUpdate; |
906 |
static int my_ObjectCounter; |
static int my_ObjectCounter; |