本文整理汇总了C++中SignalHandler::getSignalType方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalHandler::getSignalType方法的具体用法?C++ SignalHandler::getSignalType怎么用?C++ SignalHandler::getSignalType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalHandler
的用法示例。
在下文中一共展示了SignalHandler::getSignalType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _connectSignals
/**
* Connect an object's signals to the appropriate handlers.
*
* @param builder the builder that created the object.
* @param object the object to connect.
* @param signalName the name of the signal to connect.
* @param handlerName the name of the handler to use.
* @param connectObject if non-NULL, use g_signal_connect_object.
* @param flags the connection flags to use.
* @param userData a pointer to mapping of signals to handler pointers.
*/
static void _connectSignals(
GtkBuilder* builder, GObject* object,
const gchar* signalName, const gchar* handlerName,
GObject* connectObject, GConnectFlags flags,
gpointer userData)
{
const char* hn = (const char*)handlerName;
// get controller's signal handler associated with handler name, log
// cases where there is no controller signal handler found
Controller* controller = static_cast<Controller*>(userData);
SignalHandler* h = controller->getSignalHandler(hn);
if(h != NULL)
{
SignalHandler::SignalType t = h->getSignalType();
GCallback cb = NULL;
if(connectObject != NULL)
{
switch(t)
{
case SignalHandler::WidgetSignal:
cb = G_CALLBACK(_handleWidgetSignalWithConnectObject);
break;
case SignalHandler::WidgetEvent:
cb = G_CALLBACK(_handleWidgetEventWithConnectObject);
break;
case SignalHandler::DialogResponse:
cb = G_CALLBACK(_handleDialogResponseWithConnectObject);
break;
}
// save handler in connect object
g_object_set_data(connectObject, GOBJECT_KEY_HANDLER, h);
g_signal_connect_object(object, signalName, cb, connectObject, flags);
}
else
{
switch(t)
{
case SignalHandler::WidgetSignal:
cb = G_CALLBACK(_handleWidgetSignal);
break;
case SignalHandler::WidgetEvent:
cb = G_CALLBACK(_handleWidgetEvent);
break;
case SignalHandler::DialogResponse:
cb = G_CALLBACK(_handleDialogResponse);
break;
}
// pass handler as data
g_signal_connect_data(object, signalName, cb, h, NULL, flags);
}
}
else
{
MO_CAT_WARNING(BM_GTKUI_CAT,
"No gtk signal handler found for '%s'", hn);
}
}