dom2_events.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 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 KHTML_EXPORT 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 KHTML_EXPORT 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
00245 void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
00246
00251 EventImpl *handle() const;
00252 bool isNull() const;
00253
00254 protected:
00255 Event(EventImpl *i);
00256 EventImpl *impl;
00257 };
00258
00259
00267 class KHTML_EXPORT EventException
00268 {
00269 public:
00270 EventException(unsigned short _code);
00271 EventException(const EventException &other);
00272 EventException & operator = (const EventException &other);
00273 virtual ~EventException() {}
00274
00284 enum EventExceptionCode {
00285 UNSPECIFIED_EVENT_TYPE_ERR = 0
00286 };
00287
00288 unsigned short code;
00289 };
00290
00291
00299 class KHTML_EXPORT UIEvent : public Event {
00300 public:
00301 UIEvent();
00302 UIEvent(const UIEvent &other);
00303 UIEvent(const Event &other);
00304 UIEvent & operator = (const UIEvent &other);
00305 UIEvent & operator = (const Event &other);
00306 virtual ~UIEvent();
00307
00313 AbstractView view() const;
00314
00320 long detail() const;
00321
00326 int keyCode() const;
00327
00332 int charCode() const;
00333
00338 int pageX() const;
00339 int pageY() const;
00340
00345 int layerX() const;
00346 int layerY() const;
00347
00352 int which() const;
00353
00374 void initUIEvent(const DOMString &typeArg,
00375 bool canBubbleArg,
00376 bool cancelableArg,
00377 const AbstractView &viewArg,
00378 long detailArg);
00379 protected:
00380 UIEvent(UIEventImpl *impl);
00381 };
00382
00383
00384
00385
00404 class KHTML_EXPORT MouseEvent : public UIEvent {
00405 public:
00406 MouseEvent();
00407 MouseEvent(const MouseEvent &other);
00408 MouseEvent(const Event &other);
00409 MouseEvent & operator = (const MouseEvent &other);
00410 MouseEvent & operator = (const Event &other);
00411 virtual ~MouseEvent();
00412
00418 long screenX() const;
00419
00425 long screenY() const;
00426
00432 long clientX() const;
00433
00439 long clientY() const;
00440
00445 bool ctrlKey() const;
00446
00452 bool shiftKey() const;
00453
00460 bool altKey() const;
00461
00468 bool metaKey() const;
00469
00480 unsigned short button() const;
00481
00489 Node relatedTarget() const;
00490
00530 void initMouseEvent(const DOMString &typeArg,
00531 bool canBubbleArg,
00532 bool cancelableArg,
00533 const AbstractView &viewArg,
00534 long detailArg,
00535 long screenXArg,
00536 long screenYArg,
00537 long clientXArg,
00538 long clientYArg,
00539 bool ctrlKeyArg,
00540 bool altKeyArg,
00541 bool shiftKeyArg,
00542 bool metaKeyArg,
00543 unsigned short buttonArg,
00544 const Node &relatedTargetArg);
00545 protected:
00546 MouseEvent(MouseEventImpl *impl);
00547 };
00548
00549
00556 class KHTML_EXPORT TextEvent : public UIEvent {
00557 public:
00558 TextEvent();
00559 TextEvent(const TextEvent &other);
00560 TextEvent(const Event &other);
00561 TextEvent & operator = (const TextEvent &other);
00562 TextEvent & operator = (const Event &other);
00563 virtual ~TextEvent();
00564
00602 void initTextEvent(const DOMString &typeArg,
00603 bool canBubbleArg,
00604 bool cancelableArg,
00605 const AbstractView &viewArg,
00606 long detailArg,
00607 const DOMString &outputStringArg,
00608 unsigned long keyValArg,
00609 unsigned long virtKeyValArg,
00610 bool inputGeneratedArg,
00611 bool numPadArg);
00612
00645 void initModifier(unsigned long modifierArg, bool valueArg);
00646
00663 bool inputGenerated() const;
00664
00672 unsigned long keyVal() const;
00673
00681 bool numPad() const;
00682
00692 DOMString outputString() const;
00701 unsigned long virtKeyVal() const;
00702
00735 bool checkModifier(unsigned long modiferArg);
00736
00737 protected:
00738 TextEvent(TextEventImpl *impl);
00739 };
00740
00741
00749 class KHTML_EXPORT MutationEvent : public Event {
00750 public:
00751 MutationEvent();
00752 MutationEvent(const MutationEvent &other);
00753 MutationEvent(const Event &other);
00754 MutationEvent & operator = (const MutationEvent &other);
00755 MutationEvent & operator = (const Event &other);
00756 virtual ~MutationEvent();
00757
00768 enum attrChangeType {
00769 MODIFICATION = 1,
00770 ADDITION = 2,
00771 REMOVAL = 3
00772 };
00773
00774
00785 Node relatedNode() const;
00786
00793 DOMString prevValue() const;
00794
00800 DOMString newValue() const;
00801
00807 DOMString attrName() const;
00808
00815 unsigned short attrChange() const;
00816
00842 void initMutationEvent(const DOMString &typeArg,
00843 bool canBubbleArg,
00844 bool cancelableArg,
00845 const Node &relatedNodeArg,
00846 const DOMString &prevValueArg,
00847 const DOMString &newValueArg,
00848 const DOMString &attrNameArg,
00849 unsigned short attrChangeArg);
00850 protected:
00851 MutationEvent(MutationEventImpl *impl);
00852 };
00853
00854
00855
00856 }
00857 #endif
This file is part of the documentation for khtml Library Version 3.4.0.