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

KHTML

dom2_events.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright 2001 Peter Kelly (pmk@post.com)
00005  * Copyright 2003 Apple Computer, Inc.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021  *
00022  * This file includes excerpts from the Document Object Model (DOM)
00023  * Level 3 Events Specification (Working Group Note 07 November 2003)
00024  * http://www.w3.org/TR/DOM-Level-3-Events/
00025  * Copyright © 2003 World Wide Web Consortium , (Massachusetts Institute of
00026  * Technology, European Research Consortium for Informatics and Mathematics, 
00027  * Keio University ). All Rights Reserved.
00028  *
00029  */
00030 
00031 #ifndef _DOM_Events_h_
00032 #define _DOM_Events_h_
00033 
00034 #include <dom/dom_node.h>
00035 #include <dom/dom_misc.h>
00036 
00037 namespace DOM {
00038 
00039 class Event;
00040 class EventException;
00041 class UIEvent;
00042 class MouseEvent;
00043 class TextEvent;
00044 class MutationEvent;
00045 class AbstractView;
00046 
00047 class EventListenerImpl;
00048 class EventImpl;
00049 class UIEventImpl;
00050 class MouseEventImpl;
00051 class MutationEventImpl;
00052 
00053 
00054 
00070 class KHTML_EXPORT EventListener : public DomShared {
00071 public:
00072     EventListener();
00073     virtual ~EventListener();
00074 
00084     virtual void handleEvent(Event &evt);
00085 
00094     virtual DOMString eventListenerType();
00095 
00096 protected:
00101     EventListenerImpl *impl;
00102 };
00103 
00104 
00117 class KHTML_EXPORT Event {
00118     friend class Document;
00119     friend class NodeImpl;
00120     friend class DocumentImpl;
00121 public:
00122     Event();
00123     Event(const Event &other);
00124     virtual ~Event();
00125 
00126     Event & operator = (const Event &other);
00127 
00139     enum PhaseType {
00140     CAPTURING_PHASE = 1,
00141     AT_TARGET = 2,
00142     BUBBLING_PHASE = 3
00143     };
00144 
00149     DOMString type() const;
00150 
00156     Node target() const;
00157 
00164     Node currentTarget() const;
00165 
00170     unsigned short eventPhase() const;
00171 
00177     bool bubbles() const;
00178 
00185     bool cancelable() const;
00186 
00195     DOMTimeStamp timeStamp() const;
00196 
00205     void stopPropagation();
00206 
00219     void preventDefault();
00220 
00246     void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
00247 
00252     EventImpl *handle() const;
00253     bool isNull() const;
00254 
00255     Event(EventImpl *i);
00256 protected:
00257     EventImpl *impl;
00258 };
00259 
00260 
00268 class KHTML_EXPORT EventException
00269 {
00270 public:
00271     EventException(unsigned short _code);
00272     EventException(const EventException &other);
00273     EventException & operator = (const EventException &other);
00274     virtual ~EventException() {}
00275 
00285     enum EventExceptionCode {
00286         UNSPECIFIED_EVENT_TYPE_ERR     = 0,
00287         _EXCEPTION_OFFSET              = 3000,
00288         _EXCEPTION_MAX                 = 3999
00289     };
00290 
00291     unsigned short code;
00292 
00294     DOMString codeAsString() const;
00295 
00297     static DOMString codeAsString(int cssCode);
00298 
00300     static bool isEventExceptionCode(int exceptioncode);
00301     
00302 };
00303 
00304 
00312 class KHTML_EXPORT UIEvent : public Event {
00313 public:
00314     UIEvent();
00315     UIEvent(const UIEvent &other);
00316     UIEvent(const Event &other);
00317     UIEvent & operator = (const UIEvent &other);
00318     UIEvent & operator = (const Event &other);
00319     virtual ~UIEvent();
00320 
00326     AbstractView view() const;
00327 
00333     long detail() const;
00334 
00339     int keyCode() const;
00340 
00345     int charCode() const;
00346 
00351     int pageX() const;
00352     int pageY() const;
00353 
00358     int layerX() const;
00359     int layerY() const;
00360 
00365     int which() const;
00366 
00387     void initUIEvent(const DOMString &typeArg,
00388                                  bool canBubbleArg,
00389                                  bool cancelableArg,
00390                                  const AbstractView &viewArg,
00391                                  long detailArg);
00392 protected:
00393     UIEvent(UIEventImpl *impl);
00394 };
00395 
00396 
00397 
00398 
00417 class KHTML_EXPORT MouseEvent : public UIEvent {
00418 public:
00419     MouseEvent();
00420     MouseEvent(const MouseEvent &other);
00421     MouseEvent(const Event &other);
00422     MouseEvent & operator = (const MouseEvent &other);
00423     MouseEvent & operator = (const Event &other);
00424     virtual ~MouseEvent();
00425 
00431     long screenX() const;
00432 
00438     long screenY() const;
00439 
00445     long clientX() const;
00446 
00452     long clientY() const;
00453 
00458     bool ctrlKey() const;
00459 
00465     bool shiftKey() const;
00466 
00473     bool altKey() const;
00474 
00481     bool metaKey() const;
00482 
00493     unsigned short button() const;
00494 
00502     Node relatedTarget() const;
00503 
00543     void initMouseEvent(const DOMString &typeArg,
00544                                     bool canBubbleArg,
00545                                     bool cancelableArg,
00546                                     const AbstractView &viewArg,
00547                                     long detailArg,
00548                                     long screenXArg,
00549                                     long screenYArg,
00550                                     long clientXArg,
00551                                     long clientYArg,
00552                                     bool ctrlKeyArg,
00553                                     bool altKeyArg,
00554                                     bool shiftKeyArg,
00555                                     bool metaKeyArg,
00556                                     unsigned short buttonArg,
00557                                     const Node &relatedTargetArg);
00558 protected:
00559     MouseEvent(MouseEventImpl *impl);
00560 };
00561 
00568 class KHTML_EXPORT TextEvent : public UIEvent {
00569 public:
00570     TextEvent();
00571     TextEvent(const TextEvent &other);
00572     TextEvent(const Event &other);
00573     TextEvent & operator = (const TextEvent &other);
00574     TextEvent & operator = (const Event &other);
00575     virtual ~TextEvent();
00576     
00595     void initTextEvent(const DOMString &typeArg,
00596                       bool canBubbleArg,
00597                       bool cancelableArg,
00598                       const AbstractView &viewArg,
00599                       const DOMString &dataArg);
00600 
00608     DOMString data() const;
00609 };
00610 
00611 
00630 class KHTML_EXPORT KeyboardEvent : public UIEvent {
00631 public:
00632     KeyboardEvent();
00633     KeyboardEvent(const KeyboardEvent &other);
00634     KeyboardEvent(const Event &other);
00635     KeyboardEvent & operator = (const KeyboardEvent &other);
00636     KeyboardEvent & operator = (const Event &other);
00637     virtual ~KeyboardEvent();
00638 
00639     enum KeyLocation {
00647         DOM_KEY_LOCATION_STANDARD      = 0x00,
00648 
00656         DOM_KEY_LOCATION_LEFT          = 0x01,
00657 
00665         DOM_KEY_LOCATION_RIGHT         = 0x02,
00666 
00672         DOM_KEY_LOCATION_NUMPAD        = 0x03
00673     };
00674 
00682     DOMString       keyIdentifier() const;
00683 
00691     unsigned long   keyLocation() const;
00692 
00698     bool ctrlKey() const;
00699 
00705     bool shiftKey() const;
00706 
00712     bool altKey() const;
00713 
00719     bool metaKey() const;
00720 
00735     bool getModifierState(DOMString keyIdentifierArg) const;
00736 
00737 
00761     void  initKeyboardEvent(DOMString typeArg,
00762                             bool canBubbleArg,
00763                             bool cancelableArg,
00764                             AbstractView viewArg,
00765                             DOMString keyIdentifierArg,
00766                             unsigned long keyLocationArg,
00767                             DOMString modifiersList);
00768 };
00769 
00770 
00778 class KHTML_EXPORT MutationEvent : public Event {
00779 public:
00780     MutationEvent();
00781     MutationEvent(const MutationEvent &other);
00782     MutationEvent(const Event &other);
00783     MutationEvent & operator = (const MutationEvent &other);
00784     MutationEvent & operator = (const Event &other);
00785     virtual ~MutationEvent();
00786 
00797     enum attrChangeType {
00798     MODIFICATION = 1,
00799     ADDITION = 2,
00800     REMOVAL = 3
00801     };
00802 
00803 
00814     Node relatedNode() const;
00815 
00822     DOMString prevValue() const;
00823 
00829     DOMString newValue() const;
00830 
00836     DOMString attrName() const;
00837 
00844     unsigned short attrChange() const;
00845 
00871     void initMutationEvent(const DOMString &typeArg,
00872                                        bool canBubbleArg,
00873                                        bool cancelableArg,
00874                                        const Node &relatedNodeArg,
00875                                        const DOMString &prevValueArg,
00876                                        const DOMString &newValueArg,
00877                                        const DOMString &attrNameArg,
00878                                        unsigned short attrChangeArg);
00879 protected:
00880     MutationEvent(MutationEventImpl *impl);
00881 };
00882 
00883 
00884 
00885 } //namespace
00886 #endif

KHTML

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal