Public Member Functions | Private Member Functions | Private Attributes

gui2::event::tdistributor Class Reference

The event handler class for the widget library. More...

#include <distributor.hpp>

Inheritance diagram for gui2::event::tdistributor:
Inheritance graph
[legend]
Collaboration diagram for gui2::event::tdistributor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 tdistributor (twidget &owner, const tdispatcher::tposition queue_position)
 ~tdistributor ()
void initialize_state ()
 Initializes the state of the keyboard and mouse.
void keyboard_capture (twidget *widget)
 Captures the keyboard input.
void keyboard_add_to_chain (twidget *widget)
 Adds the widget to the keyboard chain.
void keyboard_remove_from_chain (twidget *widget)
 Remove the widget from the keyborad chain.

Private Member Functions

void signal_handler_sdl_key_down (const SDLKey key, const SDLMod modifier, const Uint16 unicode)
 Set of functions that handle certain events and sends them to the proper widget.
void signal_handler_notify_removal (tdispatcher &widget, const tevent event)

Private Attributes

bool hover_pending_
 Is there a hover event pending?
unsigned hover_id_
 Id of the pending hover event.
SDL_Rect hover_box_
 The area the mouse can move in, moving outside invalidates the pending hover event.
bool had_hover_
 A widget only gets one hover event per enter cycle.
twidgettooltip_
 The widget of the currently active tooltip.
twidgethelp_popup_
 The widget of the currently active help popup.
twidgetkeyboard_focus_
 The widget that holds the keyboard focus_.
std::vector< twidget * > keyboard_focus_chain_
 Fall back keyboard focus_ items.

Detailed Description

The event handler class for the widget library.

Definition at line 247 of file distributor.hpp.


Constructor & Destructor Documentation

gui2::event::tdistributor::tdistributor ( twidget owner,
const tdispatcher::tposition  queue_position 
)
Todo:
Test wehether the state is properly tracked when an input blocker is used.

Definition at line 610 of file distributor.cpp.

References gui2::event::tdispatcher::connect_signal(), gui2::event::NOTIFY_REMOVAL, gui2::event::tmouse_motion::owner_, gui2::event::SDL_KEY_DOWN, and signal_handler_sdl_key_down().

Here is the call graph for this function:

gui2::event::tdistributor::~tdistributor (  ) 

Definition at line 651 of file distributor.cpp.


Member Function Documentation

void gui2::event::tdistributor::initialize_state (  ) 

Initializes the state of the keyboard and mouse.

Needed after initialization and reactivation.

Definition at line 665 of file distributor.cpp.

Referenced by gui2::twindow::twindow().

Here is the caller graph for this function:

void gui2::event::tdistributor::keyboard_add_to_chain ( twidget widget  ) 

Adds the widget to the keyboard chain.

Parameters:
widget The widget to add to the chain. The widget should be valid widget, which hasn't been added to the chain yet.

Definition at line 695 of file distributor.cpp.

References DBG_GUI_E, gui2::event::tdispatcher::fire(), keyboard_focus_, gui2::event::tmouse_motion::owner_, and gui2::event::RECEIVE_KEYBOARD_FOCUS.

Referenced by gui2::twindow::add_to_keyboard_chain().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::event::tdistributor::keyboard_capture ( twidget widget  ) 

Captures the keyboard input.

Parameters:
widget The widget which should capture the keyboard. Sending NULL releases the capturing.

Definition at line 676 of file distributor.cpp.

Referenced by gui2::twindow::keyboard_capture().

Here is the caller graph for this function:

void gui2::event::tdistributor::keyboard_remove_from_chain ( twidget widget  ) 

Remove the widget from the keyborad chain.

Parameters:
widget The widget to be removed from the chain.

Definition at line 706 of file distributor.cpp.

Referenced by gui2::twindow::remove_from_keyboard_chain().

Here is the caller graph for this function:

void gui2::event::tdistributor::signal_handler_notify_removal ( tdispatcher widget,
const tevent  event 
) [private]

Todo:
Evaluate whether moving the cleanup parts in the subclasses.

It might be cleaner to do it that way, but creates extra small functions...

Definition at line 779 of file distributor.cpp.

void gui2::event::tdistributor::signal_handler_sdl_key_down ( const SDLKey  key,
const SDLMod  modifier,
const Uint16  unicode 
) [private]

Set of functions that handle certain events and sends them to the proper widget.

These functions are called by the SDL event handling functions.

Todo:
Test whether recursion protection is needed.
Todo:
Make sure we're not in the event chain.

No idea why we're here, but needs to be fixed, otherwise we keep calling this function recursively upon unhandled events...

Probably added to make sure the window can grab the events and handle + block them when needed, this is no longer needed with the chain.

Definition at line 717 of file distributor.cpp.

References keyboard_focus_chain_.

Referenced by tdistributor().

Here is the caller graph for this function:


Member Data Documentation

A widget only gets one hover event per enter cycle.

Definition at line 298 of file distributor.hpp.

The widget of the currently active help popup.

Definition at line 306 of file distributor.hpp.

The area the mouse can move in, moving outside invalidates the pending hover event.

Definition at line 293 of file distributor.hpp.

Id of the pending hover event.

Definition at line 292 of file distributor.hpp.

Is there a hover event pending?

Definition at line 291 of file distributor.hpp.

The widget that holds the keyboard focus_.

Definition at line 309 of file distributor.hpp.

Referenced by keyboard_add_to_chain().

Fall back keyboard focus_ items.

When the focussed widget didn't handle the keyboard event (or no handler for the keyboard focus_) it is send all widgets in this vector. The order is from rbegin() to rend(). If the keyboard_focus_ is in the vector it won't get the event twice. The first item added to the vector should be the window, so it will be the last handler and can dispatch the hotkeys registered.

Definition at line 321 of file distributor.hpp.

Referenced by signal_handler_sdl_key_down().

The widget of the currently active tooltip.

Definition at line 303 of file distributor.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:24:00 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs