Difference between revisions of "Create New Widget"

From PSwiki
Jump to navigation Jump to search
m (add to category (Engine documents))
Line 1: Line 1:
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.
spam
 
  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.
 
 
[[Category:Engine documents]]

Revision as of 23:02, 10 December 2010

spam