本文整理汇总了C++中DockWindow::setWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ DockWindow::setWidget方法的具体用法?C++ DockWindow::setWidget怎么用?C++ DockWindow::setWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DockWindow
的用法示例。
在下文中一共展示了DockWindow::setWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createView
View* createView(const char* pName, const char* pType, DataElement* pElement)
{
if (pName == NULL || pType == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return NULL;
}
ViewType type(StringUtilities::fromXmlString<ViewType>(std::string(pType)));
RasterElement* pRaster = dynamic_cast<RasterElement*>(pElement);
if (type == SPATIAL_DATA_VIEW && pRaster == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return NULL;
}
WindowType windowType;
switch(type)
{
case SPATIAL_DATA_VIEW:
windowType = SPATIAL_DATA_WINDOW;
break;
case PRODUCT_VIEW:
windowType = PRODUCT_WINDOW;
break;
case PLOT_VIEW:
windowType = DOCK_WINDOW;
break;
}
Window* pWindow = Service<DesktopServices>()->createWindow(std::string(pName), windowType);
if (type == PLOT_VIEW)
{
DockWindow* pDockWindow = dynamic_cast<DockWindow*>(pWindow);
if (pDockWindow != NULL)
{
PlotSetGroup* pPlotSetGroup = Service<DesktopServices>()->createPlotSetGroup();
if (pPlotSetGroup == NULL)
{
Service<DesktopServices>()->deleteWindow(pDockWindow);
setLastError(SIMPLE_OTHER_FAILURE);
return NULL;
}
pDockWindow->setWidget(pPlotSetGroup->getWidget());
}
}
View* pView = pWindow == NULL ? NULL : static_cast<ViewWindow*>(pWindow)->getView();
if (pView == NULL)
{
if (Service<DesktopServices>()->getWindow(std::string(pName), windowType) != NULL)
{
setLastError(SIMPLE_EXISTS);
}
else
{
setLastError(SIMPLE_OTHER_FAILURE);
}
return NULL;
}
if (type == SPATIAL_DATA_VIEW)
{
SpatialDataView* pSdv = static_cast<SpatialDataView*>(pView);
if (!pSdv->setPrimaryRasterElement(pRaster))
{
Service<DesktopServices>()->deleteWindow(pWindow);
setLastError(SIMPLE_OTHER_FAILURE);
return NULL;
}
{ // scope
UndoLock lock(pView);
if (pSdv->createLayer(RASTER, pRaster) == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
setLastError(SIMPLE_OTHER_FAILURE);
return NULL;
}
}
}
setLastError(SIMPLE_NO_ERROR);
return pView;
}