• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • dom
dom2_events.h
Go to the documentation of this file.
1/*
2 * This file is part of the DOM implementation for KDE.
3 *
4 * Copyright 2001 Peter Kelly (pmk@post.com)
5 * Copyright 2003 Apple Computer, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 * This file includes excerpts from the Document Object Model (DOM)
23 * Level 3 Events Specification (Working Group Note 07 November 2003)
24 * http://www.w3.org/TR/DOM-Level-3-Events/
25 * Copyright © 2003 World Wide Web Consortium , (Massachusetts Institute of
26 * Technology, European Research Consortium for Informatics and Mathematics,
27 * Keio University ). All Rights Reserved.
28 *
29 */
30
31#ifndef _DOM_Events_h_
32#define _DOM_Events_h_
33
34#include <dom/dom_node.h>
35#include <dom/dom_misc.h>
36
37namespace DOM {
38
39class Event;
40class EventException;
41class UIEvent;
42class MouseEvent;
43class TextEvent;
44class MutationEvent;
45class AbstractView;
46
47class EventListenerImpl;
48class EventImpl;
49class UIEventImpl;
50class MouseEventImpl;
51class MutationEventImpl;
52
53
54
70class KHTML_EXPORT EventListener : public DomShared {
71public:
72 EventListener();
73 virtual ~EventListener();
74
84 virtual void handleEvent(Event &evt);
85
94 virtual DOMString eventListenerType();
95
96protected:
101 EventListenerImpl *impl;
102};
103
104
117class KHTML_EXPORT Event {
118 friend class Document;
119 friend class NodeImpl;
120 friend class DocumentImpl;
121public:
122 Event();
123 Event(const Event &other);
124 virtual ~Event();
125
126 Event & operator = (const Event &other);
127
139 enum PhaseType {
140 CAPTURING_PHASE = 1,
141 AT_TARGET = 2,
142 BUBBLING_PHASE = 3
143 };
144
149 DOMString type() const;
150
156 Node target() const;
157
164 Node currentTarget() const;
165
170 unsigned short eventPhase() const;
171
177 bool bubbles() const;
178
185 bool cancelable() const;
186
195 DOMTimeStamp timeStamp() const;
196
205 void stopPropagation();
206
219 void preventDefault();
220
246 void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
247
252 EventImpl *handle() const;
253 bool isNull() const;
254
255 Event(EventImpl *i);
256protected:
257 EventImpl *impl;
258};
259
260
268class KHTML_EXPORT EventException
269{
270public:
271 EventException(unsigned short _code);
272 EventException(const EventException &other);
273 EventException & operator = (const EventException &other);
274 virtual ~EventException() {}
275
285 enum EventExceptionCode {
286 UNSPECIFIED_EVENT_TYPE_ERR = 0,
287 _EXCEPTION_OFFSET = 3000,
288 _EXCEPTION_MAX = 3999
289 };
290
291 unsigned short code;
292
294 DOMString codeAsString() const;
295
297 static DOMString codeAsString(int cssCode);
298
300 static bool isEventExceptionCode(int exceptioncode);
301
302};
303
304
312class KHTML_EXPORT UIEvent : public Event {
313public:
314 UIEvent();
315 UIEvent(const UIEvent &other);
316 UIEvent(const Event &other);
317 UIEvent & operator = (const UIEvent &other);
318 UIEvent & operator = (const Event &other);
319 virtual ~UIEvent();
320
326 AbstractView view() const;
327
333 long detail() const;
334
339 int keyCode() const;
340
345 int charCode() const;
346
351 int pageX() const;
352 int pageY() const;
353
358 int layerX() const;
359 int layerY() const;
360
365 int which() const;
366
387 void initUIEvent(const DOMString &typeArg,
388 bool canBubbleArg,
389 bool cancelableArg,
390 const AbstractView &viewArg,
391 long detailArg);
392protected:
393 UIEvent(UIEventImpl *impl);
394};
395
396
397
398
417class KHTML_EXPORT MouseEvent : public UIEvent {
418public:
419 MouseEvent();
420 MouseEvent(const MouseEvent &other);
421 MouseEvent(const Event &other);
422 MouseEvent & operator = (const MouseEvent &other);
423 MouseEvent & operator = (const Event &other);
424 virtual ~MouseEvent();
425
431 long screenX() const;
432
438 long screenY() const;
439
445 long clientX() const;
446
452 long clientY() const;
453
458 bool ctrlKey() const;
459
465 bool shiftKey() const;
466
473 bool altKey() const;
474
481 bool metaKey() const;
482
493 unsigned short button() const;
494
502 Node relatedTarget() const;
503
543 void initMouseEvent(const DOMString &typeArg,
544 bool canBubbleArg,
545 bool cancelableArg,
546 const AbstractView &viewArg,
547 long detailArg,
548 long screenXArg,
549 long screenYArg,
550 long clientXArg,
551 long clientYArg,
552 bool ctrlKeyArg,
553 bool altKeyArg,
554 bool shiftKeyArg,
555 bool metaKeyArg,
556 unsigned short buttonArg,
557 const Node &relatedTargetArg);
558protected:
559 MouseEvent(MouseEventImpl *impl);
560};
561
568class KHTML_EXPORT TextEvent : public UIEvent {
569public:
570 TextEvent();
571 TextEvent(const TextEvent &other);
572 TextEvent(const Event &other);
573 TextEvent & operator = (const TextEvent &other);
574 TextEvent & operator = (const Event &other);
575 virtual ~TextEvent();
576
595 void initTextEvent(const DOMString &typeArg,
596 bool canBubbleArg,
597 bool cancelableArg,
598 const AbstractView &viewArg,
599 const DOMString &dataArg);
600
608 DOMString data() const;
609};
610
611
630class KHTML_EXPORT KeyboardEvent : public UIEvent {
631public:
632 KeyboardEvent();
633 KeyboardEvent(const KeyboardEvent &other);
634 KeyboardEvent(const Event &other);
635 KeyboardEvent & operator = (const KeyboardEvent &other);
636 KeyboardEvent & operator = (const Event &other);
637 virtual ~KeyboardEvent();
638
639 enum KeyLocation {
647 DOM_KEY_LOCATION_STANDARD = 0x00,
648
656 DOM_KEY_LOCATION_LEFT = 0x01,
657
665 DOM_KEY_LOCATION_RIGHT = 0x02,
666
672 DOM_KEY_LOCATION_NUMPAD = 0x03
673 };
674
682 DOMString keyIdentifier() const;
683
691 unsigned long keyLocation() const;
692
698 bool ctrlKey() const;
699
705 bool shiftKey() const;
706
712 bool altKey() const;
713
719 bool metaKey() const;
720
735 bool getModifierState(DOMString keyIdentifierArg) const;
736
737
761 void initKeyboardEvent(DOMString typeArg,
762 bool canBubbleArg,
763 bool cancelableArg,
764 AbstractView viewArg,
765 DOMString keyIdentifierArg,
766 unsigned long keyLocationArg,
767 DOMString modifiersList);
768};
769
770
778class KHTML_EXPORT MutationEvent : public Event {
779public:
780 MutationEvent();
781 MutationEvent(const MutationEvent &other);
782 MutationEvent(const Event &other);
783 MutationEvent & operator = (const MutationEvent &other);
784 MutationEvent & operator = (const Event &other);
785 virtual ~MutationEvent();
786
797 enum attrChangeType {
798 MODIFICATION = 1,
799 ADDITION = 2,
800 REMOVAL = 3
801 };
802
803
814 Node relatedNode() const;
815
822 DOMString prevValue() const;
823
829 DOMString newValue() const;
830
836 DOMString attrName() const;
837
844 unsigned short attrChange() const;
845
871 void initMutationEvent(const DOMString &typeArg,
872 bool canBubbleArg,
873 bool cancelableArg,
874 const Node &relatedNodeArg,
875 const DOMString &prevValueArg,
876 const DOMString &newValueArg,
877 const DOMString &attrNameArg,
878 unsigned short attrChangeArg);
879protected:
880 MutationEvent(MutationEventImpl *impl);
881};
882
883
884
885} //namespace
886#endif
DOM::AbstractView
Introduced in DOM Level 2.
Definition dom2_views.h:41
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition dom_string.h:44
DOM::DomShared::DomShared
DomShared()
Definition dom_misc.h:39
DOM::EventException
Introduced in DOM Level 2:
Definition dom2_events.h:269
DOM::EventException::EventException
EventException(unsigned short _code)
Definition dom2_events.cpp:180
DOM::EventException::EventExceptionCode
EventExceptionCode
An integer indicating the type of error generated.
Definition dom2_events.h:285
DOM::EventException::_EXCEPTION_OFFSET
@ _EXCEPTION_OFFSET
Definition dom2_events.h:287
DOM::EventException::UNSPECIFIED_EVENT_TYPE_ERR
@ UNSPECIFIED_EVENT_TYPE_ERR
Definition dom2_events.h:286
DOM::EventException::_EXCEPTION_MAX
@ _EXCEPTION_MAX
Definition dom2_events.h:288
DOM::EventException::codeAsString
DOMString codeAsString() const
Returns the name of this error.
Definition dom2_events.cpp:198
DOM::EventException::~EventException
virtual ~EventException()
Definition dom2_events.h:274
DOM::EventException::isEventExceptionCode
static bool isEventExceptionCode(int exceptioncode)
Definition dom2_events.cpp:203
DOM::EventException::code
unsigned short code
Definition dom2_events.h:291
DOM::EventListener::impl
EventListenerImpl * impl
Definition dom2_events.h:101
DOM::EventListener::handleEvent
virtual void handleEvent(Event &evt)
This method is called whenever an event occurs of the type for which the EventListener interface was ...
Definition dom2_events.cpp:38
DOM::EventListener::EventListener
EventListener()
Definition dom2_events.cpp:30
DOM::EventListener::eventListenerType
virtual DOMString eventListenerType()
Definition dom2_events.cpp:42
DOM::Event
Introduced in DOM Level 2.
Definition dom2_events.h:117
DOM::Event::Event
Event()
Definition dom2_events.cpp:49
DOM::Event::NodeImpl
friend class NodeImpl
Definition dom2_events.h:119
DOM::Event::impl
EventImpl * impl
Definition dom2_events.h:257
DOM::Event::DocumentImpl
friend class DocumentImpl
Definition dom2_events.h:120
DOM::Event::Document
friend class Document
Definition dom2_events.h:118
DOM::Event::PhaseType
PhaseType
An integer indicating which phase of event flow is being processed.
Definition dom2_events.h:139
DOM::Event::CAPTURING_PHASE
@ CAPTURING_PHASE
Definition dom2_events.h:140
DOM::Event::AT_TARGET
@ AT_TARGET
Definition dom2_events.h:141
DOM::Event::BUBBLING_PHASE
@ BUBBLING_PHASE
Definition dom2_events.h:142
DOM::KeyboardEvent::KeyLocation
KeyLocation
Definition dom2_events.h:639
DOM::KeyboardEvent::DOM_KEY_LOCATION_LEFT
@ DOM_KEY_LOCATION_LEFT
The key activated is in the left key location (there is more than one possible location for this key)...
Definition dom2_events.h:656
DOM::KeyboardEvent::DOM_KEY_LOCATION_STANDARD
@ DOM_KEY_LOCATION_STANDARD
The key activation is not distinguished as the left or right version of the key, and did not originat...
Definition dom2_events.h:647
DOM::KeyboardEvent::DOM_KEY_LOCATION_NUMPAD
@ DOM_KEY_LOCATION_NUMPAD
The key activation originated on the numeric keypad or with a virtual key corresponding to the numeri...
Definition dom2_events.h:672
DOM::KeyboardEvent::DOM_KEY_LOCATION_RIGHT
@ DOM_KEY_LOCATION_RIGHT
The key activated is in the right key location (there is more than one possible location for this key...
Definition dom2_events.h:665
DOM::KeyboardEvent::KeyboardEvent
KeyboardEvent()
Definition dom2_events.cpp:536
DOM::MouseEvent
Introduced in DOM Level 2.
Definition dom2_events.h:417
DOM::MouseEvent::clientX
long clientX() const
The horizontal coordinate at which the event occurred relative to the DOM implementation's client are...
Definition dom2_events.cpp:399
DOM::MouseEvent::altKey
bool altKey() const
Used to indicate whether the 'alt' key was depressed during the firing of the event.
Definition dom2_events.cpp:431
DOM::MouseEvent::clientY
long clientY() const
The vertical coordinate at which the event occurred relative to the DOM implementation's client area.
Definition dom2_events.cpp:407
DOM::MouseEvent::screenX
long screenX() const
The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate...
Definition dom2_events.cpp:383
DOM::MouseEvent::relatedTarget
Node relatedTarget() const
Used to identify a secondary EventTarget related to a UI event.
Definition dom2_events.cpp:455
DOM::MouseEvent::shiftKey
bool shiftKey() const
Used to indicate whether the 'shift' key was depressed during the firing of the event.
Definition dom2_events.cpp:423
DOM::MouseEvent::MouseEvent
MouseEvent()
Definition dom2_events.cpp:344
DOM::MouseEvent::metaKey
bool metaKey() const
Used to indicate whether the 'meta' key was depressed during the firing of the event.
Definition dom2_events.cpp:439
DOM::MouseEvent::initMouseEvent
void initMouseEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, bool ctrlKeyArg, bool altKeyArg, bool shiftKeyArg, bool metaKeyArg, unsigned short buttonArg, const Node &relatedTargetArg)
The initMouseEvent method is used to initialize the value of a MouseEvent created through the Documen...
Definition dom2_events.cpp:463
DOM::MouseEvent::button
unsigned short button() const
During mouse events caused by the depression or release of a mouse button, button is used to indicate...
Definition dom2_events.cpp:447
DOM::MouseEvent::ctrlKey
bool ctrlKey() const
Used to indicate whether the 'ctrl' key was depressed during the firing of the event.
Definition dom2_events.cpp:415
DOM::MouseEvent::screenY
long screenY() const
The vertical coordinate at which the event occurred relative to the origin of the screen coordinate s...
Definition dom2_events.cpp:391
DOM::MutationEvent
Introduced in DOM Level 2.
Definition dom2_events.h:778
DOM::MutationEvent::attrChangeType
attrChangeType
An integer indicating in which way the Attr was changed.
Definition dom2_events.h:797
DOM::MutationEvent::MODIFICATION
@ MODIFICATION
Definition dom2_events.h:798
DOM::MutationEvent::ADDITION
@ ADDITION
Definition dom2_events.h:799
DOM::MutationEvent::REMOVAL
@ REMOVAL
Definition dom2_events.h:800
DOM::MutationEvent::MutationEvent
MutationEvent()
Definition dom2_events.cpp:621
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition dom_node.h:271
DOM::TextEvent
Introduced in DOM Level 3.
Definition dom2_events.h:568
DOM::TextEvent::TextEvent
TextEvent()
Definition dom2_events.cpp:490
DOM::TextEvent::initTextEvent
void initTextEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg, const DOMString &dataArg)
initTextEvent The initTextEvent method is used to initialize the value of a TextEvent object and has ...
Definition dom2_events.cpp:525
DOM::TextEvent::data
DOMString data() const
data of type DOMString, readonly
DOM::UIEvent
Introduced in DOM Level 2.
Definition dom2_events.h:312
DOM::UIEvent::UIEvent
UIEvent()
Definition dom2_events.cpp:221
DOM::UIEvent::view
AbstractView view() const
The view attribute identifies the AbstractView from which the event was generated.
Definition dom2_events.cpp:260
DOM::UIEvent::pageY
int pageY() const
Definition dom2_events.cpp:299
DOM::UIEvent::layerX
int layerX() const
Non-standard extensions to support Netscape-style layerX and layerY event properties.
Definition dom2_events.cpp:307
DOM::UIEvent::detail
long detail() const
Specifies some detail information about the Event, depending on the type of event.
Definition dom2_events.cpp:268
DOM::UIEvent::layerY
int layerY() const
Definition dom2_events.cpp:315
DOM::UIEvent::charCode
int charCode() const
Non-standard extension to support IE-style charCode event property.
Definition dom2_events.cpp:283
DOM::UIEvent::keyCode
int keyCode() const
Non-standard extension to support IE-style keyCode event property.
Definition dom2_events.cpp:276
DOM::UIEvent::which
int which() const
Non-standard extension to support Netscape-style "which" event property.
Definition dom2_events.cpp:323
DOM::UIEvent::initUIEvent
void initUIEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg, long detailArg)
The initUIEvent method is used to initialize the value of a UIEvent created through the DocumentEvent...
Definition dom2_events.cpp:329
DOM::UIEvent::pageX
int pageX() const
Non-standard extensions to support Netscape-style pageX and pageY event properties.
Definition dom2_events.cpp:291
dom_misc.h
dom_node.h
DOM
This library provides a full-featured HTML parser and widget.
Definition design.h:55
DOM::DOMTimeStamp
unsigned long long DOMTimeStamp
A DOMTimeStamp represents a number of milliseconds.
Definition dom_node.h:1020
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal