The Battle for Wesnoth  1.15.0-dev
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
gui2::event Namespace Reference

Namespaces

 implementation
 

Classes

class  dispatcher
 Base class for event handling. More...
 
struct  dispatcher_implementation
 
class  distributor
 The event handler class for the widget library. More...
 
class  manager
 
struct  message
 The message callbacks hold a reference to a message. More...
 
struct  message_show_helptip
 The message for MESSAGE_SHOW_HELPTIP. More...
 
struct  message_show_tooltip
 The message for MESSAGE_SHOW_TOOLTIP. More...
 
class  mouse_button
 
struct  mouse_button_event_types_wrapper
 Small helper metastruct to specialize mouse_button with and provide ui_event type aliases without needing to make mouse_button take a million template types. More...
 
class  mouse_motion
 
class  resource_locker
 SDL_AddTimer() callback for the hover event. More...
 
class  sdl_event_handler
 This singleton class handles all events. More...
 

Typedefs

template<typename... T>
using dispatcher_callback_func = std::function< void(widget &, const ui_event, bool &, bool &, T...)>
 Callback function signature alias template. More...
 
using signal_function = dispatcher_callback_func<>
 Callback function signature. More...
 
using signal_mouse_function = dispatcher_callback_func< const point & >
 Callback function signature. More...
 
using signal_keyboard_function = dispatcher_callback_func< const SDL_Keycode, const SDL_Keymod, const std::string & >
 Callback function signature. More...
 
using signal_touch_function = dispatcher_callback_func< const point &, const point & >
 Callback function signature. More...
 
using signal_notification_function = dispatcher_callback_func< void * >
 Callback function signature. More...
 
using signal_message_function = dispatcher_callback_func< const message & >
 Callback function signature. More...
 
using signal_raw_event_function = dispatcher_callback_func< const SDL_Event & >
 Raw event callback function signature. More...
 
using signal_text_input_function = dispatcher_callback_func< const std::string &, int32_t, int32_t >
 Callback function signature. More...
 
using hotkey_function = std::function< void(widget &dispatcher, hotkey::HOTKEY_COMMAND id)>
 Hotkey function handler signature. More...
 
using mouse_button_left = mouse_button< mouse_button_event_types_wrapper< SDL_LEFT_BUTTON_DOWN, SDL_LEFT_BUTTON_UP, LEFT_BUTTON_DOWN, LEFT_BUTTON_UP, LEFT_BUTTON_CLICK, LEFT_BUTTON_DOUBLE_CLICK > >
 
using mouse_button_middle = mouse_button< mouse_button_event_types_wrapper< SDL_MIDDLE_BUTTON_DOWN, SDL_MIDDLE_BUTTON_UP, MIDDLE_BUTTON_DOWN, MIDDLE_BUTTON_UP, MIDDLE_BUTTON_CLICK, MIDDLE_BUTTON_DOUBLE_CLICK > >
 
using mouse_button_right = mouse_button< mouse_button_event_types_wrapper< SDL_RIGHT_BUTTON_DOWN, SDL_RIGHT_BUTTON_UP, RIGHT_BUTTON_DOWN, RIGHT_BUTTON_UP, RIGHT_BUTTON_CLICK, RIGHT_BUTTON_DOUBLE_CLICK > >
 

Enumerations

enum  ui_event {
  SDL_ACTIVATE, 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, SDL_TEXT_INPUT,
  SDL_TEXT_EDITING, NOTIFY_REMOVAL, NOTIFY_MODIFIED, REQUEST_PLACEMENT,
  RECEIVE_KEYBOARD_FOCUS, LOSE_KEYBOARD_FOCUS, SHOW_TOOLTIP, NOTIFY_REMOVE_TOOLTIP,
  MESSAGE_SHOW_TOOLTIP, SHOW_HELPTIP, MESSAGE_SHOW_HELPTIP, SDL_TOUCH_MOTION,
  SDL_TOUCH_UP, SDL_TOUCH_DOWN, SDL_RAW_EVENT
}
 The event send to the dispatcher. More...
 

Functions

void connect_signal_pre_key_press (dispatcher &dispatcher, const signal_keyboard_function &signal)
 Connects the signal for 'snooping' on the keypress. More...
 
void connect_signal_mouse_left_click (dispatcher &dispatcher, const signal_function &signal)
 Connects a signal handler for a left mouse button click. More...
 
void disconnect_signal_mouse_left_click (dispatcher &dispatcher, const signal_function &signal)
 Disconnects a signal handler for a left mouse button click. More...
 
