Create New Widget: Difference between revisions
Jump to navigation
Jump to search
Created page with 'To create a new widget you simply have to subclass one of the existing widgets ( or the base one ) and implement the functions you want to change. Almost every function in the wi…' |
|||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 19: | Line 19: | ||
Next update will be to show how to create the factory and the XML for this so you can do something like specify a sound to play. | Next update will be to show how to create the factory and the XML for this so you can do something like specify a sound to play. | ||
[[Category:Engine documents]] | |||
Latest revision as of 22:33, 10 December 2010
To create a new widget you simply have to subclass one of the existing widgets ( or the base one ) and implement the functions you want to change. Almost every function in the widget class is a virtual one which allows you to customize the widget the way you want. For example, say you want to create a widget that all it does is play a sound when the mouse is moved over it. For this you can subclass the base widget pawsWidget and just implement the OnMouseEnter() and the OnMouseExit() functions.
class MyNewWidget : public pawsWidget
{
public:
virtual bool OnMouseEnter()
{
MyPlaySound();
}
virtual bool OnMouseExit()
{
MyStopSound();
}
private:
void MyPlaySound() { ... }
void MyStopSound() { ... }
};
Next update will be to show how to create the factory and the XML for this so you can do something like specify a sound to play.