NAME

Curses::Toolkit::EventListener - base class for event listeners

VERSION

version 0.100680

DESCRIPTION

Base class for event listener. An event listener is an object that is attached to a widget / window / root window, that is capable of saying if it can handle a given event, and if yes, performs specific action on it.

CONSTRUCTOR

new

input : accepted_events <HASHREF> : keys are a Event class, values are CODEREFs (see below)
        code <CODEREF> : code to be executed if an evet listener can handle the event

The CODEREfs receive an event as argument. If they return true, then the event listener can handle this event

METHODS

can_handle

Given an event, returns true if the listener is capable of handling this event

input : a Curses::Toolkit::Event
output : true or false

send_event

Given an event, send it to the listener. Returns the result of the event code.

input : a Curses::Toolkit::Event
output : the result of the event code execution

enable

Enables the event listener (by default the listener is enabled)

input  : none
output : the event listener

disable

Disables the event listener

input  : none
output : the event listener

is_enabled

Return the state of the listener

input : none output : true or false

is_attached

Returns true if the event listener is already attached to a widget

input  : none
output : true or false

detach

detach the event listener from the widget it is attached to.

input  : none
output : the event listener

AUTHOR

Damien "dams" Krotkine

COPYRIGHT AND LICENSE

This software is copyright (c) 2008 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.