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

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • 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 
37 namespace DOM {
38 
39 class Event;
40 class EventException;
41 class UIEvent;
42 class MouseEvent;
43 class TextEvent;
44 class MutationEvent;
45 class AbstractView;
46 
47 class EventListenerImpl;
48 class EventImpl;
49 class UIEventImpl;
50 class MouseEventImpl;
51 class MutationEventImpl;
52 
53 
54 
70 class KHTML_EXPORT EventListener : public DomShared {
71 public:
72  EventListener();
73  virtual ~EventListener();
74 
84  virtual void handleEvent(Event &evt);
85 
94  virtual DOMString eventListenerType();
95 
96 protected:
101  EventListenerImpl *impl;
102 };
103 
104 
117 class KHTML_EXPORT Event {
118  friend class Document;
119  friend class NodeImpl;
120  friend class DocumentImpl;
121 public:
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);
256 protected:
257  EventImpl *impl;
258 };
259 
260 
268 class KHTML_EXPORT EventException
269 {
270 public:
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 
312 class KHTML_EXPORT UIEvent : public Event {
313 public:
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);
392 protected:
393  UIEvent(UIEventImpl *impl);
394 };
395 
396 
397 
398 
417 class KHTML_EXPORT MouseEvent : public UIEvent {
418 public:
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);
558 protected:
559  MouseEvent(MouseEventImpl *impl);
560 };
561 
568 class KHTML_EXPORT TextEvent : public UIEvent {
569 public:
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 
630 class KHTML_EXPORT KeyboardEvent : public UIEvent {
631 public:
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 
778 class KHTML_EXPORT MutationEvent : public Event {
779 public:
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);
879 protected:
880  MutationEvent(MutationEventImpl *impl);
881 };
882 
883 
884 
885 } //namespace
886 #endif
DOM::Event::impl
EventImpl * impl
Definition: dom2_events.h:257
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:270
DOM::AbstractView
Introduced in DOM Level 2.
Definition: dom2_views.h:41
DOM::UIEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:312
DOM::MouseEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:417
DOM::MutationEvent::attrChangeType
attrChangeType
An integer indicating in which way the Attr was changed.
Definition: dom2_events.h:797
DOM::EventException
Introduced in DOM Level 2:
Definition: dom2_events.h:268
DOM::KeyboardEvent
Introduced in DOM Level 3.
Definition: dom2_events.h:630
dom_node.h
DOM::TextEvent
Introduced in DOM Level 3.
Definition: dom2_events.h:568
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::EventException::code
unsigned short code
Definition: dom2_events.h:291
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:245
DOM::MutationEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:778
DOM::EventException::~EventException
virtual ~EventException()
Definition: dom2_events.h:274
dom_misc.h
DOM::EventListener
Introduced in DOM Level 2.
Definition: dom2_events.h:70
DOM::DomShared
Definition: dom_misc.h:36
DOM::EventException::EventExceptionCode
EventExceptionCode
An integer indicating the type of error generated.
Definition: dom2_events.h:285
DOM::Event
Introduced in DOM Level 2.
Definition: dom2_events.h:117
DOM::KeyboardEvent::KeyLocation
KeyLocation
Definition: dom2_events.h:639
DOM::Event::PhaseType
PhaseType
An integer indicating which phase of event flow is being processed.
Definition: dom2_events.h:139
DOM::DOMTimeStamp
unsigned long long DOMTimeStamp
A DOMTimeStamp represents a number of milliseconds.
Definition: dom_node.h:1020
DOM::EventListener::impl
EventListenerImpl * impl
Definition: dom2_events.h:101
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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