2
* This file is part of the KDE libraries
3
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
4
* Copyright (C) 2003 Apple Computer, Inc.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#include "EventListener.h"
25
#include "PlatformString.h"
39
class JSAbstractEventListener : public EventListener {
41
JSAbstractEventListener(bool html = false);
43
virtual void handleEvent(Event*, bool isWindowEvent);
44
virtual bool isHTMLEventListener() const;
45
virtual KJS::JSObject* listenerObj() const = 0;
46
virtual KJS::Window* windowObj() const = 0;
52
class JSUnprotectedEventListener : public JSAbstractEventListener {
54
JSUnprotectedEventListener(KJS::JSObject* listener, KJS::Window*, bool html = false);
55
virtual ~JSUnprotectedEventListener();
57
virtual KJS::JSObject* listenerObj() const;
58
virtual KJS::Window* windowObj() const;
59
void clearWindowObj();
62
KJS::JSObject* m_listener;
66
class JSEventListener : public JSAbstractEventListener {
68
JSEventListener(KJS::JSObject* listener, KJS::Window*, bool html = false);
69
virtual ~JSEventListener();
71
virtual KJS::JSObject* listenerObj() const;
72
virtual KJS::Window* windowObj() const;
73
void clearWindowObj();
76
mutable KJS::ProtectedPtr<KJS::JSObject> m_listener;
79
KJS::ProtectedPtr<KJS::Window> m_win;
82
class JSLazyEventListener : public JSEventListener {
84
JSLazyEventListener(const String& functionName, const String& code, KJS::Window*, Node*, int lineNumber = 0);
85
virtual KJS::JSObject* listenerObj() const;
88
virtual KJS::JSValue* eventParameterName() const;
89
void parseCode() const;
91
mutable String m_functionName;
92
mutable String m_code;
93
mutable bool m_parsed;
98
KJS::JSValue* getNodeEventListener(Node*, const AtomicString& eventType);
100
class JSClipboard : public KJS::DOMObject {
102
JSClipboard(KJS::ExecState*, Clipboard*);
103
virtual ~JSClipboard();
105
virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
106
KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
107
virtual void put(KJS::ExecState*, const KJS::Identifier&, KJS::JSValue*, int attr = KJS::None);
108
void putValueProperty(KJS::ExecState*, int token, KJS::JSValue*, int attr);
110
virtual const KJS::ClassInfo* classInfo() const { return &info; }
111
static const KJS::ClassInfo info;
113
enum { ClearData, GetData, SetData, Types, SetDragImage, DropEffect, EffectAllowed };
115
Clipboard* impl() const { return m_impl.get(); }
118
RefPtr<Clipboard> m_impl;
121
KJS::JSValue* toJS(KJS::ExecState*, Clipboard*);
122
Clipboard* toClipboard(KJS::JSValue*);
124
} // namespace WebCore
126
#endif // kjs_events_h