The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
gui2::event Namespace Reference

Namespaces

 implementation
 Contains the implementation details of the find function.
 

Classes

class  tdispatcher
 Base class for event handling. More...
 
struct  tdispatcher_implementation
 
class  tdistributor
 The event handler class for the widget library. More...
 
class  tevent_in_set
 Helper class to do a runtime test whether an event is in a set. More...
 
class  thandler
 This singleton class handles all events. More...
 
class  tlock
 SDL_AddTimer() callback for the hover event. More...
 
class  tmanager
 
struct  tmessage
 The message callbacks hold a reference to a message. More...
 
struct  tmessage_show_helptip
 The message for MESSAGE_SHOW_HELPTIP. More...
 
struct  tmessage_show_tooltip
 The message for MESSAGE_SHOW_TOOLTIP. More...
 
class  tmouse_button
 
class  tmouse_motion
 
class  ttrigger
 Helper struct to wrap the functor call. More...
 
class  ttrigger_keyboard
 Helper struct to wrap the functor call. More...
 
class  ttrigger_message
 Helper struct to wrap the functor call. More...
 
class  ttrigger_mouse
 Helper struct to wrap the functor call. More...
 
class  ttrigger_notification
 Helper struct to wrap the functor call. More...
 

Typedefs

typedef std::function< void(tdispatcher
&dispatcher, const tevent
event, bool &handled, bool
&halt)> 
tsignal_function
 Callback function signature. More...
 
typedef std::function< void(tdispatcher
&dispatcher, const tevent
event, bool &handled, bool
&halt, const tpoint
&coordinate)> 
tsignal_mouse_function
 Callback function signature. More...
 
typedef std::function< void(tdispatcher
&dispatcher, const tevent
event, bool &handled, bool
&halt, const SDLKey key, const
SDLMod modifier, const
utf8::string &unicode)> 
tsignal_keyboard_function
 Callback function signature. More...
 
typedef std::function< void(tdispatcher
&dispatcher, const tevent
event, bool &handled, bool
&halt, void *)> 
tsignal_notification_function
 Callback function signature. More...
 
typedef std::function< void(tdispatcher
&dispatcher, const tevent
event, bool &handled, bool
&halt, tmessage &message)> 
tsignal_message_function
 Callback function signature. More...
 
typedef std::function< bool(tdispatcher
&dispatcher,
hotkey::HOTKEY_COMMAND id)> 
thotkey_function
 Hotkey function handler signature. More...
 
typedef tmouse_button
< SDL_LEFT_BUTTON_DOWN,
SDL_LEFT_BUTTON_UP,
LEFT_BUTTON_DOWN,
LEFT_BUTTON_UP,
LEFT_BUTTON_CLICK,
LEFT_BUTTON_DOUBLE_CLICK
tmouse_button_left
 
typedef tmouse_button
< SDL_MIDDLE_BUTTON_DOWN,
SDL_MIDDLE_BUTTON_UP,
MIDDLE_BUTTON_DOWN,
MIDDLE_BUTTON_UP,
MIDDLE_BUTTON_CLICK,
MIDDLE_BUTTON_DOUBLE_CLICK
tmouse_button_middle
 
typedef tmouse_button
< SDL_RIGHT_BUTTON_DOWN,
SDL_RIGHT_BUTTON_UP,
RIGHT_BUTTON_DOWN,
RIGHT_BUTTON_UP,
RIGHT_BUTTON_CLICK,
RIGHT_BUTTON_DOUBLE_CLICK
tmouse_button_right
 
typedef boost::mpl::set
< boost::mpl::int_< DRAW >
, boost::mpl::int_
< CLOSE_WINDOW >
, boost::mpl::int_
< MOUSE_ENTER >
, boost::mpl::int_
< MOUSE_LEAVE >
, boost::mpl::int_
< LEFT_BUTTON_DOWN >
, boost::mpl::int_
< LEFT_BUTTON_UP >
, boost::mpl::int_
< LEFT_BUTTON_CLICK >
, boost::mpl::int_
< LEFT_BUTTON_DOUBLE_CLICK >
, boost::mpl::int_
< MIDDLE_BUTTON_DOWN >
, boost::mpl::int_
< MIDDLE_BUTTON_UP >
, boost::mpl::int_
< MIDDLE_BUTTON_CLICK >
, boost::mpl::int_
< MIDDLE_BUTTON_DOUBLE_CLICK >
, boost::mpl::int_
< RIGHT_BUTTON_DOWN >
, boost::mpl::int_
< RIGHT_BUTTON_UP >
, boost::mpl::int_
< RIGHT_BUTTON_CLICK >
, boost::mpl::int_
< RIGHT_BUTTON_DOUBLE_CLICK > > 
tset_event
 Helper for catching use error of tdispatcher::connect_signal. More...
 