void connect_signal_mouse_left_double_click (dispatcher &dispatcher, const signal_function &signal)
 Connects a signal handler for a left mouse button double click. More...
 
void connect_signal_notify_modified (dispatcher &dispatcher, const signal_notification_function &signal)
 Connects a signal handler for getting a notification upon modification. More...
 
void connect_signal_on_draw (dispatcher &dispatcher, const signal_function &signal)
 Connects a signal handler for a callback when the widget is drawn. More...
 
constexpr bool is_general_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_mouse_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_keyboard_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_touch_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_notification_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_message_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_raw_event_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
constexpr bool is_text_input_event (const ui_event event)
 Helper for catching use error of dispatcher::connect_signal. More...
 
template<typename T , typename... F>
bool fire_event (const ui_event event, dispatcher *d, widget *w, F &&... params)
 Fires an event. More...
 
template<ui_event click, ui_event double_click, bool(event_executor::*)() const wants_double_click, typename T , typename... F>
bool fire_event_double_click (dispatcher *dsp, widget *wgt, F &&... params)
 
void connect_dispatcher (dispatcher *dispatcher)
 Connects a dispatcher to the event handler. More...
 
void disconnect_dispatcher (dispatcher *dispatcher)
 Disconnects a dispatcher to the event handler. More...
 
std::vector< dispatcher * > & get_all_dispatchers ()
 Gets all event dispatchers in the Z order. More...
 
void init_mouse_location ()
 Initializes the location of the mouse. More...
 
void capture_mouse (dispatcher *dispatcher)
 Captures the mouse. More...
 
void release_mouse (dispatcher *dispatcher)
 Releases a captured mouse. More...
 
void capture_keyboard (dispatcher *dispatcher)
 Captures the keyboard. More...
 
std::ostream & operator<< (std::ostream &stream, const ui_event event)
 

Variables

static std::unique_ptr< class sdl_event_handlerhandler_ = nullptr
 

Typedef Documentation

◆ dispatcher_callback_func

template<typename... T>
using gui2::event::dispatcher_callback_func = typedef std::function<void(widget&, const ui_event, bool&, bool&, T...)>

Callback function signature alias template.

All callbacks take these four arguments in addition to any arguments specified by the parameter pack.

Parameters:

  1. The widget handling this event.
  2. The event type.
  3. Reference to the flag controlling whether this event has been handled.
  4. Reference to the flag controlling whether to halt execution of this event.

Definition at line 180 of file dispatcher.hpp.

◆ hotkey_function

Hotkey function handler signature.

Definition at line 267 of file dispatcher.hpp.

◆ mouse_button_left

Definition at line 234 of file distributor.hpp.

◆ mouse_button_middle

Definition at line 244 of file distributor.hpp.

◆ mouse_button_right

Definition at line 254 of file distributor.hpp.

◆ signal_function

Callback function signature.

This is used for events matching is_general_event.

Definition at line 187 of file dispatcher.hpp.

◆ signal_keyboard_function

using gui2::event::signal_keyboard_function = typedef dispatcher_callback_func<const SDL_Keycode, const SDL_Keymod, const std::string&>

Callback function signature.

This is used for events matching is_keyboard_event.

Extra parameters:

  1. The keycode of the key that triggered this event.
  2. Any applicable active modifer key.
  3. Any applicable text associated with the key.

Definition at line 210 of file dispatcher.hpp.

◆ signal_message_function

Callback function signature.

This is used for events matching is_message_event.

Extra parameters:

  1. The applicable data this event requires.

Definition at line 242 of file dispatcher.hpp.

◆ signal_mouse_function

Callback function signature.

This is used for events matching is_mouse_event.

Extra parameters:

  1. The x,y coordinate of the mouse when this event is fired.

Definition at line 197 of file dispatcher.hpp.

◆ signal_notification_function

Callback function signature.

This is used for events matching is_notification_event.

Extra parameters:

  1. A dummy void* parameter which will always be nullptr, used to differentiate this function from signal_function.

Definition at line 232 of file dispatcher.hpp.

◆ signal_raw_event_function

Raw event callback function signature.

This is used for events matching is_raw_event_event.

Extra parameters:

  1. The raw SDL_Event.

Definition at line 252 of file dispatcher.hpp.

◆ signal_text_input_function

using gui2::event::signal_text_input_function = typedef dispatcher_callback_func<const std::string&, int32_t, int32_t>

Callback function signature.

