• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • 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 (C) 2001 Peter Kelly (pmk@post.com)
00005  *           (C) 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  */
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 DOM {
00031 
00032 class Event;
00033 class EventException;
00034 class UIEvent;
00035 class MouseEvent;
00036 class TextEvent;
00037 class MutationEvent;
00038 class AbstractView;
00039 
00040 class EventListenerImpl;
00041 class EventImpl;
00042 class UIEventImpl;
00043 class MouseEventImpl;
00044 class KeyEventBaseImpl;
00045 class MutationEventImpl;
00046 
00047 
00048 
00064 class KHTML_EXPORT EventListener : public DomShared {
00065 public:
00066     EventListener();
00067     virtual ~EventListener();
00068 
00078     virtual void handleEvent(Event &evt);
00079 
00088     virtual DOMString eventListenerType();
00089 
00090 protected:
00095     EventListenerImpl *impl;
00096 };
00097 
00098 
00111 class KHTML_EXPORT Event {
00112     friend class Document;
00113     friend class NodeImpl;
00114     friend class DocumentImpl;
00115 public:
00116     Event();
00117     Event(const Event &other);
00118     virtual ~Event();
00119 
00120     Event & operator = (const Event &other);
00121 
00133     enum PhaseType {
00134     CAPTURING_PHASE = 1,
00135     AT_TARGET = 2,
00136     BUBBLING_PHASE = 3
00137     };
00138 
00143     DOMString type() const;
00144 
00150     Node target() const;
00151 
00158     Node currentTarget() const;
00159 
00164     unsigned short eventPhase() const;
00165 
00171     bool bubbles() const;
00172 
00179     bool cancelable() const;
00180 
00189     DOMTimeStamp timeStamp() const;
00190 
00199     void stopPropagation();
00200 
00213     void preventDefault();
00214 
00240     void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
00241 
00246     EventImpl *handle() const;
00247     bool isNull() const;
00248 
00249 protected:
00250     Event(EventImpl *i);
00251     EventImpl *impl;
00252 };
00253 
00254 
00262 class KHTML_EXPORT EventException
00263 {
00264 public:
00265     EventException(unsigned short _code);
00266     EventException(const EventException &other);
00267     EventException & operator = (const EventException &other);
00268     virtual ~EventException() {}
00269 
00279     enum EventExceptionCode {
00280         UNSPECIFIED_EVENT_TYPE_ERR     = 0
00281     };
00282 
00283     unsigned short code;
00284 };
00285 
00286 
00294 class KHTML_EXPORT UIEvent : public Event {
00295 public:
00296     UIEvent();
00297     UIEvent(const UIEvent &other);
00298     UIEvent(const Event &other);
00299     UIEvent & operator = (const UIEvent &other);
00300     UIEvent & operator = (const Event &other);
00301     virtual ~UIEvent();
00302 
00308     AbstractView view() const;
00309 
00315     long detail() const;
00316 
00321     int keyCode() const;
00322 
00327     int charCode() const;
00328 
00333     int pageX() const;
00334     int pageY() const;
00335 
00340     int layerX() const;
00341     int layerY() const;
00342 
00347     int which() const;
00348 
00369     void initUIEvent(const DOMString &typeArg,
00370                                  bool canBubbleArg,
00371                                  bool cancelableArg,
00372                                  const AbstractView &viewArg,
00373                                  long detailArg);
00374 protected:
00375     UIEvent(UIEventImpl *impl);
00376 };
00377 
00378 
00379 
00380 
00399 class KHTML_EXPORT MouseEvent : public UIEvent {
00400 public:
00401     MouseEvent();
00402     MouseEvent(const MouseEvent &other);
00403     MouseEvent(const Event &other);
00404     MouseEvent & operator = (const MouseEvent &other);
00405     MouseEvent & operator = (const Event &other);
00406     virtual ~MouseEvent();
00407 
00413     long screenX() const;
00414 
00420     long screenY() const;
00421 
00427     long clientX() const;
00428 
00434     long clientY() const;
00435 
00440     bool ctrlKey() const;
00441 
00447     bool shiftKey() const;
00448 
00455     bool altKey() const;
00456 
00463     bool metaKey() const;
00464 
00475     unsigned short button() const;
00476 
00484     Node relatedTarget() const;
00485 
00525     void initMouseEvent(const DOMString &typeArg,
00526                                     bool canBubbleArg,
00527                                     bool cancelableArg,
00528                                     const AbstractView &viewArg,
00529                                     long detailArg,
00530                                     long screenXArg,
00531                                     long screenYArg,
00532                                     long clientXArg,
00533                                     long clientYArg,
00534                                     bool ctrlKeyArg,
00535                                     bool altKeyArg,
00536                                     bool shiftKeyArg,
00537                                     bool metaKeyArg,
00538                                     unsigned short buttonArg,
00539                                     const Node &relatedTargetArg);
00540 protected:
00541     MouseEvent(MouseEventImpl *impl);
00542 };
00543 
00544 // Introduced in DOM Level 3:
00555 class KHTML_EXPORT TextEvent : public UIEvent {
00556 public:
00557     TextEvent();
00558     TextEvent(const TextEvent &other);
00559     TextEvent(const Event &other);
00560     TextEvent & operator = (const TextEvent &other);
00561     TextEvent & operator = (const Event &other);
00562     virtual ~TextEvent();
00563 
00601     void initTextEvent(const DOMString &typeArg,
00602                       bool canBubbleArg,
00603                       bool cancelableArg,
00604                       const AbstractView &viewArg,
00605                       long detailArg,
00606                       const DOMString &outputStringArg,
00607                       unsigned long keyValArg,
00608                       unsigned long virtKeyValArg,
00609                       bool inputGeneratedArg,
00610                       bool numPadArg);
00611 
00639     void initModifier(unsigned long modifierArg, bool valueArg);
00640 
00657     bool inputGenerated() const;
00658 
00666     unsigned long keyVal() const;
00667 
00675     bool numPad() const;
00676 
00686     DOMString     outputString() const;
00695     unsigned long virtKeyVal() const;
00696 
00724     bool checkModifier(unsigned long modifierArg); // ### KDE 4: const!
00725 
00726 protected:
00727     TextEvent(KeyEventBaseImpl *impl);
00728 };
00729 
00730 
00738 class KHTML_EXPORT MutationEvent : public Event {
00739 public:
00740     MutationEvent();
00741     MutationEvent(const MutationEvent &other);
00742     MutationEvent(const Event &other);
00743     MutationEvent & operator = (const MutationEvent &other);
00744     MutationEvent & operator = (const Event &other);
00745     virtual ~MutationEvent();
00746 
00757     enum attrChangeType {
00758     MODIFICATION = 1,
00759     ADDITION = 2,
00760     REMOVAL = 3
00761     };
00762 
00763 
00774     Node relatedNode() const;
00775 
00782     DOMString prevValue() const;
00783 
00789     DOMString newValue() const;
00790 
00796     DOMString attrName() const;
00797 
00804     unsigned short attrChange() const;
00805 
00831     void initMutationEvent(const DOMString &typeArg,
00832                                        bool canBubbleArg,
00833                                        bool cancelableArg,
00834                                        const Node &relatedNodeArg,
00835                                        const DOMString &prevValueArg,
00836                                        const DOMString &newValueArg,
00837                                        const DOMString &attrNameArg,
00838                                        unsigned short attrChangeArg);
00839 protected:
00840     MutationEvent(MutationEventImpl *impl);
00841 };
00842 
00843 
00844 
00845 } //namespace
00846 #endif

KHTML

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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