Inheritance diagram for code::ActionListener:
The class that is interested in processing an action event suclasses this interface, and the object created with that class is registered with an ActionSource, using the ActionSource's addActionListener method. When the action event occurs, that object's actionPerformed method is invoked.
Example use:
@class MyActionListener: public ActionListener { @ virtual void actionPerformed ( const ActionEvent* e ) { @ cout << "button pressed" << endl; @ } @}; @extern Button b; // Button is-a ActionSource @MyActionListener mine = new MyActionListener ( ); @b.addActionListener ( mine );
Like Dialog/DialogListener and ListModel/ListListener, this is another instance of the "Observer/Observable" pattern, discussed in "Design Patterns: Elements of Reusable Object-Oriented Software" (Gamma, Helm, Johnson, Vlissides, 1995).
Public Member Functions | |
virtual | ~ActionListener () |
All classes should have virtual destructors. | |
virtual void | actionPerformed (const ActionEvent *)=0 |
This method is invoked when an action is published by one of the ActionSources that this listener subscribes to. |
virtual code::ActionListener::~ActionListener | ( | ) | [inline, virtual] |
All classes should have virtual destructors.
virtual void code::ActionListener::actionPerformed | ( | const ActionEvent * | ) | [pure virtual] |
This method is invoked when an action is published by one of the ActionSources that this listener subscribes to.
Implemented in code::MultipleListeners.