Functions | |
template<event_category C> | |
std::vector< std::pair< widget *, ui_event > > | build_event_chain (const ui_event event, widget *dispatcher, widget *w) |
Build the event chain. More... | |
template<> | |
std::vector< std::pair< widget *, ui_event > > | build_event_chain< event_category::notification > (const ui_event event, widget *dispatcher, widget *w) |
Build the event chain for signal_notification. More... | |
template<> | |
std::vector< std::pair< widget *, ui_event > > | build_event_chain< event_category::message > (const ui_event event, widget *dispatcher, widget *w) |
Build the event chain for signal_message. More... | |
template<event_category C, typename... F> | |
bool | fire_event (const ui_event event, const std::vector< std::pair< widget *, ui_event >> &event_chain, widget *dispatcher, widget *w, F &&... params) |
Helper function for fire_event. More... | |
std::vector<std::pair<widget*, ui_event> > gui2::event::implementation::build_event_chain | ( | const ui_event | event, |
widget * | dispatcher, | ||
widget * | w | ||
) |
Build the event chain.
The event chain is a chain of events starting from the first parent of the widget until (and including) the wanted parent. For all these widgets it will be tested whether they have either a pre or post handler for the event. This ways there will be list of widgets to try to send the events to. If there's no line from widget to parent the result is undefined. (If widget == dispatcher the result will always be empty.)
event | The event to test. |
dispatcher | The final widget to test, this is also the dispatcher the sends the event. |
w | The widget should parent(s) to check. |
Definition at line 140 of file dispatcher_private.hpp.
References gui2::event::dispatcher::post, gui2::event::dispatcher::pre, and w.
std::vector<std::pair<widget*, ui_event> > gui2::event::implementation::build_event_chain< event_category::message > | ( | const ui_event | event, |
widget * | dispatcher, | ||
widget * | w | ||
) |
Build the event chain for signal_message.
This function expects that the widget sending it is also the receiver. This assumption might change, but is valid for now. The function doesn't build an event chain from dispatcher
to widget
but from widget
to its toplevel item (the first one without a parent) which we call window
.
Definition at line 140 of file dispatcher_private.hpp.
std::vector<std::pair<widget*, ui_event> > gui2::event::implementation::build_event_chain< event_category::notification > | ( | const ui_event | event, |
widget * | dispatcher, | ||
widget * | w | ||
) |
Build the event chain for signal_notification.
The notification is only send to the receiver it returns an empty chain. Since the pre and post queues are unused, it validates whether they are empty (using asserts).
Definition at line 140 of file dispatcher_private.hpp.
bool gui2::event::implementation::fire_event | ( | const ui_event | event, |
const std::vector< std::pair< widget *, ui_event >> & | event_chain, | ||
widget * | dispatcher, | ||
widget * | w, | ||
F &&... | params | ||
) |
Helper function for fire_event.
This is called with the same parameters as fire_event except for the event_chain, which contains the widgets with the events to call for them.
Definition at line 230 of file dispatcher_private.hpp.
References gui2::event::dispatcher::child, utils::reversed_view(), and w.
Referenced by unit_creator::add_unit(), advance_unit(), actions::get_village(), game_lua_kernel::intf_select_unit(), actions::place_recruit(), unit_creator::post_create(), events::mouse_handler::select_hex(), gui2::combobox::set_selected(), gui2::menu_button::set_selected(), gui2::toggle_button::set_value(), gui2::toggle_panel::set_value(), gui2::menu_button::set_value(), and gui2::selectable_item::set_value_bool().