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


C++ ToolBarItem::setCommand方法代码示例

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


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

示例1: setupToolBars

ToolBarItem* StdWorkbench::setupToolBars() const
{
    ToolBarItem* root = new ToolBarItem;

    // File
    ToolBarItem* file = new ToolBarItem( root );
    file->setCommand("File");
    *file << "Std_New" << "Std_Open" << "Std_Save" << "Std_Print" << "Separator" << "Std_Cut"
          << "Std_Copy" << "Std_Paste" << "Separator" << "Std_Undo" << "Std_Redo" << "Separator"
          << "Std_Refresh" << "Separator" << "Std_Workbench" << "Std_WhatsThis";

    // Macro
    ToolBarItem* macro = new ToolBarItem( root );
    macro->setCommand("Macro");
    *macro << "Std_DlgMacroRecord" << "Std_MacroStopRecord" << "Std_DlgMacroExecute"
           << "Std_DlgMacroExecuteDirect";

    // View
    ToolBarItem* view = new ToolBarItem( root );
    view->setCommand("View");
    *view << "Std_ViewFitAll" << "Separator" << "Std_ViewAxo" << "Separator" << "Std_ViewFront" 
          << "Std_ViewRight" << "Std_ViewTop" << "Separator" << "Std_ViewRear" << "Std_ViewLeft" 
          << "Std_ViewBottom" << "Separator" << "Std_MeasureDistance" ;

    return root;
}
开发者ID:JonasThomas,项目名称:free-cad,代码行数:26,代码来源:Workbench.cpp

示例2: setupCustomToolbars

void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<ParameterGrp>& hGrp) const
{
    std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
    CommandManager& rMgr = Application::Instance->commandManager();
    std::string separator = "Separator";
    for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
        bool active = (*it)->GetBool("Active", true);
        if (!active) // ignore this toolbar
            continue;
        ToolBarItem* bar = new ToolBarItem(root);
        bar->setCommand("Custom");

        // get the elements of the subgroups
        std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
        for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
            if (it2->first.substr(0, separator.size()) == separator) {
                *bar << "Separator";
            }
            else if (it2->first == "Name") {
                bar->setCommand(it2->second);
            }
            else {
                Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
                if (!pCmd) { // unknown command
                    // first try the module name as is
                    std::string pyMod = it2->second;
                    try {
                        Base::Interpreter().loadModule(pyMod.c_str());
                        // Try again
                        pCmd = rMgr.getCommandByName(it2->first.c_str());
                    }
                    catch(const Base::Exception&) {
                    }
                }

                // still not there?
                if (!pCmd) {
                    // add the 'Gui' suffix
                    std::string pyMod = it2->second + "Gui";
                    try {
                        Base::Interpreter().loadModule(pyMod.c_str());
                        // Try again
                        pCmd = rMgr.getCommandByName(it2->first.c_str());
                    }
                    catch(const Base::Exception&) {
                    }
                }

                if (pCmd) {
                    *bar << it2->first; // command name
                }
            }
        }
    }
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:55,代码来源:Workbench.cpp

示例3: setupCommandBars

ToolBarItem* StdWorkbench::setupCommandBars() const
{
    ToolBarItem* root = new ToolBarItem;

    // View
    ToolBarItem* view = new ToolBarItem( root );
    view->setCommand("Standard views");
    *view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_ViewAxo" << "Separator"
          << "Std_ViewFront" << "Std_ViewRight" << "Std_ViewTop" << "Separator"
          << "Std_ViewRear" << "Std_ViewLeft" << "Std_ViewBottom";
    // Special Ops
    ToolBarItem* macro = new ToolBarItem( root );
    macro->setCommand("Special Ops");
    *macro << "Std_DlgParameter" << "Std_DlgPreferences" << "Std_DlgMacroRecord" << "Std_MacroStopRecord" 
           << "Std_DlgMacroExecute" << "Std_DlgCustomize";

    return root;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:18,代码来源:Workbench.cpp

示例4: setupCustomToolbars

void Workbench::setupCustomToolbars(ToolBarItem* root, const char* toolbar) const
{
    std::string name = this->name();
    ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
        ->GetGroup("Workbench")->GetGroup(name.c_str())->GetGroup(toolbar);
  
    std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
    CommandManager& rMgr = Application::Instance->commandManager();
    for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
        bool active = (*it)->GetBool("Active", true);
        if (!active) // ignore this toolbar
            continue;
        ToolBarItem* bar = new ToolBarItem(root);
        bar->setCommand("Custom");
   
        // get the elements of the subgroups
        std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
        for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
            if (it2->first == "Separator") {
                *bar << "Separator";
            } else if (it2->first == "Name") {
                bar->setCommand(it2->second);
            } else {
                Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
                if (!pCmd) { // unknown command
                    // try to find out the appropriate module name
                    std::string pyMod = it2->second + "Gui";
                    try {
                        Base::Interpreter().loadModule(pyMod.c_str());
                    }
                    catch(const Base::Exception&) {
                    }

                    // Try again
                    pCmd = rMgr.getCommandByName(it2->first.c_str());
                }

                if (pCmd) {
                    *bar << it2->first; // command name
                }
            }
        }
    }
}
开发者ID:JonasThomas,项目名称:free-cad,代码行数:44,代码来源:Workbench.cpp

示例5: appendToolbar

void PythonBaseWorkbench::appendToolbar(const std::string& bar, const std::list<std::string>& items) const
{
    ToolBarItem* item = _toolBar->findItem(bar);
    if (!item)
    {
        item = new ToolBarItem(_toolBar);
        item->setCommand(bar);
    }

    for (std::list<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
        *item << *it;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:12,代码来源:Workbench.cpp


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