The event handler class for the widget library. More...
#include <distributor.hpp>


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. | |
| twidget * | tooltip_ |
| The widget of the currently active tooltip. | |
| twidget * | help_popup_ |
| The widget of the currently active help popup. | |
| twidget * | keyboard_focus_ |
| The widget that holds the keyboard focus_. | |
| std::vector< twidget * > | keyboard_focus_chain_ |
| Fall back keyboard focus_ items. | |
The event handler class for the widget library.
Definition at line 247 of file distributor.hpp.
| gui2::event::tdistributor::tdistributor | ( | twidget & | owner, | |
| const tdispatcher::tposition | queue_position | |||
| ) |
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().

| gui2::event::tdistributor::~tdistributor | ( | ) |
Definition at line 651 of file distributor.cpp.
| 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().

| void gui2::event::tdistributor::keyboard_add_to_chain | ( | twidget * | widget | ) |
Adds the widget to the keyboard chain.
| 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().


| void gui2::event::tdistributor::keyboard_capture | ( | twidget * | widget | ) |
Captures the keyboard input.
| 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().

| void gui2::event::tdistributor::keyboard_remove_from_chain | ( | twidget * | widget | ) |
Remove the widget from the keyborad chain.
| 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().

| void gui2::event::tdistributor::signal_handler_notify_removal | ( | tdispatcher & | widget, | |
| const tevent | event | |||
| ) | [private] |
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.
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().

bool gui2::event::tdistributor::had_hover_ [private] |
A widget only gets one hover event per enter cycle.
Definition at line 298 of file distributor.hpp.
twidget* gui2::event::tdistributor::help_popup_ [private] |
The widget of the currently active help popup.
Definition at line 306 of file distributor.hpp.
SDL_Rect gui2::event::tdistributor::hover_box_ [private] |
The area the mouse can move in, moving outside invalidates the pending hover event.
Definition at line 293 of file distributor.hpp.
unsigned gui2::event::tdistributor::hover_id_ [private] |
Id of the pending hover event.
Definition at line 292 of file distributor.hpp.
bool gui2::event::tdistributor::hover_pending_ [private] |
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().
std::vector<twidget*> gui2::event::tdistributor::keyboard_focus_chain_ [private] |
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().
twidget* gui2::event::tdistributor::tooltip_ [private] |
The widget of the currently active tooltip.
Definition at line 303 of file distributor.hpp.
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:24:00 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |