dom2_events.h
/*
* This file is part of the DOM implementation for KDE.
*
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2003 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef _DOM_Events_h_
#define _DOM_Events_h_
#include <dom/dom_node.h>
#include <dom/dom_misc.h>
namespace DOM {
class Event;
class EventException;
class UIEvent;
class MouseEvent;
class TextEvent;
class MutationEvent;
class AbstractView;
class EventListenerImpl;
class EventImpl;
class UIEventImpl;
class MouseEventImpl;
class KeyEventBaseImpl;
class MutationEventImpl;
class KHTML_EXPORT EventListener : public DomShared {
public:
EventListener();
virtual ~EventListener();
virtual void handleEvent(Event &evt);
virtual DOMString eventListenerType();
protected:
EventListenerImpl *impl;
};
class KHTML_EXPORT Event {
friend class Document;
friend class NodeImpl;
friend class DocumentImpl;
public:
Event();
Event(const Event &other);
virtual ~Event();
Event & operator = (const Event &other);
enum PhaseType {
CAPTURING_PHASE = 1,
AT_TARGET = 2,
BUBBLING_PHASE = 3
};
DOMString type() const;
Node target() const;
Node currentTarget() const;
unsigned short eventPhase() const;
bool bubbles() const;
bool cancelable() const;
DOMTimeStamp timeStamp() const;
void stopPropagation();
void preventDefault();
void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
EventImpl *handle() const;
bool isNull() const;
protected:
Event(EventImpl *i);
EventImpl *impl;
};
class KHTML_EXPORT EventException
{
public:
EventException(unsigned short _code);
EventException(const EventException &other);
EventException & operator = (const EventException &other);
virtual ~EventException() {}
enum EventExceptionCode {
UNSPECIFIED_EVENT_TYPE_ERR = 0
};
unsigned short code;
};
class KHTML_EXPORT UIEvent : public Event {
public:
UIEvent();
UIEvent(const UIEvent &other);
UIEvent(const Event &other);
UIEvent & operator = (const UIEvent &other);
UIEvent & operator = (const Event &other);
virtual ~UIEvent();
AbstractView view() const;
long detail() const;
int keyCode() const;
int charCode() const;
int pageX() const;
int pageY() const;
int layerX() const;
int layerY() const;
int which() const;
void initUIEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
const AbstractView &viewArg,
long detailArg);
protected:
UIEvent(UIEventImpl *impl);
};
class KHTML_EXPORT MouseEvent : public UIEvent {
public:
MouseEvent();
MouseEvent(const MouseEvent &other);
MouseEvent(const Event &other);
MouseEvent & operator = (const MouseEvent &other);
MouseEvent & operator = (const Event &other);
virtual ~MouseEvent();
long screenX() const;
long screenY() const;
long clientX() const;
long clientY() const;
bool ctrlKey() const;
bool shiftKey() const;
bool altKey() const;
bool metaKey() const;
unsigned short button() const;
Node relatedTarget() const;
void initMouseEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
const AbstractView &viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
long clientYArg,
bool ctrlKeyArg,
bool altKeyArg,
bool shiftKeyArg,
bool metaKeyArg,
unsigned short buttonArg,
const Node &relatedTargetArg);
protected:
MouseEvent(MouseEventImpl *impl);
};
// Introduced in DOM Level 3:
class KHTML_EXPORT TextEvent : public UIEvent {
public:
TextEvent();
TextEvent(const TextEvent &other);
TextEvent(const Event &other);
TextEvent & operator = (const TextEvent &other);
TextEvent & operator = (const Event &other);
virtual ~TextEvent();
void initTextEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
const AbstractView &viewArg,
long detailArg,
const DOMString &outputStringArg,
unsigned long keyValArg,
unsigned long virtKeyValArg,
bool inputGeneratedArg,
bool numPadArg);
void initModifier(unsigned long modifierArg, bool valueArg);
bool inputGenerated() const;
unsigned long keyVal() const;
bool numPad() const;
DOMString outputString() const;
unsigned long virtKeyVal() const;
bool checkModifier(unsigned long modifierArg); // ### KDE 4: const!
protected:
TextEvent(KeyEventBaseImpl *impl);
};
class KHTML_EXPORT MutationEvent : public Event {
public:
MutationEvent();
MutationEvent(const MutationEvent &other);
MutationEvent(const Event &other);
MutationEvent & operator = (const MutationEvent &other);
MutationEvent & operator = (const Event &other);
virtual ~MutationEvent();
enum attrChangeType {
MODIFICATION = 1,
ADDITION = 2,
REMOVAL = 3
};
Node relatedNode() const;
DOMString prevValue() const;
DOMString newValue() const;
DOMString attrName() const;
unsigned short attrChange() const;
void initMutationEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
const Node &relatedNodeArg,
const DOMString &prevValueArg,
const DOMString &newValueArg,
const DOMString &attrNameArg,
unsigned short attrChangeArg);
protected:
MutationEvent(MutationEventImpl *impl);
};
} //namespace
#endif
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:274
DOM::AbstractView
Introduced in DOM Level 2.
Definition: dom2_views.h:41
DOM::UIEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:294
DOM::MouseEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:399
DOM::MutationEvent::attrChangeType
attrChangeType
An integer indicating in which way the Attr was changed.
Definition: dom2_events.h:757
DOM::EventException
Introduced in DOM Level 2:
Definition: dom2_events.h:262
DOM::TextEvent
DOM::TextEvent The detail attribute inherited from UIEvent is used to indicate the number of keypress...
Definition: dom2_events.h:555
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:245
DOM::MutationEvent
Introduced in DOM Level 2.
Definition: dom2_events.h:738
DOM::EventListener
Introduced in DOM Level 2.
Definition: dom2_events.h:64
DOM::EventException::EventExceptionCode
EventExceptionCode
An integer indicating the type of error generated.
Definition: dom2_events.h:279
DOM::Event
Introduced in DOM Level 2.
Definition: dom2_events.h:111
DOM::Event::PhaseType
PhaseType
An integer indicating which phase of event flow is being processed.
Definition: dom2_events.h:133
DOM::DOMTimeStamp
unsigned long long DOMTimeStamp
A DOMTimeStamp represents a number of milliseconds.
Definition: dom_node.h:987

KDE Home | KDE Accessibility Home | Description of Access Keys