| 1 | // |
| 2 | // EventListener.h |
| 3 | // |
| 4 | // Library: XML |
| 5 | // Package: DOM |
| 6 | // Module: DOMEvents |
| 7 | // |
| 8 | // Definition of the DOM EventListener interface. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef DOM_EventListener_INCLUDED |
| 18 | #define DOM_EventListener_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/XML/XML.h" |
| 22 | #include "Poco/XML/XMLString.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | namespace XML { |
| 27 | |
| 28 | |
| 29 | class Event; |
| 30 | |
| 31 | |
| 32 | class XML_API EventListener |
| 33 | /// The EventListener interface is the primary method for handling events. Users |
| 34 | /// implement the EventListener interface and register their listener on an |
| 35 | /// EventTarget using the AddEventListener method. The users should also remove |
| 36 | /// their EventListener from its EventTarget after they have completed using |
| 37 | /// the listener. |
| 38 | /// |
| 39 | /// When a Node is copied using the cloneNode method the EventListeners attached |
| 40 | /// to the source Node are not attached to the copied Node. If the user wishes |
| 41 | /// the same EventListeners to be added to the newly created copy the user must |
| 42 | /// add them manually. |
| 43 | { |
| 44 | public: |
| 45 | virtual void handleEvent(Event* evt) = 0; |
| 46 | /// This method is called whenever an event occurs of the |
| 47 | /// type for which the EventListener interface was registered. |
| 48 | |
| 49 | protected: |
| 50 | virtual ~EventListener(); |
| 51 | }; |
| 52 | |
| 53 | |
| 54 | } } // namespace Poco::XML |
| 55 | |
| 56 | |
| 57 | #endif // DOM_EventListener_INCLUDED |
| 58 | |