This is used for events matching is_text_input_event.

Extra parameters:

  1. The text entered.
  2. The current input position.
  3. The current text selection length.

Definition at line 264 of file dispatcher.hpp.

◆ signal_touch_function

Callback function signature.

This is used for events matching is_touch_event.

Extra parameters:

  1. Origin of the touch event, in x,y format.
  2. Number of pixels dragged, in x,y format.

Definition at line 221 of file dispatcher.hpp.

Enumeration Type Documentation

◆ ui_event

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
SDL_ACTIVATE 

The main application window is activated.

DRAW 

Periodic redraw request.

CLOSE_WINDOW 

A request to close the current window.

SDL_VIDEO_RESIZE 

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

SDL_MOUSE_MOTION 

An 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 

An SDL left mouse button down event.

SDL_LEFT_BUTTON_UP 

An 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 

An SDL middle mouse button down event.

SDL_MIDDLE_BUTTON_UP 

An 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 

An SDL right mouse button down event.

SDL_RIGHT_BUTTON_UP 

An 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 

An SDL wheel left event.

SDL_WHEEL_RIGHT 

An SDL wheel right event.

SDL_WHEEL_UP 

An SDL wheel up event.

SDL_WHEEL_DOWN 

An SDL wheel down event.

SDL_KEY_DOWN 

An SDL key down event.

SDL_TEXT_INPUT 

An SDL text input (commit) event.

SDL_TEXT_EDITING 

An SDL text editing (IME) event.

NOTIFY_REMOVAL 

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

NOTIFY_MODIFIED 

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

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

REQUEST_PLACEMENT 

Request to place the widget.

This may also trigger an update of other layout components.

RECEIVE_KEYBOARD_FOCUS 

Widget gains 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 remove its hover tooltip.

MESSAGE_SHOW_TOOLTIP 

Request to show a tooltip based on the data sent.

SHOW_HELPTIP 

Request the widget to show its hover helptip.

MESSAGE_SHOW_HELPTIP 

Request to show a helptip based on the data sent.

SDL_TOUCH_MOTION 
SDL_TOUCH_UP 
SDL_TOUCH_DOWN 
SDL_RAW_EVENT 

Raw SDL event.

Definition at line 47 of file handler.hpp.

Function Documentation

◆ capture_keyboard()

