Beispiel #1
0
	/// Attach an event handler to this control.
	/// @tparam t The type of event to attach.
	/// @param handler The event handler function or functor. Its signature depends on the event type.
	/// @return The previous handler that has been overridden, if any.
	/// @throw xHandlerNotSupported if the event type is not supported by this control.
	/// @note Only one handler can be set at a time for any given event. To remove a handler, set it to nullptr.
	template<eDlogEvt t> typename event_fcn<t>::type attachEventHandler(typename event_fcn<t>::type handler) {
		if(getSupportedHandlers().count(t) == 0) throw xHandlerNotSupported(t);
		auto old_handler = event_handlers[t];
		if(handler) event_handlers[t] = handler;
		else event_handlers[t] = nullptr;
		if(old_handler.empty()) return nullptr;
		return boost::any_cast<typename event_fcn<t>::type>(old_handler);
	}
Beispiel #2
0
void cPict::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
	throw xHandlerNotSupported(true);
}
Beispiel #3
0
void cButton::attachFocusHandler(focus_callback_t) throw(xHandlerNotSupported){
	throw xHandlerNotSupported(true);
}
Beispiel #4
0
void cTextField::attachClickHandler(click_callback_t) throw(xHandlerNotSupported){
	throw xHandlerNotSupported(false);
}