NAME

Mozilla::DOM::KeyEvent

DESCRIPTION

The second argument of GtkMozEmbed's dom_key_* signal handlers will be a Mozilla::DOM::KeyEvent object, which is a wrapper around an instance of Mozilla's nsIDOMKeyEvent interface. This inherits from UIEvent.

Note: although <DOMImplementation|Mozilla::DOM::DOMImplementation>'s HasFeature('KeyEvents', '2.0') (and '3.0' and '') claimed (on my system) that KeyEvents were not supported, I found that you can in fact do key events.

The following constants are available to be compared with GetKeyCode. You can access these either through the (mouse or key) event object, like $event->DOM_VK_TAB, export them all with use Mozilla::DOM::KeyEvent qw(:keycodes), or export them individually.

DOM_VK_CANCEL
DOM_VK_HELP
DOM_VK_BACK_SPACE
DOM_VK_TAB
DOM_VK_CLEAR
DOM_VK_RETURN
DOM_VK_ENTER
DOM_VK_SHIFT
DOM_VK_CONTROL
DOM_VK_ALT
DOM_VK_PAUSE
DOM_VK_CAPS_LOCK
DOM_VK_ESCAPE
DOM_VK_SPACE
DOM_VK_PAGE_UP
DOM_VK_PAGE_DOWN
DOM_VK_END
DOM_VK_HOME
DOM_VK_LEFT
DOM_VK_UP
DOM_VK_RIGHT
DOM_VK_DOWN
DOM_VK_PRINTSCREEN
DOM_VK_INSERT
DOM_VK_DELETE
DOM_VK_x, where x = 0 - 9
DOM_VK_SEMICOLON
DOM_VK_EQUALS
DOM_VK_x, where x = A - Z
DOM_VK_CONTEXT_MENU
DOM_VK_NUMPADx, where x = 0 - 9
DOM_VK_MULTIPLY
DOM_VK_ADD
DOM_VK_SEPARATOR
DOM_VK_SUBTRACT
DOM_VK_DECIMAL
DOM_VK_DIVIDE
DOM_VK_Fx, where x = 1 - 24
DOM_VK_NUM_LOCK
DOM_VK_SCROLL_LOCK
DOM_VK_COMMA
DOM_VK_PERIOD
DOM_VK_SLASH
DOM_VK_BACK_QUOTE
DOM_VK_OPEN_BRACKET
DOM_VK_BACK_SLASH
DOM_VK_CLOSE_BRACKET
DOM_VK_QUOTE
DOM_VK_META

CLASS METHODS

$iid = Mozilla::DOM::KeyEvent->GetIID()

Pass this to QueryInterface.

METHODS

$bool = $event->GetAltKey

    This function returns true if the Alt key was held down when the key event occured. (Note: I found this to not be strictly true.)

$char_code = $event->GetCharCode

    This function gets the character code, which is the Unicode number representing that character (e.g. 'a' is 97). For example, you could pass this number to the `chr' function in Perl.

$bool = $event->GetCtrlKey

    This function returns true if the Ctrl key was held down when the key event occured.

$key_code = $event->GetKeyCode

    This function gets the key code for "special" keys, such as the function keys (e.g., F3), caps lock, right arrow, etc.

$bool = $event->GetMetaKey

    This function returns true if the Meta key was held down when the key event occured.

$bool = $event->GetShiftKey

    This function returns true if the Shift key was held down when the key event occured.

$event->InitKeyEvent($eventType, $canbubble, $cancelable, $ctrlkey, $altkey, $shiftkey, $metakey, $keycode, $charcode)

    • $eventtype (string)

    • $canbubble (boolean)

    • $cancelable (boolean)

    • $ctrlkey (boolean)

    • $altkey (boolean)

    • $shiftkey (boolean)

    • $metakey (boolean)

    • $keycode (integer (long))

    • $charcode (integer (long))

    See Event::InitEvent for more information. This method is basically the same as InitEvent, but with six (seven normally) extra arguments. (XXX: add docs for args)

    Note: I don't see how you can Create or QueryInterface an AbstractView, and trying to pass in 0 or undef was just causing a segfault, so I've omitted what would normally be the 4th argument of this method. If someone can explain why you'd need it and how you'd use it, then I can put it back in.

SEE ALSO

Mozilla::DOM, sections 1.7.4 and Appendix A of the DOM level 3 specification

COPYRIGHT

Copyright (C) 2005, Scott Lanning

This software is licensed under the LGPL. See Mozilla::DOM for a full notice.