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


C++ IPlugin::CreatePluginMenu方法代码示例

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


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

示例1: Load


//.........这里部分代码省略.........

                m_pluginsData.DisablePlugin(pluginInfo.GetName());
                continue;
            }

            // Construct the plugin
            IPlugin* plugin = pfn((IManager*)this);
            CL_DEBUG(wxT("Loaded plugin: ") + plugin->GetLongName());
            m_plugins[plugin->GetShortName()] = plugin;

            // Load the toolbar
            clToolBar* tb = plugin->CreateToolBar((wxWindow*)clMainFrame::Get());
            if(tb) {
#if USE_AUI_TOOLBAR
                // When using AUI toolbars, use our own custom art-provider
                tb->SetArtProvider(new CLMainAuiTBArt());
#endif
                clMainFrame::Get()->GetDockingManager().AddPane(tb,
                                                                wxAuiPaneInfo()
                                                                    .Name(plugin->GetShortName())
                                                                    .LeftDockable(true)
                                                                    .RightDockable(true)
                                                                    .Caption(plugin->GetShortName())
                                                                    .ToolbarPane()
                                                                    .Top()
                                                                    .Row(0));

                // Add menu entry at the 'View->Toolbars' menu for this toolbar
                wxMenuItem* item = clMainFrame::Get()->GetMenuBar()->FindItem(XRCID("toolbars_menu"));
                if(item) {
                    wxMenu* submenu = NULL;
                    submenu = item->GetSubMenu();
                    // add the new toolbar entry at the end of this menu

                    int id = wxNewId();
                    wxString text(plugin->GetShortName());
                    text << _(" ToolBar");
                    wxMenuItem* newItem = new wxMenuItem(submenu, id, text, wxEmptyString, wxITEM_CHECK);
                    submenu->Append(newItem);
                    clMainFrame::Get()->RegisterToolbar(id, plugin->GetShortName());
                }
            }

            // Keep the dynamic load library
            m_dl.push_back(dl);
        }
        clMainFrame::Get()->GetDockingManager().Update();

        // Let the plugins plug their menu in the 'Plugins' menu at the menu bar
        // the create menu will be placed as a sub menu of the 'Plugin' menu
        wxMenu* pluginsMenu = NULL;
        wxMenuItem* menuitem = clMainFrame::Get()->GetMenuBar()->FindItem(XRCID("manage_plugins"), &pluginsMenu);
        if(pluginsMenu && menuitem) {
            std::map<wxString, IPlugin*>::iterator iter = m_plugins.begin();
            for(; iter != m_plugins.end(); ++iter) {
                IPlugin* plugin = iter->second;
                plugin->CreatePluginMenu(pluginsMenu);
            }
        }

        // save the plugins data
        conf.WriteItem(&m_pluginsData);
    }

    // Now that all the plugins are loaded, load from the configuration file
    // list of visible tabs
    static wxArrayString DefaultArray;
    if(DefaultArray.IsEmpty()) {
        DefaultArray.Add("NOT-FOUND");
    }
    {
        const wxArrayString& tabs = GetWorkspaceTabs();
        wxArrayString visibleTabs = clConfig::Get().Read("VisibleWorkspaceTabs", DefaultArray);
        if(!((visibleTabs.size() == 1) && (visibleTabs.Item(0) == "NOT-FOUND"))) {
            for(size_t i = 0; i < tabs.size(); ++i) {
                if(visibleTabs.Index(tabs.Item(i)) == wxNOT_FOUND) {
                    // hidden tab - post an event
                    clCommandEvent eventHide(wxEVT_SHOW_WORKSPACE_TAB);
                    eventHide.SetSelected(false).SetString(tabs.Item(i));
                    EventNotifier::Get()->AddPendingEvent(eventHide);
                }
            }
        }
    }

    {
        const wxArrayString& tabs = GetOutputTabs();
        wxArrayString visibleTabs = clConfig::Get().Read("VisibleOutputTabs", DefaultArray);
        if(!((visibleTabs.size() == 1) && (visibleTabs.Item(0) == "NOT-FOUND"))) {
            for(size_t i = 0; i < tabs.size(); ++i) {
                if(visibleTabs.Index(tabs.Item(i)) == wxNOT_FOUND) {
                    // hidden tab - post an event
                    clCommandEvent eventHide(wxEVT_SHOW_OUTPUT_TAB);
                    eventHide.SetSelected(false).SetString(tabs.Item(i));
                    EventNotifier::Get()->AddPendingEvent(eventHide);
                }
            }
        }
    }
}
开发者ID:kaustubhcs,项目名称:codelite,代码行数:101,代码来源:pluginmanager.cpp


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