typedef boost::mpl::set
< boost::mpl::int_
< SDL_VIDEO_RESIZE >
, boost::mpl::int_
< SDL_MOUSE_MOTION >
, boost::mpl::int_
< MOUSE_MOTION >
, boost::mpl::int_
< SDL_LEFT_BUTTON_DOWN >
, boost::mpl::int_
< SDL_LEFT_BUTTON_UP >
, boost::mpl::int_
< SDL_MIDDLE_BUTTON_DOWN >
, boost::mpl::int_
< SDL_MIDDLE_BUTTON_UP >
, boost::mpl::int_
< SDL_RIGHT_BUTTON_DOWN >
, boost::mpl::int_
< SDL_RIGHT_BUTTON_UP >
, boost::mpl::int_
< SHOW_TOOLTIP >
, boost::mpl::int_
< SHOW_HELPTIP >
, boost::mpl::int_
< SDL_WHEEL_UP >
, boost::mpl::int_
< SDL_WHEEL_DOWN >
, boost::mpl::int_
< SDL_WHEEL_LEFT >
, boost::mpl::int_
< SDL_WHEEL_RIGHT > > 
tset_event_mouse
 Helper for catching use error of tdispatcher::connect_signal. More...
 
typedef boost::mpl::set
< boost::mpl::int_
< SDL_KEY_DOWN > > 
tset_event_keyboard
 Helper for catching use error of tdispatcher::connect_signal. More...
 
typedef boost::mpl::set
< boost::mpl::int_
< NOTIFY_REMOVAL >
, boost::mpl::int_
< NOTIFY_MODIFIED >
, boost::mpl::int_
< RECEIVE_KEYBOARD_FOCUS >
, boost::mpl::int_
< LOSE_KEYBOARD_FOCUS >
, boost::mpl::int_
< NOTIFY_REMOVE_TOOLTIP >
, boost::mpl::int_
< SDL_ACTIVATE > > 
tset_event_notification
 Helper for catching use error of tdispatcher::connect_signal. More...
 
typedef boost::mpl::set
< boost::mpl::int_
< MESSAGE_SHOW_TOOLTIP >
, boost::mpl::int_
< MESSAGE_SHOW_HELPTIP >
, boost::mpl::int_
< REQUEST_PLACEMENT > > 
tset_event_message
 Helper for catching use error of tdispatcher::connect_signal. More...
 

Enumerations

enum  tevent {
  DRAW, CLOSE_WINDOW, SDL_VIDEO_RESIZE, SDL_MOUSE_MOTION,
  MOUSE_ENTER, MOUSE_MOTION, MOUSE_LEAVE, SDL_LEFT_BUTTON_DOWN,
  SDL_LEFT_BUTTON_UP, LEFT_BUTTON_DOWN, LEFT_BUTTON_UP, LEFT_BUTTON_CLICK,
  LEFT_BUTTON_DOUBLE_CLICK, SDL_MIDDLE_BUTTON_DOWN, SDL_MIDDLE_BUTTON_UP, MIDDLE_BUTTON_DOWN,
  MIDDLE_BUTTON_UP, MIDDLE_BUTTON_CLICK, MIDDLE_BUTTON_DOUBLE_CLICK, SDL_RIGHT_BUTTON_DOWN,
  SDL_RIGHT_BUTTON_UP, RIGHT_BUTTON_DOWN, RIGHT_BUTTON_UP, RIGHT_BUTTON_CLICK,
  RIGHT_BUTTON_DOUBLE_CLICK, SDL_WHEEL_LEFT, SDL_WHEEL_RIGHT, SDL_WHEEL_UP,
  SDL_WHEEL_DOWN, SDL_KEY_DOWN, NOTIFY_REMOVAL, NOTIFY_MODIFIED,
  RECEIVE_KEYBOARD_FOCUS, LOSE_KEYBOARD_FOCUS, SHOW_TOOLTIP, NOTIFY_REMOVE_TOOLTIP,
  SDL_ACTIVATE, MESSAGE_SHOW_TOOLTIP, SHOW_HELPTIP, MESSAGE_SHOW_HELPTIP,
  REQUEST_PLACEMENT
}
 The event send to the dispatcher. More...
 

