• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

DOM::KeyboardEvent

DOM::KeyboardEvent Class Reference

#include <dom2_events.h>

Inheritance diagram for DOM::KeyboardEvent:

Inheritance graph
[legend]

List of all members.


Detailed Description

Introduced in DOM Level 3.

DOM::KeyboardEvent The KeyboardEvent interface provides specific contextual information associated with keyboard devices. Each keyboard event references a key using an identifier. Keyboard events are commonly directed at the element that has the focus.

The KeyboardEvent interface provides convenient attributes for some common modifiers keys: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey, KeyboardEvent.altKey, KeyboardEvent.metaKey. These attributes are equivalent to use the method KeyboardEvent.getModifierState(keyIdentifierArg) with "Control", "Shift", "Alt", or "Meta" respectively.

To create an instance of the KeyboardEvent interface, use the DocumentEvent.createEvent("KeyboardEvent") method call.

Definition at line 620 of file dom2_events.h.


Public Types

enum  KeyLocation { DOM_KEY_LOCATION_STANDARD = 0x00, DOM_KEY_LOCATION_LEFT = 0x01, DOM_KEY_LOCATION_RIGHT = 0x02, DOM_KEY_LOCATION_NUMPAD = 0x03 }

Public Member Functions

bool altKey () const
bool ctrlKey () const
bool getModifierState (DOMString keyIdentifierArg) const
void initKeyboardEvent (DOMString typeArg, bool canBubbleArg, bool cancelableArg, AbstractView viewArg, DOMString keyIdentifierArg, unsigned long keyLocationArg, DOMString modifiersList)
 KeyboardEvent (const Event &other)
 KeyboardEvent (const KeyboardEvent &other)
 KeyboardEvent ()
DOMString keyIdentifier () const
unsigned long keyLocation () const
bool metaKey () const
KeyboardEvent & operator= (const Event &other)
KeyboardEvent & operator= (const KeyboardEvent &other)
bool shiftKey () const
virtual ~KeyboardEvent ()

Member Enumeration Documentation

enum DOM::KeyboardEvent::KeyLocation

Enumerator:
DOM_KEY_LOCATION_STANDARD  The key activation is not distinguished as the left or right version of the key, and did not originate from the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad).

Example: the 'Q' key on a PC 101 Key US keyboard.

DOM_KEY_LOCATION_LEFT  The key activated is in the left key location (there is more than one possible location for this key).

Example: the left Shift key on a PC 101 Key US keyboard.

Note: KHTML currently always considers modifier keys to be on the left

DOM_KEY_LOCATION_RIGHT  The key activated is in the right key location (there is more than one possible location for this key).

Example: the right Shift key on a PC 101 Key US keyboard.

Note: KHTML currently always considers modifier keys to be on the left

DOM_KEY_LOCATION_NUMPAD  The key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad.

Example: the '1' key on a PC 101 Key US keyboard located on the numeric pad.

Definition at line 629 of file dom2_events.h.


Constructor & Destructor Documentation

KeyboardEvent::KeyboardEvent (  ) 

Definition at line 510 of file dom2_events.cpp.

KeyboardEvent::KeyboardEvent ( const KeyboardEvent &  other  ) 

Definition at line 514 of file dom2_events.cpp.

KeyboardEvent::KeyboardEvent ( const Event &  other  ) 

Definition at line 518 of file dom2_events.cpp.

KeyboardEvent::~KeyboardEvent (  )  [virtual]

Definition at line 541 of file dom2_events.cpp.


Member Function Documentation

bool KeyboardEvent::altKey (  )  const

altKey of type boolean, readonly

true if the alt (Alt) key modifier is activated.

Definition at line 565 of file dom2_events.cpp.

bool KeyboardEvent::ctrlKey (  )  const

ctrlKey of type boolean, readonly

true if the control (Ctrl) key modifier is activated.

Definition at line 555 of file dom2_events.cpp.

bool KeyboardEvent::getModifierState ( DOMString  keyIdentifierArg  )  const

getModifierState

This methods queries the state of a modifier using a key identifier

Parameters:

keyIdentifierArg of type DOMString A modifier key identifier. Supported modifier keys are "Alt", "Control", "Meta", "Shift".

Return Value boolean true if it is modifier key and the modifier is activated, false otherwise.

Definition at line 575 of file dom2_events.cpp.

void KeyboardEvent::initKeyboardEvent ( DOMString  typeArg,
bool  canBubbleArg,
bool  cancelableArg,
AbstractView  viewArg,
DOMString  keyIdentifierArg,
unsigned long  keyLocationArg,
DOMString  modifiersList 
)

initKeyboardEvent

The initKeyboardEvent method is used to initialize the value of a KeyboardEvent object and has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.

Parameters: typeArg of type DOMString Specifies the event type. canBubbleArg of type boolean Specifies whether or not the event can bubble. cancelableArg of type boolean Specifies whether or not the event's default action can be prevent. viewArg of type views::AbstractView Specifies the TextEvent's AbstractView. keyIdentifierArg of type DOMString Specifies KeyboardEvent.keyIdentifier. keyLocationArg of type unsigned long Specifies KeyboardEvent.keyLocation. modifiersList of type DOMString A white space separated list of modifier key identifiers to be activated on this object.

Definition at line 580 of file dom2_events.cpp.

DOMString KeyboardEvent::keyIdentifier (  )  const

keyIdentifier of type DOMString, readonly

keyIdentifier holds the identifier of the key. The key identifiers are defined in Appendix A.2 "Key identifiers set" (http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set)

Definition at line 545 of file dom2_events.cpp.

unsigned long KeyboardEvent::keyLocation (  )  const

keyLocation of type unsigned long, readonly

The keyLocation attribute contains an indication of the location of they key on the device. See the KeyLocation enum for possible values

Definition at line 550 of file dom2_events.cpp.

bool KeyboardEvent::metaKey (  )  const

metaKey of type boolean, readonly

true if the meta (Meta) key modifier is activated.

Definition at line 570 of file dom2_events.cpp.

KeyboardEvent & KeyboardEvent::operator= ( const Event &  other  ) 

Reimplemented from DOM::UIEvent.

Definition at line 529 of file dom2_events.cpp.

KeyboardEvent & KeyboardEvent::operator= ( const KeyboardEvent &  other  ) 

Definition at line 523 of file dom2_events.cpp.

bool KeyboardEvent::shiftKey (  )  const

shiftKey of type boolean, readonly

true if the shift (Shift) key modifier is activated.

Definition at line 560 of file dom2_events.cpp.


The documentation for this class was generated from the following files:
  • dom2_events.h
  • dom2_events.cpp

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