• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 protected:
00256     Event(EventImpl *i);
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 };
00293 
00294 
00302 class KHTML_EXPORT UIEvent : public Event {
00303 public:
00304     UIEvent();
00305     UIEvent(const UIEvent &other);
00306     UIEvent(const Event &other);
00307     UIEvent & operator = (const UIEvent &other);
00308     UIEvent & operator = (const Event &other);
00309     virtual ~UIEvent();
00310 
00316     AbstractView view() const;
00317 
00323     long detail() const;
00324 
00329     int keyCode() const;
00330 
00335     int charCode() const;
00336 
00341     int pageX() const;
00342     int pageY() const;
00343 
00348     int layerX() const;
00349     int layerY() const;
00350 
00355     int which() const;
00356 
00377     void initUIEvent(const DOMString &typeArg,
00378                                  bool canBubbleArg,
00379                                  bool cancelableArg,
00380                                  const AbstractView &viewArg,
00381                                  long detailArg);
00382 protected:
00383     UIEvent(UIEventImpl *impl);
00384 };
00385 
00386 
00387 
00388 
00407 class KHTML_EXPORT MouseEvent : public UIEvent {
00408 public:
00409     MouseEvent();
00410     MouseEvent(const MouseEvent &other);
00411     MouseEvent(const Event &other);
00412     MouseEvent & operator = (const MouseEvent &other);
00413     MouseEvent & operator = (const Event &other);
00414     virtual ~MouseEvent();
00415 
00421     long screenX() const;
00422 
00428     long screenY() const;
00429 
00435     long clientX() const;
00436 
00442     long clientY() const;
00443 
00448     bool ctrlKey() const;
00449 
00455     bool shiftKey() const;
00456 
00463     bool altKey() const;
00464 
00471     bool metaKey() const;
00472 
00483     unsigned short button() const;
00484 
00492     Node relatedTarget() const;
00493 
00533     void initMouseEvent(const DOMString &typeArg,
00534                                     bool canBubbleArg,
00535                                     bool cancelableArg,
00536                                     const AbstractView &viewArg,
00537                                     long detailArg,
00538                                     long screenXArg,
00539                                     long screenYArg,
00540                                     long clientXArg,
00541                                     long clientYArg,
00542                                     bool ctrlKeyArg,
00543                                     bool altKeyArg,
00544                                     bool shiftKeyArg,
00545                                     bool metaKeyArg,
00546                                     unsigned short buttonArg,
00547                                     const Node &relatedTargetArg);
00548 protected:
00549     MouseEvent(MouseEventImpl *impl);
00550 };
00551 
00558 class KHTML_EXPORT TextEvent : public UIEvent {
00559 public:
00560     TextEvent();
00561     TextEvent(const TextEvent &other);
00562     TextEvent(const Event &other);
00563     TextEvent & operator = (const TextEvent &other);
00564     TextEvent & operator = (const Event &other);
00565     virtual ~TextEvent();
00566     
00585     void initTextEvent(const DOMString &typeArg,
00586                       bool canBubbleArg,
00587                       bool cancelableArg,
00588                       const AbstractView &viewArg,
00589                       const DOMString &dataArg);
00590 
00598     DOMString data() const;
00599 };
00600 
00601 
00620 class KHTML_EXPORT KeyboardEvent : public UIEvent {
00621 public:
00622     KeyboardEvent();
00623     KeyboardEvent(const KeyboardEvent &other);
00624     KeyboardEvent(const Event &other);
00625     KeyboardEvent & operator = (const KeyboardEvent &other);
00626     KeyboardEvent & operator = (const Event &other);
00627     virtual ~KeyboardEvent();
00628 
00629     enum KeyLocation {
00637         DOM_KEY_LOCATION_STANDARD      = 0x00,
00638 
00646         DOM_KEY_LOCATION_LEFT          = 0x01,
00647 
00655         DOM_KEY_LOCATION_RIGHT         = 0x02,
00656 
00662         DOM_KEY_LOCATION_NUMPAD        = 0x03
00663     };
00664 
00672     DOMString       keyIdentifier() const;
00673 
00681     unsigned long   keyLocation() const;
00682 
00688     bool ctrlKey() const;
00689 
00695     bool shiftKey() const;
00696 
00702     bool altKey() const;
00703 
00709     bool metaKey() const;
00710 
00725     bool getModifierState(DOMString keyIdentifierArg) const;
00726 
00727 
00751     void  initKeyboardEvent(DOMString typeArg,
00752                             bool canBubbleArg,
00753                             bool cancelableArg,
00754                             AbstractView viewArg,
00755                             DOMString keyIdentifierArg,
00756                             unsigned long keyLocationArg,
00757                             DOMString modifiersList);
00758 };
00759 
00760 
00768 class KHTML_EXPORT MutationEvent : public Event {
00769 public:
00770     MutationEvent();
00771     MutationEvent(const MutationEvent &other);
00772     MutationEvent(const Event &other);
00773     MutationEvent & operator = (const MutationEvent &other);
00774     MutationEvent & operator = (const Event &other);
00775     virtual ~MutationEvent();
00776 
00787     enum attrChangeType {
00788     MODIFICATION = 1,
00789     ADDITION = 2,
00790     REMOVAL = 3
00791     };
00792 
00793 
00804     Node relatedNode() const;
00805 
00812     DOMString prevValue() const;
00813 
00819     DOMString newValue() const;
00820 
00826     DOMString attrName() const;
00827 
00834     unsigned short attrChange() const;
00835 
00861     void initMutationEvent(const DOMString &typeArg,
00862                                        bool canBubbleArg,
00863                                        bool cancelableArg,
00864                                        const Node &relatedNodeArg,
00865                                        const DOMString &prevValueArg,
00866                                        const DOMString &newValueArg,
00867                                        const DOMString &attrNameArg,
00868                                        unsigned short attrChangeArg);
00869 protected:
00870     MutationEvent(MutationEventImpl *impl);
00871 };
00872 
00873 
00874 
00875 } //namespace
00876 #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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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