void gui2::event::capture_keyboard ( dispatcher 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 804 of file handler.cpp.

References gui2::event::dispatcher::get_want_keyboard_input().

◆ capture_mouse()

void gui2::event::capture_mouse ( dispatcher 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 788 of file handler.cpp.

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

◆ connect_dispatcher()

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

Connects a dispatcher to the event handler.

Parameters
dispatcherThe dispatcher to connect.

Definition at line 755 of file handler.cpp.

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

◆ connect_signal_mouse_left_click()

void gui2::event::connect_signal_mouse_left_click ( dispatcher dispatcher,
const signal_function signal 
)

Connects a signal handler for a left mouse button click.

Definition at line 163 of file dispatcher.cpp.

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

Referenced by gui2::dialogs::mp_staging::add_side_node(), gui2::dialogs::chat_log::view::bind(), gui2::dialogs::gamestate_inspector::controller::bind(), gui2::dialogs::lua_interpreter::controller::bind(), gui2::button::connect_click_handler(), gui2::dialogs::mp_options_helper::display_custom_options(), gui2::unit_preview_pane::finalize_setup(), gui2::chatbox::find_or_create_window(), gui2::dialogs::mp_join_game::generate_side_list(), gui2::window::layout(), gui2::dialogs::preferences_dialog::post_build(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::mp_connect::pre_show(), gui2::dialogs::formula_debugger::pre_show(), gui2::dialogs::unit_recruit::pre_show(), gui2::dialogs::mp_alerts_options::pre_show(), gui2::dialogs::synched_choice_wait::pre_show(), gui2::dialogs::custom_tod::pre_show(), gui2::dialogs::unit_attack::pre_show(), gui2::dialogs::game_load::pre_show(), gui2::dialogs::lobby_player_info::pre_show(), gui2::dialogs::addon_connect::pre_show(), gui2::dialogs::story_viewer::pre_show(), gui2::dialogs::mp_method_selection::pre_show(), gui2::dialogs::editor_generate_map::pre_show(), gui2::dialogs::select_orb_colors::pre_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::help_browser::pre_show(), gui2::dialogs::screenshot_notification::pre_show(), gui2::dialogs::game_cache_options::pre_show(), gui2::dialogs::wml_error::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::game_version::pre_show(), gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::preferences_dialog::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::register_button(), gui2::addon_list::set_addons(), gui2::dialogs::select_orb_colors::setup_orb_group(), and gui2::dialogs::setup_pref_toggle_button().

◆ connect_signal_mouse_left_double_click()

void gui2::event::connect_signal_mouse_left_double_click ( dispatcher dispatcher,
const signal_function signal 
)

Connects a signal handler for a left mouse button double click.

I'm not exactly sure why this works in this queue position with toggle panels, but it does. Will revisit if it becomes an issue later (ie, if this is used with other widgets and doesn't work).

  • vultraz, 2017-08-23

Definition at line 173 of file dispatcher.cpp.

References gui2::event::dispatcher::back_post_child, gui2::event::dispatcher::connect_signal(), and LEFT_BUTTON_DOUBLE_CLICK.

Referenced by gui2::dialogs::mp_lobby::adjust_game_row_contents(), and gui2::dialogs::mp_lobby::update_playerlist().

◆ connect_signal_notify_modified()

void gui2::event::connect_signal_notify_modified ( dispatcher dispatcher,
const signal_notification_function signal 
)

Connects a signal handler for getting a notification upon modification.

Definition at line 178 of file dispatcher.cpp.

References gui2::event::dispatcher::connect_signal(), and NOTIFY_MODIFIED.

Referenced by gui2::dialogs::mp_staging::add_side_node(), gui2::dialogs::chat_log::view::bind(), gui2::dialogs::gamestate_inspector::controller::bind(), gui2::bind_status_label(), gui2::dialogs::mp_options_helper::display_custom_options(), gui2::listbox::finalize(), gui2::chatbox::finalize_setup(), gui2::scrollbar_container::finalize_setup(), gui2::policy::select_action::selection::init(), gui2::field_bool::init_specialized(), gui2::dialogs::preferences_dialog::initialize_sound_option_group(), gui2::dialogs::preferences_dialog::initialize_tabs(), lua_gui2::intf_set_dialog_callback(), gui2::dialogs::preferences_dialog::post_build(), gui2::dialogs::generator_settings::pre_show(), gui2::dialogs::statistics_dialog::pre_show(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::unit_recruit::pre_show(), gui2::dialogs::label_settings::pre_show(), gui2::dialogs::mp_change_control::pre_show(), gui2::dialogs::custom_tod::pre_show(), gui2::dialogs::game_load::pre_show(), gui2::dialogs::core_selection::pre_show(), gui2::dialogs::faction_select::pre_show(), gui2::dialogs::editor_generate_map::pre_show(), gui2::dialogs::help_browser::pre_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::campaign_selection::pre_show(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::game_stats::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::unit_create::pre_show(), gui2::dialogs::game_version::pre_show(), gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::drop_down_menu::pre_show(), gui2::dialogs::preferences_dialog::pre_show(), gui2::dialogs::editor_resize_map::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::file_dialog::pre_show(), gui2::group< preferences::LOBBY_JOINS >::set_callback_on_value_change(), and gui2::addon_list::set_modified_signal_handler().

◆ connect_signal_on_draw()

void gui2::event::connect_signal_on_draw ( dispatcher dispatcher,
const signal_function signal 
)

◆ connect_signal_pre_key_press()

void gui2::event::connect_signal_pre_key_press ( dispatcher dispatcher,
const signal_keyboard_function signal 
)

◆ disconnect_dispatcher()

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

Disconnects a dispatcher to the event handler.

Parameters
dispatcherThe dispatcher to disconnect.

Definition at line 762 of file handler.cpp.

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

◆ disconnect_signal_mouse_left_click()

void gui2::event::disconnect_signal_mouse_left_click ( dispatcher dispatcher,
const signal_function signal 
)

Disconnects a signal handler for a left mouse button click.

Definition at line 168 of file dispatcher.cpp.

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

Referenced by gui2::button::disconnect_click_handler().

◆ fire_event()

template<typename T , typename... F>
bool gui2::event::fire_event ( const ui_event  event,
dispatcher d,
widget w,
F &&...  params 
)
inline

Fires an event.

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

Precondition
d != nullptr
w != nullptr
Template Parameters
TThe signal type of the event to handle.
FThe parameter pack type.
Parameters
eventThe event to fire.
dThe dispatcher that handles the event.
wThe widget that should receive the event.
paramsZero or more additional arguments to pass to the signal function when it's executed.
Returns
Whether or not the event was handled.

Definition at line 376 of file dispatcher_private.hpp.

References tooltips::click(), d, and w.

◆ fire_event_double_click()

template<ui_event click, ui_event double_click, bool(event_executor::*)() const wants_double_click, typename T , typename... F>
bool gui2::event::fire_event_double_click ( dispatcher dsp,
widget wgt,
F &&...  params 
)
inline

◆ get_all_dispatchers()

std::vector< dispatcher * > & gui2::event::get_all_dispatchers ( )

Gets all event dispatchers in the Z order.

Definition at line 769 of file handler.cpp.

◆ init_mouse_location()

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 775 of file handler.cpp.

References gui2::get_mouse_position(), gui2::event::sdl_event_handler::mouse(), point::x, and point::y.

Referenced by gui2::event::distributor::initialize_state(), and gui2::window::layout().

◆ is_general_event()

constexpr bool gui2::event::is_general_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

This helper is needed as a user can't supply the wrong kind of callback functions to dispatcher::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 46 of file dispatcher.hpp.

References CLOSE_WINDOW, DRAW, LEFT_BUTTON_CLICK, LEFT_BUTTON_DOUBLE_CLICK, LEFT_BUTTON_DOWN, LEFT_BUTTON_UP, MIDDLE_BUTTON_CLICK, MIDDLE_BUTTON_DOUBLE_CLICK, MIDDLE_BUTTON_DOWN, MIDDLE_BUTTON_UP, MOUSE_ENTER, MOUSE_LEAVE, RIGHT_BUTTON_CLICK, RIGHT_BUTTON_DOUBLE_CLICK, RIGHT_BUTTON_DOWN, and RIGHT_BUTTON_UP.

Referenced by gui2::event::dispatcher::fire(), and gui2::event::dispatcher_implementation::has_handler().

◆ is_keyboard_event()

constexpr bool gui2::event::is_keyboard_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

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

Definition at line 96 of file dispatcher.hpp.

References SDL_KEY_DOWN.

Referenced by gui2::event::dispatcher::fire().

◆ is_message_event()

constexpr bool gui2::event::is_message_event ( const ui_event  event)

Helper for catching use error of dispatcher::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 138 of file dispatcher.hpp.

References MESSAGE_SHOW_HELPTIP, MESSAGE_SHOW_TOOLTIP, and REQUEST_PLACEMENT.

Referenced by gui2::event::dispatcher::fire().

◆ is_mouse_event()

constexpr bool gui2::event::is_mouse_event ( const ui_event  event)

◆ is_notification_event()

constexpr bool gui2::event::is_notification_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

This version is for callbacks with a sender aka notification messages. Like the ones in set_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 120 of file dispatcher.hpp.

References LOSE_KEYBOARD_FOCUS, NOTIFY_MODIFIED, NOTIFY_REMOVAL, NOTIFY_REMOVE_TOOLTIP, RECEIVE_KEYBOARD_FOCUS, and SDL_ACTIVATE.

Referenced by gui2::event::dispatcher::fire().

◆ is_raw_event_event()

constexpr bool gui2::event::is_raw_event_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

This version is for callbacks of raw events.

Definition at line 150 of file dispatcher.hpp.

References SDL_RAW_EVENT.

Referenced by gui2::event::dispatcher::fire().

◆ is_text_input_event()

constexpr bool gui2::event::is_text_input_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

This version is for callbacks of text input events.

Definition at line 160 of file dispatcher.hpp.

References SDL_TEXT_EDITING, and SDL_TEXT_INPUT.

Referenced by gui2::event::dispatcher::fire().

◆ is_touch_event()

constexpr bool gui2::event::is_touch_event ( const ui_event  event)

Helper for catching use error of dispatcher::connect_signal.

This version is for callbacks of touch events.

Definition at line 106 of file dispatcher.hpp.

References SDL_TOUCH_DOWN, SDL_TOUCH_MOTION, and SDL_TOUCH_UP.

Referenced by gui2::event::dispatcher::fire().

◆ operator<<()

std::ostream & gui2::event::operator<< ( std::ostream &  stream,
const ui_event  event 
)

◆ release_mouse()

void gui2::event::release_mouse ( dispatcher dispatcher)

Releases a captured mouse.

Parameters
dispatcherThe dispatcher which should release the mouse capture.

Definition at line 795 of file handler.cpp.

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

Variable Documentation

◆ handler_

std::unique_ptr<class sdl_event_handler> gui2::event::handler_ = nullptr
static