mousetrap v0.2.0
Loading...
Searching...
No Matches
mousetrap::SignalEmitter Class Referenceabstract

object that can emit GLib signals \for_internal_use_only More...

#include <signal_emitter.hpp>

Inheritance diagram for mousetrap::SignalEmitter:
mousetrap::Action mousetrap::Adjustment mousetrap::Animation mousetrap::Application mousetrap::EventController mousetrap::FileChooser mousetrap::FileMonitor mousetrap::FrameClock mousetrap::MenuModel mousetrap::MultisampledRenderTexture mousetrap::PopupMessage mousetrap::RenderTask mousetrap::SelectionModel mousetrap::Shader mousetrap::Shape mousetrap::Texture mousetrap::Widget

Public Member Functions

void set_signal_blocked (const std::string &signal_id, bool b)
 block a signal by id \for_internal_use_only
 
bool get_signal_blocked (const std::string &signal_id) const
 get whether a signal is currently blocked
 
std::vector< std::string > get_all_signal_names ()
 get list of possible signal ids \for_internal_use_only
 
template<typename Function_t >
void connect_signal (const std::string &signal_id, Function_t *function, void *data=nullptr)
 connect static function to signal, does not work with lambdas \for_internal_use_only
 
void disconnect_signal (const std::string &signal_id)
 disconnect signal, it may not be invoked until reconnected, if signal is not registered, does nothing. For internal use only
 
virtual operator NativeObject () const =0
 expose as NativeObject, this is the GLib instance that signals are emitted on \for_internal_use_only
 
virtual NativeObject get_internal () const
 expose internally managed object, \for_internal_use_only
 

Protected Member Functions

 SignalEmitter ()
 ctor
 
 ~SignalEmitter ()
 destructor
 

Detailed Description

object that can emit GLib signals \for_internal_use_only

Member Function Documentation

◆ connect_signal()

template<typename Function_t >
void mousetrap::SignalEmitter::connect_signal ( const std::string &  signal_id,
Function_t *  function,
void *  data = nullptr 
)

connect static function to signal, does not work with lambdas \for_internal_use_only

Template Parameters
Function_tstatic function pointer, the user is responsible for asserting that the function has the correct signature
Parameters
signal_idglib id of the signal
functionpointer to C-function, does not work with lambdas
datavoid-pointer to arbitrary data

References disconnect_signal().

Referenced by mousetrap::SpinButton::set_text_to_value_function(), mousetrap::Widget::set_tooltip_widget(), and mousetrap::SpinButton::set_value_to_text_function().

◆ disconnect_signal()

void mousetrap::SignalEmitter::disconnect_signal ( const std::string &  signal_id)

disconnect signal, it may not be invoked until reconnected, if signal is not registered, does nothing. For internal use only

Parameters
signal_id

Referenced by connect_signal(), and mousetrap::SpinButton::reset_value_to_text_function().

◆ get_all_signal_names()

std::vector< std::string > mousetrap::SignalEmitter::get_all_signal_names ( )

get list of possible signal ids \for_internal_use_only

Returns
vector of signals names

◆ get_internal()

◆ get_signal_blocked()

bool mousetrap::SignalEmitter::get_signal_blocked ( const std::string &  signal_id) const

get whether a signal is currently blocked

Returns
bool

◆ operator NativeObject()

virtual mousetrap::SignalEmitter::operator NativeObject ( ) const
explicitpure virtual

◆ set_signal_blocked()

void mousetrap::SignalEmitter::set_signal_blocked ( const std::string &  signal_id,
bool  b 
)

block a signal by id \for_internal_use_only

Parameters
signal_id
btrue if signal handler should not be invoked, false otherwise

References mousetrap::log::critical().


The documentation for this class was generated from the following files: