本文整理汇总了C++中PObject::widget方法的典型用法代码示例。如果您正苦于以下问题:C++ PObject::widget方法的具体用法?C++ PObject::widget怎么用?C++ PObject::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PObject
的用法示例。
在下文中一共展示了PObject::widget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
PWidget *PukeController::id2pwidget(widgetId *pwi){
PObject *obj = id2pobject(pwi);
if(obj->widget()->isWidgetType())
return (PWidget *) obj;
else
throw(errorNoSuchWidget(*pwi));
return NULL;
}
示例2: createWidget
widgetId PukeController::createWidget(widgetId wI, PukeMessage *pm)
{
widgetId wIret;
PWidget *parent = 0; // Defaults to no parent
WidgetS *ws = new WidgetS;
/*
* The parent widget ID and type are packed into the iArg
* the pattern is 2 shorts.
*/
int iParent, iType;
int found = sscanf(pm->cArg, "%d\t%d", &iParent, &iType);
if(found != 2)
throw(errorCommandFailed(PUKE_INVALID,7));
wI.iWinId = iParent; // wI is the identifier for the parent widget
if(widgetCF[iType] == NULL){ // No such widget, bail out.
wIret.fd = 0;
wIret.iWinId = 0;
throw(errorCommandFailed(PUKE_INVALID,1));
}
uiBaseWinId++; // Get a new base win id
// wIret holds the current widget id for the new widget
wIret.iWinId = uiBaseWinId;
wIret.fd = wI.fd;
if(checkWidgetId(&wI) == TRUE){
PObject *obj = WidgetList[wI.fd]->find(wI.iWinId)->pwidget;
if(obj->widget()->isWidgetType() == FALSE){
throw(errorCommandFailed(PUKE_INVALID, 0));
}
parent = (PWidget *) obj;
}
// CreateArgs arg = CreateArgs(this, pm, &wIret, parent)
CreateArgs arg(this, pm, &wIret, parent);
ws->pwidget = (widgetCF[iType]->wc)(arg);
if (ws->pwidget->hasError())
{
throw(errorCommandFailed(PUKE_INVALID, 0));
}
ws->type = iType;
connect(ws->pwidget, SIGNAL(outputMessage(int, PukeMessage*)),
this, SIGNAL(outputMessage(int, PukeMessage*)));
// insertPBoject(fd, uiBaseWinId, ws);
// The widget list has to exist since we have ourselves in the list
insertPObject(wIret.fd, wIret.iWinId, ws);
// WidgetList[wIret.fd]->insert(wIret.iWinId, ws);
return wIret;
}