# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# dom2_events.h

    00001 /*
    00002  * This file is part of the DOM implementation for KDE.
    00003  *
    00004  * (C) 2001 Peter Kelly (pmk@post.com)
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the GNU Library General Public
    00008  * License as published by the Free Software Foundation; either
    00009  * version 2 of the License, or (at your option) any later version.
    00010  *
    00011  * This library is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  * Library General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU Library General Public License
    00017  * along with this library; see the file COPYING.LIB.  If not, write to
    00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  * $Id: dom2_events.h,v 1.9.2.1 2003/05/18 12:34:37 mueller Exp $
    00022  */
    00023
    00024 #ifndef _DOM_Events_h_
    00025 #define _DOM_Events_h_
    00026
    00027 #include <dom/dom_node.h>
    00028 #include <dom/dom_misc.h>
    00029
    00030 namespace KJS {
    00031     class Image;
    00032 }
    00033
    00034 namespace DOM {
    00035
    00036 class Event;
    00037 class EventException;
    00038 class UIEvent;
    00039 class MouseEvent;
    00040 class TextEvent;
    00041 class MutationEvent;
    00042 class AbstractView;
    00043
    00044 class EventListenerImpl;
    00045 class EventImpl;
    00046 class UIEventImpl;
    00047 class MouseEventImpl;
    00048 class TextEventImpl;
    00049 class MutationEventImpl;
    00050
    00051
    00052
    00068 class EventListener : public DomShared {
    00069 public:
    00070     EventListener();
    00071     virtual ~EventListener();
    00072
    00082     virtual void handleEvent(Event &evt);
    00083
    00092     virtual DOMString eventListenerType();
    00093
    00094 protected:
    00099     EventListenerImpl *impl;
    00100 };
    00101
    00102
    00115 class Event {
    00116     friend class Document;
    00117     friend class NodeImpl;
    00118     friend class DocumentImpl;
    00119     friend class KJS::Image;
    00120 public:
    00121     Event();
    00122     Event(const Event &other);
    00123     virtual ~Event();
    00124
    00125     Event & operator = (const Event &other);
    00126
    00138     enum PhaseType {
    00139         CAPTURING_PHASE = 1,
    00140         AT_TARGET = 2,
    00141         BUBBLING_PHASE = 3
    00142     };
    00143
    00148     DOMString type() const;
    00149
    00155     Node target() const;
    00156
    00163     Node currentTarget() const;
    00164
    00169     unsigned short eventPhase() const;
    00170
    00176     bool bubbles() const;
    00177
    00184     bool cancelable() const;
    00185
    00194     DOMTimeStamp timeStamp() const;
    00195
    00204     void stopPropagation();
    00205
    00218     void preventDefault();
    00219
    00220
    00246     void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
    00247
    00252     EventImpl *handle() const;
    00253     bool isNull() const;
    00254
    00262     DOMString eventModuleName();
    00263
    00264 protected:
    00265     Event(EventImpl *i);
    00266     EventImpl *impl;
    00267 };
    00268
    00269
    00277 class EventException
    00278 {
    00279 public:
    00280     EventException(unsigned short _code);
    00281     EventException(const EventException &other);
    00282     EventException & operator = (const EventException &other);
    00283     virtual ~EventException() {}
    00284
    00294     enum EventExceptionCode {
    00295         UNSPECIFIED_EVENT_TYPE_ERR     = 0
    00296     };
    00297
    00298     unsigned short code;
    00299 };
    00300
    00301
    00309 class UIEvent : public Event {
    00310 public:
    00311     UIEvent();
    00312     UIEvent(const UIEvent &other);
    00313     UIEvent(const Event &other);
    00314     UIEvent & operator = (const UIEvent &other);
    00315     UIEvent & operator = (const Event &other);
    00316     virtual ~UIEvent();
    00317
    00323     AbstractView view() const;
    00324
    00330     long detail() const;
    00331
    00332
    00353     void initUIEvent(const DOMString &typeArg,
    00354                                  bool canBubbleArg,
    00355                                  bool cancelableArg,
    00356                                  const AbstractView &viewArg,
    00357                                  long detailArg);
    00358 protected:
    00359     UIEvent(UIEventImpl *impl);
    00360 };
    00361
    00362
    00363
    00364
    00383 class MouseEvent : public UIEvent {
    00384 public:
    00385     MouseEvent();
    00386     MouseEvent(const MouseEvent &other);
    00387     MouseEvent(const Event &other);
    00388     MouseEvent & operator = (const MouseEvent &other);
    00389     MouseEvent & operator = (const Event &other);
    00390     virtual ~MouseEvent();
    00391
    00397     long screenX() const;
    00398
    00404     long screenY() const;
    00405
    00411     long clientX() const;
    00412
    00418     long clientY() const;
    00419
    00424     bool ctrlKey() const;
    00425
    00431     bool shiftKey() const;
    00432
    00439     bool altKey() const;
    00440
    00447     bool metaKey() const;
    00448
    00459     unsigned short button() const;
    00460
    00468     Node relatedTarget() const;
    00469
    00509     void initMouseEvent(const DOMString &typeArg,
    00510                                     bool canBubbleArg,
    00511                                     bool cancelableArg,
    00512                                     const AbstractView &viewArg,
    00513                                     long detailArg,
    00514                                     long screenXArg,
    00515                                     long screenYArg,
    00516                                     long clientXArg,
    00517                                     long clientYArg,
    00518                                     bool ctrlKeyArg,
    00519                                     bool altKeyArg,
    00520                                     bool shiftKeyArg,
    00521                                     bool metaKeyArg,
    00522                                     unsigned short buttonArg,
    00523                                     const Node &relatedTargetArg);
    00524 protected:
    00525     MouseEvent(MouseEventImpl *impl);
    00526 };
    00527
    00528 // Introduced in DOM Level 3:
    00535 class TextEvent : public UIEvent {
    00536 public:
    00537     TextEvent();
    00538     TextEvent(const TextEvent &other);
    00539     TextEvent(const Event &other);
    00540     TextEvent & operator = (const TextEvent &other);
    00541     TextEvent & operator = (const Event &other);
    00542     virtual ~TextEvent();
    00543
    00581     void initTextEvent(const DOMString &typeArg,
    00582                       bool canBubbleArg,
    00583                       bool cancelableArg,
    00584                       const AbstractView &viewArg,
    00585                       long detailArg,
    00586                       const DOMString &outputStringArg,
    00587                       unsigned long keyValArg,
    00588                       unsigned long virtKeyValArg,
    00589                       bool inputGeneratedArg,
    00590                       bool numPadArg);
    00591
    00624     void initModifier(unsigned long modifierArg, bool valueArg);
    00625
    00642     bool inputGenerated() const;
    00643
    00651     unsigned long keyVal() const;
    00652
    00660     bool numPad() const;
    00661
    00671     DOMString     outputString() const;
    00680     unsigned long virtKeyVal() const;
    00681
    00714     bool checkModifier(unsigned long modiferArg);
    00715
    00716 protected:
    00717     TextEvent(TextEventImpl *impl);
    00718 };
    00719
    00720
    00728 class MutationEvent : public Event {
    00729 public:
    00730     MutationEvent();
    00731     MutationEvent(const MutationEvent &other);
    00732     MutationEvent(const Event &other);
    00733     MutationEvent & operator = (const MutationEvent &other);
    00734     MutationEvent & operator = (const Event &other);
    00735     virtual ~MutationEvent();
    00736
    00747     enum attrChangeType {
    00748         MODIFICATION = 1,
    00749         ADDITION = 2,
    00750         REMOVAL = 3
    00751     };
    00752
    00753
    00764     Node relatedNode() const;
    00765
    00772     DOMString prevValue() const;
    00773
    00779     DOMString newValue() const;
    00780
    00786     DOMString attrName() const;
    00787
    00794     unsigned short attrChange() const;
    00795
    00821     void initMutationEvent(const DOMString &typeArg,
    00822                                        bool canBubbleArg,
    00823                                        bool cancelableArg,
    00824                                        const Node &relatedNodeArg,
    00825                                        const DOMString &prevValueArg,
    00826                                        const DOMString &newValueArg,
    00827                                        const DOMString &attrNameArg,
    00828                                        unsigned short attrChangeArg);
    00829 protected:
    00830     MutationEvent(MutationEventImpl *impl);
    00831 };
    00832
    00833
    00834
    00835 } //namespace
    00836 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:36 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001