The Battle for Wesnoth  1.17.0-dev
Classes | Namespaces | Macros | Functions
dispatcher_private.hpp File Reference
#include "gui/core/event/dispatcher.hpp"
#include "gui/widgets/widget.hpp"
#include "utils/ranges.hpp"
#include <SDL2/SDL_events.h>
#include <cassert>
Include dependency graph for dispatcher_private.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gui2::event::dispatcher_implementation
 

Namespaces

 gui2
 Generic file dialog.
 
 gui2::event
 
 gui2::event::implementation
 

Macros

#define IMPLEMENT_EVENT_SIGNAL(SET, FUNCTION, QUEUE)
 Helper macro to implement the various event_signal functions. More...
 
#define IMPLEMENT_EVENT_SIGNAL_WRAPPER(TYPE)
 Small helper macro to wrap IMPLEMENT_EVENT_SIGNAL. More...
 
#define IMPLEMENT_RUNTIME_EVENT_SIGNAL_CHECK(TYPE)
 

Functions

template<typename T >
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. More...
 
template<>
std::vector< std::pair< widget *, ui_event > > gui2::event::implementation::build_event_chain< signal_notification_function > (const ui_event event, widget *dispatcher, widget *w)
 Build the event chain for signal_notification_function. More...
 
template<>
std::vector< std::pair< widget *, ui_event > > gui2::event::implementation::build_event_chain< signal_message_function > (const ui_event event, widget *dispatcher, widget *w)
 Build the event chain for signal_message_function. More...
 
template<typename T , typename... F>
bool gui2::event::implementation::fire_event (const ui_event event, std::vector< std::pair< widget *, ui_event >> &event_chain, widget *dispatcher, widget *w, F &&... params)
 Helper function for fire_event. More...
 
template<typename T , typename... F>
bool gui2::event::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 gui2::event::fire_event_double_click (dispatcher *dsp, widget *wgt, F &&... params)
 

Macro Definition Documentation

◆ IMPLEMENT_EVENT_SIGNAL

#define IMPLEMENT_EVENT_SIGNAL (   SET,
  FUNCTION,
  QUEUE 
)
Value:
/** \
* Returns the signal structure for a FUNCTION. \
* \
* There are several functions that only overload the return value, in \
* order to do so they use SFINAE. \
* \
* @tparam F signal_function. \
* @param dispatcher The dispatcher whose signal queue is used. \
* @param event The event to get the signal for. \
* \
* @returns The signal of the type \
* dispatcher::signal_type<FUNCTION> \
*/ \
template<typename F> \
static std::enable_if_t<std::is_same_v<F, FUNCTION>, dispatcher::signal_type<FUNCTION>>& \
event_signal(dispatcher& dispatcher, const ui_event event) \
{ \
return dispatcher.QUEUE.queue[event]; \
} \
ui_event
The event send to the dispatcher.
Definition: handler.hpp:47

Helper macro to implement the various event_signal functions.

Implements two helper functions as documented in the macro.

Parameters
SETThe set in which the event type needs to be.
FUNCTIONThe function signature to validate the implementation function SFINAE against eg the gui2::event::signal_function or another one in that header.
QUEUEThe queue in which the event is slotted.

Definition at line 46 of file dispatcher_private.hpp.

◆ IMPLEMENT_EVENT_SIGNAL_WRAPPER

#define IMPLEMENT_EVENT_SIGNAL_WRAPPER (   TYPE)
Value:
signal_##TYPE##_function, \
signal_##TYPE##_queue_)
TYPE
Used to specify the rendering format of images.
Definition: picture.hpp:228
#define IMPLEMENT_EVENT_SIGNAL(SET, FUNCTION, QUEUE)
Helper macro to implement the various event_signal functions.

Small helper macro to wrap IMPLEMENT_EVENT_SIGNAL.

Since the parameters to IMPLEMENT_EVENT_SIGNAL use the same parameters with a slight difference per type this macro wraps the function by its type.

Parameters
TYPEThe type to wrap for IMPLEMENT_EVENT_SIGNAL.

Definition at line 78 of file dispatcher_private.hpp.

◆ IMPLEMENT_RUNTIME_EVENT_SIGNAL_CHECK

#define IMPLEMENT_RUNTIME_EVENT_SIGNAL_CHECK (   TYPE)
Value:
else if(is_##TYPE##_event(event)) { \
return queue_check(dispatcher.signal_##TYPE##_queue_); \
}
TYPE
Used to specify the rendering format of images.
Definition: picture.hpp:228

Definition at line 95 of file dispatcher_private.hpp.

Referenced by gui2::event::dispatcher_implementation::has_handler().