当前位置: 首页>>代码示例>>C++>>正文


C++ WidgetList::push_back方法代码示例

本文整理汇总了C++中WidgetList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ WidgetList::push_back方法的具体用法?C++ WidgetList::push_back怎么用?C++ WidgetList::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WidgetList的用法示例。


在下文中一共展示了WidgetList::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pickAtXY

// This method performs intersection testing at the given XY coords, and returns true if
// any intersections were found. It will break after processing the first pickable Window
// it finds.
bool WindowManager::pickAtXY(float x, float y, WidgetList& wl)
{
    Intersections intr;


    osg::Camera* camera = _view->getCamera();
    osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(camera->getGraphicsContext());
    if (gw)
    {
        _view->computeIntersections(camera, osgUtil::Intersector::WINDOW, x, y, intr, _nodeMask);
    }

    if (!intr.empty())
    {
        // Get the first Window at the XY coordinates; if you want a Window to be
        // non-pickable, set the NodeMask to something else.
        Window* activeWin = 0;

        // Iterate over every picked result and create a list of Widgets that belong
        // to that Window.
        for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) {
            Window* win = dynamic_cast<Window*>(i->nodePath.back()->getParent(0));

            // Make sure that our window is valid, and that our pick is within the
            // "visible area" of the Window.
            if(
                !win ||
                (win->getVisibilityMode() == Window::VM_PARTIAL && !win->isPointerXYWithinVisible(x, y))
            ) {
                continue;
            }

            // Set our activeWin, so that we know when we've got all the Widgets
            // that belong to it.
            if(!activeWin) activeWin = win;

            // If we've found a new Widnow, break out!
            else if(activeWin != win) break;

            Widget* widget = dynamic_cast<Widget*>(i->drawable.get());

            if(!widget) continue;

            // We need to return a list of every Widget that was picked, so
            // that the handler can operate on it accordingly.
            else wl.push_back(widget);
        }

        if(wl.size()) {
            // Potentially VERY expensive; only to be used for debugging. :)
            if(_flags & WM_PICK_DEBUG) _updatePickWindow(&wl, x, y);

            return true;
        }
    }

    if(_flags & WM_PICK_DEBUG) _updatePickWindow(0, x, y);

    return false;
}
开发者ID:yueying,项目名称:osg,代码行数:63,代码来源:WindowManager.cpp

示例2: getFocusList

bool Window::getFocusList(WidgetList& wl) const {
    for(ConstIterator i = begin(); i != end(); i++) if(i->valid()) {
        EmbeddedWindow* ew = dynamic_cast<EmbeddedWindow*>(i->get());

        if(!ew) {
            if(i->get()->canFocus()) wl.push_back(i->get());
        }

        else {
            if(ew->getWindow()) ew->getWindow()->getFocusList(wl);
        }
    }

    return wl.size() != 0;
}
开发者ID:dev2dev,项目名称:OpenSceneGraph-port-to-IOS,代码行数:15,代码来源:Window.cpp


注:本文中的WidgetList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。