本文整理汇总了C++中InternalWindowRefPtr::setMenuBar方法的典型用法代码示例。如果您正苦于以下问题:C++ InternalWindowRefPtr::setMenuBar方法的具体用法?C++ InternalWindowRefPtr::setMenuBar怎么用?C++ InternalWindowRefPtr::setMenuBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalWindowRefPtr
的用法示例。
在下文中一共展示了InternalWindowRefPtr::setMenuBar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
/******************************************************
Create MainMenuBar and adds the Menus
created above to it.
Also creates several Backgrounds
to improve MenuBar overall look.
Both the MenuBar and Menu can have
Backgrounds; the set up currently
is to have EmptyBackgrounds in
each Menu allowing a single
overall MenuBar Background which
is given to the MenuBar itself.
This can be easily changed by adding
different Backgrounds to the
File and Edit Menus.
Note: The MenuBar is added to the
MainFrame below.
******************************************************/
// Creates two Backgrounds
MenuBarRefPtr MainMenuBar = MenuBar::create();
// Adds the two Menus to the MainMenuBar
MainMenuBar->addMenu(FileMenu);
MainMenuBar->addMenu(EditMenu);
// Create two Labels
LabelRefPtr ExampleLabel1 = OSG::Label::create();
LabelRefPtr ExampleLabel2 = OSG::Label::create();
ExampleLabel1->setText("Look up in the corner!");
ExampleLabel1->setPreferredSize(Vec2f(150, 25));
ExampleLabel2->setText("Hit Control + Z");
ExampleLabel2->setPreferredSize(Vec2f(150, 25));
// Create The Main InternalWindow
// Create Background to be used with the Main InternalWindow
EmptyLayerRefPtr MainInternalWindowBackground = OSG::EmptyLayer::create();
EmptyBorderRefPtr MainInternalWindowBorder = OSG::EmptyBorder::create();
LayoutRefPtr MainInternalWindowLayout = OSG::FlowLayout::create();
InternalWindowRefPtr MainInternalWindow = OSG::InternalWindow::create();
MainInternalWindow->pushToChildren(ExampleLabel1);
MainInternalWindow->pushToChildren(ExampleLabel2);
MainInternalWindow->setLayout(MainInternalWindowLayout);
MainInternalWindow->setMenuBar(MainMenuBar);
MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
MainInternalWindow->setBorders(MainInternalWindowBorder);
MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
MainInternalWindow->setScalingInDrawingSurface(Vec2f(1.0f,1.0f));
MainInternalWindow->setDrawTitlebar(false);
MainInternalWindow->setResizable(false);
// Create the Drawing Surface
UIDrawingSurfaceRefPtr TutorialDrawingSurface = UIDrawingSurface::create();
TutorialDrawingSurface->setGraphics(TutorialGraphics);
TutorialDrawingSurface->setEventProducer(TutorialWindow);
TutorialDrawingSurface->openWindow(MainInternalWindow);
// Create the UI Foreground Object
UIForegroundRefPtr TutorialUIForeground = OSG::UIForeground::create();
TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface);
// Create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// Tell the Manager what to manage
mgr->setWindow(TutorialWindow);
mgr->setRoot(scene);
// Add the UI Foreground Object to the Scene
ViewportRefPtr TutorialViewport = mgr->getWindow()->getPort(0);
TutorialViewport->addForeground(TutorialUIForeground);
// Show the whole Scene
mgr->showAll();
//Open Window
Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
TutorialWindow->openWindow(WinPos,
WinSize,
"26MenuBar");
//Enter main Loop
TutorialWindow->mainLoop();
osgExit();
return 0;
}