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


C++ MenuManager::addItem方法代码示例

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


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

示例1: onContextMenuRequest

void EditableSceneBodyImpl::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager& menuManager)
{
    if(!bodyItem->isEditable()){
        return;
    }
    if(self->body()->isStaticModel()){
        return;
    }
    
    PointedType pointedType = findPointedObject(event.nodePath());

    if(bodyItem && pointedType == PT_SCENE_LINK){

        menuManager.addItem(_("Set Free"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkFree, this, pointedSceneLink));
        menuManager.addItem(_("Set Base"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::setBaseLink, this, pointedSceneLink));
        menuManager.addItem(_("Set Translation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, false));
        menuManager.addItem(_("Set Rotation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, false, true));
        menuManager.addItem(_("Set Both Pins"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, true));

        menuManager.addSeparator();

        menuManager.addItem(_("Level Attitude"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkAttitudeLevel, this));

        menuManager.addSeparator();
        
        menuManager.setPath(N_("/Markers"));
        
        Action* item = menuManager.addCheckItem(_("Center of Mass"));
        item->setChecked(isCmVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showCenterOfMass, this, _1));

        item = menuManager.addCheckItem(_("ZMP"));
        item->setChecked(isZmpVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showZmp, this, _1));

        menuManager.setPath("/");
        menuManager.addSeparator();
    }
}
开发者ID:orikuma,项目名称:choreonoid,代码行数:45,代码来源:EditableSceneBody.cpp

示例2: onContextMenuRequest

void EditableSceneBodyImpl::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager& menuManager)
{
    if(!isEditable()){
        return;
    }
    
    PointedType pointedType = findPointedObject(event.nodePath());

    if(bodyItem && pointedType == PT_SCENE_LINK){

        activeSimulatorItem = SimulatorItem::findActiveSimulatorItemFor(bodyItem);
        if(activeSimulatorItem){
            if(pointedSceneLink->link()->isRoot()){
                Action* item1 = menuManager.addCheckItem(_("Move Position"));
                item1->setChecked(forcedPositionMode == MOVE_FORCED_POSITION);
                item1->sigToggled().connect(
                    boost::bind(&EditableSceneBodyImpl::setForcedPositionMode, this, MOVE_FORCED_POSITION, _1));

                Action* item2 = menuManager.addCheckItem(_("Keep Position"));
                item2->setChecked(forcedPositionMode == KEEP_FORCED_POSITION);
                item2->sigToggled().connect(
                    boost::bind(&EditableSceneBodyImpl::setForcedPositionMode, this, KEEP_FORCED_POSITION, _1));
                
                menuManager.addSeparator();
            }
        } else {
            menuManager.addItem(_("Set Free"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::makeLinkFree, this, pointedSceneLink));
            menuManager.addItem(_("Set Base"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::setBaseLink, this, pointedSceneLink));
            menuManager.addItem(_("Set Translation Pin"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, false));
            menuManager.addItem(_("Set Rotation Pin"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, false, true));
            menuManager.addItem(_("Set Both Pins"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, true));

            menuManager.addSeparator();

            menuManager.addItem(_("Level Attitude"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::makeLinkAttitudeLevel, this));

            menuManager.addSeparator();
        }
        
        menuManager.setPath(_("Markers"));
        
        Action* item = menuManager.addCheckItem(_("Center of Mass"));
        item->setChecked(isCmVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showCenterOfMass, this, _1));

        item = menuManager.addCheckItem(_("Projection Point of CoM"));
        item->setChecked(isPpcomVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showPpcom, this, _1));

        item = menuManager.addCheckItem(_("ZMP"));
        item->setChecked(isZmpVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showZmp, this, _1));

        menuManager.setPath("/");
        menuManager.addSeparator();
    }
}
开发者ID:Alexixu,项目名称:choreonoid,代码行数:63,代码来源:EditableSceneBody.cpp


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