Functions

void connect_signal_pre_key_press (tdispatcher &dispatcher, const tsignal_keyboard_function &signal)
 Connects the signal for 'snooping' on the keypress. More...
 
void connect_signal_mouse_left_click (tdispatcher &dispatcher, const tsignal_function &signal)
 Connects a signal handler for a left mouse button click. More...
 
void disconnect_signal_mouse_left_click (tdispatcher &dispatcher, const tsignal_function &signal)
 Disconnects a signal handler for a left mouse button click. More...
 
void connect_signal_notify_modified (tdispatcher &dispatcher, const tsignal_notification_function &signal)
 Connects a signal handler for getting a notification upon modification. More...
 
template<typename sequence , typename E , typename F >
bool find (E event, F functor)
 Tests whether an event handler is available. More...
 
template<class T , class F >
bool fire_event (const tevent event, twidget *dispatcher, twidget *widget, F functor)
 Fires an event. More...
 
template<tevent click, tevent double_click, bool(tevent_executor::*)() const wants_double_click, class T , class F >
bool fire_event_double_click (twidget *dispatcher, twidget *widget, F functor)
 
void connect_dispatcher (tdispatcher *dispatcher)
 Connects a dispatcher to the event handler. More...
 
void disconnect_dispatcher (tdispatcher *dispatcher)
 Disconnects a dispatcher to the event handler. More...
 
void init_mouse_location ()
 Initializes the location of the mouse. More...
 
void capture_mouse (tdispatcher *dispatcher)
 Captures the mouse. More...
 
void release_mouse (tdispatcher *dispatcher)
 Releases a captured mouse. More...
 
void capture_keyboard (tdispatcher *dispatcher)
 Captures the keyboard. More...
 
std::ostream & operator<< (std::ostream &stream, const tevent event)
 

Variables

static thandlerhandler = nullptr
 
static events::event_contextevent_context = nullptr
 

Typedef Documentation

typedef std::function<bool(tdispatcher& dispatcher, hotkey::HOTKEY_COMMAND id)> gui2::event::thotkey_function

Hotkey function handler signature.

Definition at line 105 of file dispatcher.hpp.

Definition at line 217 of file distributor.hpp.

Definition at line 224 of file distributor.hpp.

Definition at line 231 of file distributor.hpp.

typedef boost::mpl::set<boost::mpl::int_<DRAW>, boost::mpl::int_<CLOSE_WINDOW>, boost::mpl::int_<MOUSE_ENTER>, boost::mpl::int_<MOUSE_LEAVE>, boost::mpl::int_<LEFT_BUTTON_DOWN>, boost::mpl::int_<LEFT_BUTTON_UP>, boost::mpl::int_<LEFT_BUTTON_CLICK>, boost::mpl::int_<LEFT_BUTTON_DOUBLE_CLICK>, boost::mpl::int_<MIDDLE_BUTTON_DOWN>, boost::mpl::int_<MIDDLE_BUTTON_UP>, boost::mpl::int_<MIDDLE_BUTTON_CLICK>, boost::mpl::int_<MIDDLE_BUTTON_DOUBLE_CLICK>, boost::mpl::int_<RIGHT_BUTTON_DOWN>, boost::mpl::int_<RIGHT_BUTTON_UP>, boost::mpl::int_<RIGHT_BUTTON_CLICK>, boost::mpl::int_<RIGHT_BUTTON_DOUBLE_CLICK> > gui2::event::tset_event

Helper for catching use error of tdispatcher::connect_signal.

This helper is needed as a user can't supply the wrong kind of callback functions to tdispatcher::connect_signal. If a wrong callback would be send it will never get called.

This version is for callbacks without extra parameters. NOTE some mouse functions like MOUSE_ENTER don't send the mouse coordinates to the callback function so they are also in this category.

Definition at line 209 of file handler.hpp.

