~ubuntu-branches/ubuntu/gutsy/poco/gutsy

« back to all changes in this revision

Viewing changes to XML/include/Poco/DOM/EventTarget.h

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Burghardt
  • Date: 2007-04-27 18:33:48 UTC
  • Revision ID: james.westby@ubuntu.com-20070427183348-xgnpct0qd6a2ip34
Tags: upstream-1.2.9
ImportĀ upstreamĀ versionĀ 1.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// EventTarget.h
 
3
//
 
4
// $Id: //poco/1.2/XML/include/Poco/DOM/EventTarget.h#1 $
 
5
//
 
6
// Library: XML
 
7
// Package: DOM
 
8
// Module:  DOMEvents
 
9
//
 
10
// Definition of the DOM EventTarget interface.
 
11
//
 
12
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
 
13
// and Contributors.
 
14
//
 
15
// Permission is hereby granted, free of charge, to any person or organization
 
16
// obtaining a copy of the software and accompanying documentation covered by
 
17
// this license (the "Software") to use, reproduce, display, distribute,
 
18
// execute, and transmit the Software, and to prepare derivative works of the
 
19
// Software, and to permit third-parties to whom the Software is furnished to
 
20
// do so, all subject to the following:
 
21
// 
 
22
// The copyright notices in the Software and this entire statement, including
 
23
// the above license grant, this restriction and the following disclaimer,
 
24
// must be included in all copies of the Software, in whole or in part, and
 
25
// all derivative works of the Software, unless such copies or derivative
 
26
// works are solely in the form of machine-executable object code generated by
 
27
// a source language processor.
 
28
// 
 
29
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
30
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
31
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 
32
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 
33
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 
34
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
35
// DEALINGS IN THE SOFTWARE.
 
36
//
 
37
 
 
38
 
 
39
#ifndef DOM_EventTarget_INCLUDED
 
40
#define DOM_EventTarget_INCLUDED
 
41
 
 
42
 
 
43
#include "Poco/XML/XML.h"
 
44
#include "Poco/DOM/DOMObject.h"
 
45
#include "Poco/XML/XMLString.h"
 
46
 
 
47
 
 
48
namespace Poco {
 
49
namespace XML {
 
50
 
 
51
 
 
52
class EventListener;
 
53
class Event;
 
54
 
 
55
 
 
56
class XML_API EventTarget: public DOMObject
 
57
        /// The EventTarget interface is implemented by all Nodes in an implementation
 
58
        /// which supports the DOM Event Model. Therefore, this interface can be obtained
 
59
        /// by using binding-specific casting methods on an instance of the Node interface.
 
60
        /// The interface allows registration and removal of EventListeners on an EventTarget
 
61
        /// and dispatch of events to that EventTarget.
 
62
{
 
63
public:
 
64
        virtual void addEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0;
 
65
                /// This method allows the registration of event listeners on 
 
66
                /// the event target. If an EventListener is added to an
 
67
                /// EventTarget while it is processing an event, it will not 
 
68
                /// be triggered by the current actions but may be triggered
 
69
                /// during a later stage of event flow, such as the bubbling phase.
 
70
                /// If multiple identical EventListeners are registered on the same 
 
71
                /// EventTarget with the same parameters the duplicate instances are 
 
72
                /// discarded. They do not cause the EventListener to be called twice and since they are
 
73
                /// discarded they do not need to be removed with the removeEventListener method.       
 
74
        
 
75
        virtual void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0;
 
76
                /// This method allows the removal of event listeners from the event 
 
77
                /// target. If an EventListener is removed from an EventTarget while it is 
 
78
                /// processing an event, it will not be triggered by the current actions. 
 
79
                /// EventListeners can never be invoked after being removed.
 
80
                /// Calling removeEventListener with arguments which do not identify 
 
81
                /// any currently registered EventListener on the EventTarget has no effect. 
 
82
 
 
83
        virtual bool dispatchEvent(Event* evt) = 0;
 
84
                /// This method allows the dispatch of events into the implementations 
 
85
                /// event model. Events dispatched in this manner will have the same capturing and 
 
86
                /// bubbling behavior as events dispatched directly by the
 
87
                /// implementation. The target of the event is the EventTarget on 
 
88
                /// which dispatchEvent is called. 
 
89
 
 
90
protected:
 
91
        virtual ~EventTarget();
 
92
};
 
93
 
 
94
 
 
95
} } // namespace Poco::XML
 
96
 
 
97
 
 
98
#endif // DOM_EventTarget_INCLUDED