typedef boost::mpl::set<boost::mpl::int_<SDL_KEY_DOWN> > gui2::event::tset_event_keyboard

Helper for catching use error of tdispatcher::connect_signal.

This version is for callbacks with the keyboard values (these haven't been determined yet).

Definition at line 238 of file handler.hpp.

typedef boost::mpl::set<boost::mpl::int_<MESSAGE_SHOW_TOOLTIP>, boost::mpl::int_<MESSAGE_SHOW_HELPTIP>, boost::mpl::int_<REQUEST_PLACEMENT> > gui2::event::tset_event_message

Helper for catching use error of tdispatcher::connect_signal.

This version is for callbacks with a sender aka notification messages. Unlike the notifications this message is send through the chain. The event is send from a widget all the way up to the window, who always is the receiver of the message (unless somebody grabbed it before).

Definition at line 267 of file handler.hpp.

typedef boost::mpl::set<boost::mpl::int_<SDL_VIDEO_RESIZE>, boost::mpl::int_<SDL_MOUSE_MOTION>, boost::mpl::int_<MOUSE_MOTION>, boost::mpl::int_<SDL_LEFT_BUTTON_DOWN>, boost::mpl::int_<SDL_LEFT_BUTTON_UP>, boost::mpl::int_<SDL_MIDDLE_BUTTON_DOWN>, boost::mpl::int_<SDL_MIDDLE_BUTTON_UP>, boost::mpl::int_<SDL_RIGHT_BUTTON_DOWN>, boost::mpl::int_<SDL_RIGHT_BUTTON_UP>, boost::mpl::int_<SHOW_TOOLTIP>, boost::mpl::int_<SHOW_HELPTIP>, boost::mpl::int_<SDL_WHEEL_UP>, boost::mpl::int_<SDL_WHEEL_DOWN>, boost::mpl::int_<SDL_WHEEL_LEFT>, boost::mpl::int_<SDL_WHEEL_RIGHT> > gui2::event::tset_event_mouse

Helper for catching use error of tdispatcher::connect_signal.

This version is for callbacks with a coordinate as extra parameter.

Definition at line 230 of file handler.hpp.

typedef boost::mpl::set<boost::mpl::int_<NOTIFY_REMOVAL>, boost::mpl::int_<NOTIFY_MODIFIED>, boost::mpl::int_<RECEIVE_KEYBOARD_FOCUS>, boost::mpl::int_<LOSE_KEYBOARD_FOCUS>, boost::mpl::int_<NOTIFY_REMOVE_TOOLTIP>, boost::mpl::int_<SDL_ACTIVATE> > gui2::event::tset_event_notification

Helper for catching use error of tdispatcher::connect_signal.

This version is for callbacks with a sender aka notification messages. Like the ones in tset_event it has no extra parameters, but this version is only send to the target and not using the pre and post queue.

Definition at line 254 of file handler.hpp.

typedef std::function<void( tdispatcher& dispatcher, const tevent event, bool& handled, bool& halt)> gui2::event::tsignal_function

Callback function signature.

There are several kinds of callback signature, this only has the parameters shared by all callbacks.

This function is used for the callbacks in tset_event.

Definition at line 40 of file dispatcher.hpp.

typedef std::function<void(tdispatcher& dispatcher, const tevent event, bool& handled, bool& halt, const SDLKey key, const SDLMod modifier, const utf8::string& unicode)> gui2::event::tsignal_keyboard_function

Callback function signature.

This function is used for the callbacks in tset_event_keyboard.

Definition at line 77 of file dispatcher.hpp.

typedef std::function<void(tdispatcher& dispatcher, const tevent event, bool& handled, bool& halt, tmessage& message)> gui2::event::tsignal_message_function

Callback function signature.

This function is used for the callbacks in tset_message_notification.

Definition at line 101 of file dispatcher.hpp.

typedef std::function<void(tdispatcher& dispatcher, const tevent event, bool& handled, bool& halt, const tpoint& coordinate)> gui2::event::tsignal_mouse_function

Callback function signature.

This function is used for the callbacks in tset_event_mouse.

Definition at line 63 of file dispatcher.hpp.

typedef std::function<void(tdispatcher& dispatcher, const tevent event, bool& handled, bool& halt, void*)> gui2::event::tsignal_notification_function

Callback function signature.

This function is used for the callbacks in tset_event_notification. Added the dummy void* parameter which will be nullptr to get a different signature as tsignal_function's callback.

Definition at line 90 of file dispatcher.hpp.

Enumeration Type Documentation

enum gui2::event::tevent

The event send to the dispatcher.

Events prefixed by SDL are (semi)-real SDL events. The handler does some minor decoding like splitting the button down event to the proper event but nothing more. Events without an SDL prefix are generated by another signal eg the windows signal handler for SDL_MOUSE_MOTION can generate a MOUSE_ENTER, MOUSE_MOTION and MOUSE_LEAVE event and send that to it's children.

Note
When adding a new entry to the enum also add a unit test.
Enumerator
DRAW 

Periodic redraw request.

CLOSE_WINDOW 

A request to close the current window.

SDL_VIDEO_RESIZE 

A SDL resize request, coordinate is the new window size.

SDL_MOUSE_MOTION 

A SDL mouse motion event.

MOUSE_ENTER 

A mouse enter event for a widget.

MOUSE_MOTION 

A mouse motion event for a widget.

MOUSE_LEAVE 

A mouse leave event for a widget.

SDL_LEFT_BUTTON_DOWN 

A SDL left mouse button down event.

SDL_LEFT_BUTTON_UP 

A SDL left mouse button up event.

LEFT_BUTTON_DOWN 

A left mouse button down event for a widget.

LEFT_BUTTON_UP 

A left mouse button up event for a widget.

LEFT_BUTTON_CLICK 

A left mouse button click event for a widget.

LEFT_BUTTON_DOUBLE_CLICK 

A left mouse button double click event for a widget.

SDL_MIDDLE_BUTTON_DOWN 

A SDL middle mouse button down event.

SDL_MIDDLE_BUTTON_UP 

A SDL middle mouse button up event.

MIDDLE_BUTTON_DOWN 

See LEFT_BUTTON_DOWN.

MIDDLE_BUTTON_UP 

See LEFT_BUTTON_UP.

MIDDLE_BUTTON_CLICK 

See LEFT_BUTTON_CLICK.

MIDDLE_BUTTON_DOUBLE_CLICK 

See LEFT_BUTTON_DOUBLE_CLICK.

SDL_RIGHT_BUTTON_DOWN 

A SDL right mouse button down event.

SDL_RIGHT_BUTTON_UP 

A SDL right mouse button up event.

RIGHT_BUTTON_DOWN 

See LEFT_BUTTON_DOWN.

RIGHT_BUTTON_UP 

See LEFT_BUTTON_UP.

RIGHT_BUTTON_CLICK 

See LEFT_BUTTON_CLICK.

RIGHT_BUTTON_DOUBLE_CLICK 

See LEFT_BUTTON_DOUBLE_CLICK.

SDL_WHEEL_LEFT 

A SDL wheel left event.

SDL_WHEEL_RIGHT 

A SDL wheel right event.

SDL_WHEEL_UP 

A SDL wheel up event.

SDL_WHEEL_DOWN 

A SDL wheel down event.

SDL_KEY_DOWN 

A SDL key down event.

NOTIFY_REMOVAL 

Send by a widget to notify others it's being destroyed.

NOTIFY_MODIFIED 

Send by a widget to notify others its contents or state are modified.

What modified means is documented per widget. If not documented the modified means nothing.

RECEIVE_KEYBOARD_FOCUS 

Widget gets keyboard focus.

LOSE_KEYBOARD_FOCUS 

Widget loses keyboard focus.

SHOW_TOOLTIP 

Request the widget to show its hover tooltip.

NOTIFY_REMOVE_TOOLTIP 

Request the widget to show its hover tooltip.

SDL_ACTIVATE 

The main application window is activated.

MESSAGE_SHOW_TOOLTIP 

Request for somebody to show the tooltip based on the data send.

SHOW_HELPTIP 

Request the widget to show its hover helptip.

MESSAGE_SHOW_HELPTIP 

Request for somebody to show the helptip based on the data send.

REQUEST_PLACEMENT 

Request for somebody to place the widget.

This may also cause updating of more layout parts.

Definition at line 54 of file handler.hpp.

Function Documentation

void gui2::event::capture_keyboard ( tdispatcher *  dispatcher)

Captures the keyboard.

A dispatcher can capture the keyboard, when for example it's pressed on a button, this means all keyboard events after that are send to that widget.

Parameters
dispatcherThe dispatcher which should get the keyboard focus.

Definition at line 817 of file handler.cpp.

References gui2::event::tdispatcher::get_want_keyboard_input(), and gui2::event::thandler::keyboard_focus_.

void gui2::event::capture_mouse ( tdispatcher *  dispatcher)

Captures the mouse.

A dispatcher can capture the mouse, when for example it's pressed on a button, this means all mouse events after that are send to that widget.

Parameters
dispatcherThe dispatcher which should get the mouse focus.

Definition at line 801 of file handler.cpp.

References gui2::event::thandler::mouse_focus.

Referenced by gui2::event::tdispatcher::capture_mouse().

void gui2::event::connect_dispatcher ( tdispatcher *  dispatcher)

Connects a dispatcher to the event handler.

Parameters
dispatcherThe dispatcher to connect.

Definition at line 774 of file handler.cpp.

References gui2::event::thandler::connect().

Referenced by gui2::event::tdispatcher::connect().

void gui2::event::connect_signal_mouse_left_click ( tdispatcher &  dispatcher,
const tsignal_function &  signal 
)
inline

Connects a signal handler for a left mouse button click.

Definition at line 710 of file dispatcher.hpp.

References gui2::event::tdispatcher::connect_signal(), and LEFT_BUTTON_CLICK.

Referenced by gui2::tlobby_main::adjust_game_row_contents(), gui2::tlua_interpreter::controller::bind(), gui2::tchat_log::view::bind(), gui2::tgamestate_inspector::view::bind(), gui2::tcombobox::connect_click_handler(), gui2::tbutton::connect_click_handler(), gui2::tunit_preview_pane::finalize_setup(), gui2::tpreferences::initialize_members(), gui2::twindow::layout(), gui2::tmp_connect::pre_show(), gui2::tformula_debugger::pre_show(), gui2::tsynced_choice_wait::pre_show(), gui2::tunit_recruit::pre_show(), gui2::tunit_attack::pre_show(), gui2::tmp_alerts_options::pre_show(), gui2::tlobby_player_info::pre_show(), gui2::tselect_orb_colors::pre_show(), gui2::tscreenshot_notification::pre_show(), gui2::taddon_connect::pre_show(), gui2::taddon_list::pre_show(), gui2::tgame_load::pre_show(), gui2::teditor_generate_map::pre_show(), gui2::taddon_description::pre_show(), gui2::tgame_cache_options::pre_show(), gui2::twml_error::pre_show(), gui2::tgame_version::pre_show(), gui2::tcustom_tod::pre_show(), gui2::ttitle_screen::pre_show(), gui2::taddon_filter_options::pre_show(), gui2::tlobby_main::pre_show(), gui2::taddon_filter_options::register_dir_toggle(), gui2::taddon_filter_options::register_sort_toggle(), gui2::tlobby_main::search_create_window(), gui2::tpreferences::setup_combobox(), gui2::tselect_orb_colors::setup_orb_group(), gui2::setup_pref_toggle_button(), gui2::tpreferences::setup_radio_toggle(), gui2::tpreferences::setup_single_toggle(), and gui2::tpreferences::setup_toggle_slider_pair().

void gui2::event::connect_signal_notify_modified ( tdispatcher &  dispatcher,
const tsignal_notification_function &  signal 
)
inline
void gui2::event::connect_signal_pre_key_press ( tdispatcher &  dispatcher,
const tsignal_keyboard_function &  signal 
)
inline

Connects the signal for 'snooping' on the keypress.

This callback is called before the widget itself allowing you to either snoop on the input or filter it.

Definition at line 703 of file dispatcher.hpp.

References gui2::event::tdispatcher::connect_signal(), gui2::event::tdispatcher::front_child, and SDL_KEY_DOWN.

Referenced by gui2::tlua_interpreter::controller::bind(), and gui2::tlobby_main::pre_show().

void gui2::event::disconnect_dispatcher ( tdispatcher *  dispatcher)

Disconnects a dispatcher to the event handler.

Parameters
dispatcherThe dispatcher to disconnect.

Definition at line 781 of file handler.cpp.

References gui2::event::thandler::disconnect().

Referenced by gui2::event::tdispatcher::~tdispatcher().

void gui2::event::disconnect_signal_mouse_left_click ( tdispatcher &  dispatcher,
const tsignal_function &  signal 
)
inline

Disconnects a signal handler for a left mouse button click.

Definition at line 717 of file dispatcher.hpp.

References gui2::event::tdispatcher::disconnect_signal(), and LEFT_BUTTON_CLICK.

Referenced by gui2::tcombobox::disconnect_click_handler(), and gui2::tbutton::disconnect_click_handler().

template<typename sequence , typename E , typename F >
bool gui2::event::find ( event,
functor 
)
inline

Tests whether an event handler is available.

The code is based on boost::mpl_for_each, which doesn't allow to call a template function with the dereferred iterator as template parameter.

The function first tries to match whether the value in the sequence matches event, once that matched it will execute the functor with the key found as template parameter and the event as parameter.

Template Parameters
sequenceThe sequence to test upon.
EThe value type of the item in the sequence
FType of the functor.
Parameters
eventThe event to look for.
functorThe predicate which should is executed if the event is matched.
Returns
Whether or not the function found a result.

Definition at line 237 of file dispatcher_private.hpp.

Referenced by pathfind::a_star_search(), unit::ability_affects_adjacent(), game_data::activate_scope_variable(), unit_type::add_advancement(), replay::add_chat_message_location(), game_events::manager::add_events(), syncmp_registry::add_handler(), editor::location_palette::add_item(), gui2::twindow::add_linked_widget(), unit::apply_builtin_effect(), attack_type::apply_modification(), events::generic_event::attach_handler(), wesnothd::server::ban_handler(), wesnothd::server::bans_handler(), basic_unit_filter_impl::basic_unit_filter_impl(), team::calculate_is_enemy(), events::chat_handler::change_logging(), wb::recall::check_validity(), wb::attack::check_validity(), wb::recruit::check_validity(), wesnothd::server::cleanup_game(), persist_file_context::clear_var(), gui2::event::thandler::connect(), ng::connect_engine::connect_engine(), pathfind::paths::dest_vect::contains(), variant::contains(), gui::menu::create_help_strings(), default_map_generator_job::default_generate_map(), wesnothd::server::delete_game(), events::generic_event::detach_handler(), gui2::event::thandler::disconnect(), network::disconnect(), ai::ai_default_rca::get_villages_phase::dispatch_complex(), ai::move_result::do_execute(), events::console_handler::do_set_alias(), events::console_handler::do_set_var(), font::draw_text(), font::draw_text_line(), display::enable_menu(), wb::side_actions_container::erase(), util::detail::contains_impl< Container, Value >::eval(), ai::lua_sticky_candidate_action_wrapper::evaluate(), ai::ai_default_rca::retreat_phase::evaluate(), ng::flg_manager::faction_index(), unit_animation::fill_initial_animations(), terrain_filterimpl::filter_xy(), ng::flg_manager::find_suitable_faction(), wesnothd::game::find_user(), ai::ai_default_rca::get_villages_phase::find_villages(), footsteps_images(), wesnothd::server::gban_handler(), ng::flg_manager::gender_index(), help::generate_terrain_sections(), CVideo::get_available_resolutions(), pathfind::paths::dest_vect::get_path(), wb::side_actions::get_position_of(), get_token(), image::getMinimap(), wesnothd::server::handle_join_game(), wesnothd::server::handle_login(), wesnothd::server::handle_whisper(), terrain_label::hidden(), gui2::tpreferences::initialize_members(), basic_unit_filter_impl::internal_matches_filter(), game_lua_kernel::intf_kill(), game_lua_kernel::intf_set_time_of_day(), mp::options::manager::is_active(), ai::stage_factory::is_duplicate(), ai::engine_factory::is_duplicate(), ai::candidate_action_factory::is_duplicate(), ai::goal_factory::is_duplicate(), ai::aspect_factory::is_duplicate(), wesnothd::server::is_ip_banned(), wesnothd::room::is_member(), wesnothd::game::is_muted_observer(), wesnothd::game::is_observer(), wesnothd::game::is_player(), sound::is_sound_playing(), help::is_valid_id(), events::sdl_handler::join_same(), gui2::event::tdistributor::keyboard_add_to_chain(), gui2::event::tdistributor::keyboard_remove_from_chain(), wesnothd::server::kick_handler(), wesnothd::server::kickban_handler(), ng::flg_manager::leader_index(), ai::default_recruitment::recruitment::leader_matches_job(), sound::load_chunk(), ng::connect_engine::load_previous_sides_users(), gui2::tgui_definition::load_widget_definitions(), ai::lua_sticky_candidate_action_wrapper::lua_sticky_candidate_action_wrapper(), wesnothd::make_change_diff(), wesnothd::make_delete_diff(), markov_generate_name(), side_filter::match_internal(), terrain_filter::match_internal(), unit_animation::matches(), game_events::event_handler::matches_name(), map_location::matches_range(), matches_simple_filter(), ai::ai_default_rca::move_to_targets_phase::move_group(), actions::move_unit_and_record(), unit_type::musthave_status(), utils::parse_range(), fake_unit_manager::place_temporary_unit(), wesnothd::game::player_is_banned(), wesnothd::server::pm_handler(), mp::gamebrowser::populate_game_item_addons_installed(), ai::readonly_context_impl::power_projection(), gui2::tcampaign_selection::pre_show(), wesnothd::server::process_command(), ng::connect_engine::process_network_data(), wesnothd::game::process_turn(), input_stream::read_line(), gui2::register_window(), syncmp_registry::remove_handler(), events::context::remove_handler(), gui2::twindow::remove_linked_widget(), wesnothd::server::remove_player(), wesnothd::room::remove_player(), font::render_text(), unit_type::resistance_filter_matches(), unit::resistance_filter_matches(), lua_fileops::resolve_filename(), ng::flg_manager::resolve_random(), wesnothd::server::searchlog_handler(), help::section_is_referenced(), help::help_menu::select_topic_internal(), events::context::set_focus(), gui::button::set_label(), gui2::set_resolution_list(), gui::dialog::set_textbox(), mp::ui::set_user_menu_items(), gui2::event::tdistributor::signal_handler_notify_removal(), ai::readonly_context_impl::suitable_keep(), synced_command::synced_command(), SYNCED_COMMAND_HANDLER_FUNCTION(), variant::to_debug_string(), help::topic_is_referenced(), wesnothd::game::transfer_side_control(), wb::side_actions::unit_has_actions(), ng::flg_manager::update_choosable_genders(), ng::flg_manager::update_choosable_leaders(), gui2::tcampaign_settings::update_lists(), and unit::~unit().

template<class T , class F >
bool gui2::event::fire_event ( const tevent  event,
twidget *  dispatcher,
twidget *  widget,
functor 
)
inline

Fires an event.

A helper to allow the common event firing code to be shared between the different signal function types.

Precondition
dispatcher != nullptr
widget != nullptr
Template Parameters
TThe signal type of the event to handle.
FThe type of the functor.
Parameters
eventThe event to fire.
dispatcherThe dispatcher that handles the event.
widgetThe widget that should receive the event.
functorThe functor to execute the actual event. Since some functions need different parameters this functor stores them before firing the event.
Returns
Whether or not the event was handled.

Definition at line 520 of file dispatcher_private.hpp.

References functor().

template<tevent click, tevent double_click, bool(tevent_executor::*)() const wants_double_click, class T , class F >
bool gui2::event::fire_event_double_click ( twidget *  dispatcher,
twidget *  widget,
functor 
)
inline
void gui2::event::init_mouse_location ( )

Initializes the location of the mouse.

After a layout of the window the mouse location needs to be updated to test whether it entered or left a widget. Also after closing a window it's needed to send a dummy mouse move.

Definition at line 788 of file handler.cpp.

References gui2::get_mouse_position(), gui2::tpoint::x, and gui2::tpoint::y.

Referenced by gui2::event::tdistributor::initialize_state(), and gui2::twindow::layout().

std::ostream & gui2::event::operator<< ( std::ostream &  stream,
const tevent  event 
)
void gui2::event::release_mouse ( tdispatcher *  dispatcher)

Releases a captured mouse.

Parameters
dispatcherThe dispatcher which should release the mouse capture.

Definition at line 808 of file handler.cpp.

References gui2::event::thandler::mouse_focus.

Referenced by gui2::event::tdispatcher::release_mouse().

Variable Documentation

events::event_context* gui2::event::event_context = nullptr
static
thandler* gui2::event::handler = nullptr
static