本文整理汇总了C++中InternalWindowRecPtr::setBorders方法的典型用法代码示例。如果您正苦于以下问题:C++ InternalWindowRecPtr::setBorders方法的具体用法?C++ InternalWindowRecPtr::setBorders怎么用?C++ InternalWindowRecPtr::setBorders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalWindowRecPtr
的用法示例。
在下文中一共展示了InternalWindowRecPtr::setBorders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
{
// Set up Window
WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
TutorialWindow->initWindow();
// Create the SimpleSceneManager helper
SimpleSceneManager sceneManager;
TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));
// Tell the Manager what to manage
sceneManager.setWindow(TutorialWindow);
TutorialWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
TutorialWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
TutorialWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
TutorialWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));
TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1));
// Make Main Scene Node
NodeRecPtr Scene = makeCoredNode<Group>();
NodeRecPtr TorusNode = createTorus();
NodeRecPtr SphereNode = createSphere();
NodeRecPtr ConeNode = createCone();
NodeRecPtr BoxNode = createBox();
Scene->addChild(TorusNode);
Scene->addChild(SphereNode);
Scene->addChild(ConeNode);
Scene->addChild(BoxNode);
// Create the Graphics
GraphicsRecPtr TutorialGraphics = Graphics2D::create();
// Initialize the LookAndFeelManager to enable default settings
LookAndFeelManager::the()->getLookAndFeel()->init();
/******************************************************
Create a Background
******************************************************/
ColorLayerRecPtr GreyBackground = ColorLayer::create();
GreyBackground->setColor(Color4f(.93,.93,.93,1.0));
/******************************************************
Create some Borders
******************************************************/
LineBorderRecPtr PanelBorder = LineBorder::create();
EmptyBorderRecPtr Panel1Border = EmptyBorder::create();
EmptyBorderRecPtr Panel2Border = EmptyBorder::create();
EmptyBorderRecPtr emptyBorder = EmptyBorder::create();
PanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0));
PanelBorder->setWidth(1);
Panel1Border->setTopWidth(0);
Panel1Border->setBottomWidth(6);
Panel1Border->setLeftWidth(0);
Panel1Border->setRightWidth(0);
Panel2Border->setTopWidth(0);
Panel2Border->setBottomWidth(0);
Panel2Border->setLeftWidth(0);
Panel2Border->setRightWidth(0);
/******************************************************
Create some Labels and stuff to go
with them
******************************************************/
LabelRecPtr LeftPanelLabel1 = Label::create();
UIFontRecPtr LeftPanelLabel1Font = UIFont::create();
LeftPanelLabel1Font->setSize(50);
LeftPanelLabel1->setBorders(emptyBorder);
LeftPanelLabel1->setBackgrounds(GreyBackground);
LeftPanelLabel1->setFont(LeftPanelLabel1Font);
LeftPanelLabel1->setText("OSG Gui");
LeftPanelLabel1->setPreferredSize(Vec2f(300, 100));
LeftPanelLabel1->setAlignment(Vec2f(0.0f, 0.5f));
/******************************************************
Create some Layouts
******************************************************/
//.........这里部分代码省略.........
示例2: 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
MenuBarRecPtr MainMenuBar = MenuBar::create();
// Adds the two Menus to the MainMenuBar
MainMenuBar->addMenu(FileMenu);
MainMenuBar->addMenu(EditMenu);
// Create two Labels
LabelRecPtr ExampleLabel1 = Label::create();
LabelRecPtr ExampleLabel2 = 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
EmptyLayerRecPtr MainInternalWindowBackground = EmptyLayer::create();
EmptyBorderRecPtr MainInternalWindowBorder = EmptyBorder::create();
LayoutRecPtr MainInternalWindowLayout = FlowLayout::create();
InternalWindowRecPtr MainInternalWindow = 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
UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
TutorialDrawingSurface->setGraphics(TutorialGraphics);
TutorialDrawingSurface->setEventProducer(TutorialWindow);
TutorialDrawingSurface->openWindow(MainInternalWindow);
// Create the UI Foreground Object
UIForegroundRecPtr TutorialUIForeground = UIForeground::create();
TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface);
// Tell the Manager what to manage
sceneManager->setRoot(scene);
// Add the UI Foreground Object to the Scene
ViewportRecPtr TutorialViewport = sceneManager->getWindow()->getPort(0);
TutorialViewport->addForeground(TutorialUIForeground);
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(sceneManager, TutorialWindow);
// Show the whole Scene
sceneManager->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;
}
示例3: main
//.........这里部分代码省略.........
NodeTravMaskValueLabel->setPreferredSize(Vec2f(300.0f, 20.0f));
//Details Panel
BorderLayoutConstraintsRecPtr NodeDetailPanelConstraints = BorderLayoutConstraints::create();
NodeDetailPanelConstraints->setRegion(BorderLayoutConstraints::BORDER_SOUTH);
GridLayoutRecPtr NodeDetailPanelLayout = GridLayout::create();
NodeDetailPanelLayout->setRows(7);
NodeDetailPanelLayout->setColumns(2);
NodeDetailPanelLayout->setHorizontalGap(2);
NodeDetailPanelLayout->setVerticalGap(2);
PanelRecPtr NodeDetailPanel = Panel::create();
NodeDetailPanel->setConstraints(NodeDetailPanelConstraints);
NodeDetailPanel->setPreferredSize(Vec2f(100.0f, 200.0f));
NodeDetailPanel->setLayout(NodeDetailPanelLayout);
NodeDetailPanel->pushToChildren(NodeNameLabel);
NodeDetailPanel->pushToChildren(NodeNameValueLabel);
NodeDetailPanel->pushToChildren(NodeCoreTypeLabel);
NodeDetailPanel->pushToChildren(NodeCoreTypeValueLabel);
NodeDetailPanel->pushToChildren(NodeMinLabel);
NodeDetailPanel->pushToChildren(NodeMinValueLabel);
NodeDetailPanel->pushToChildren(NodeMaxLabel);
NodeDetailPanel->pushToChildren(NodeMaxValueLabel);
NodeDetailPanel->pushToChildren(NodeCenterLabel);
NodeDetailPanel->pushToChildren(NodeCenterValueLabel);
NodeDetailPanel->pushToChildren(NodeTriCountLabel);
NodeDetailPanel->pushToChildren(NodeTriCountValueLabel);
NodeDetailPanel->pushToChildren(NodeTravMaskLabel);
NodeDetailPanel->pushToChildren(NodeTravMaskValueLabel);
SelectionHandler TheTreeSelectionHandler(TheTree,
&sceneManager,
NodeNameValueLabel,
NodeCoreTypeValueLabel,
NodeMinValueLabel,
NodeMaxValueLabel,
NodeCenterValueLabel,
NodeTriCountValueLabel,
NodeTravMaskValueLabel);
// Create The Main InternalWindow
// Create Background to be used with the Main InternalWindow
ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create();
MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));
LayoutRecPtr MainInternalWindowLayout = BorderLayout::create();
InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
MainInternalWindow->pushToChildren(ExampleScrollPanel);
MainInternalWindow->pushToChildren(NodeDetailPanel);
MainInternalWindow->setLayout(MainInternalWindowLayout);
MainInternalWindow->setBackgrounds(NULL);
MainInternalWindow->setBorders(NULL);
MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.0f,0.5f));
MainInternalWindow->setScalingInDrawingSurface(Vec2f(1.0,1.0));
MainInternalWindow->setDrawTitlebar(false);
MainInternalWindow->setResizable(false);
// Create the Drawing Surface
UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
TutorialDrawingSurface->setGraphics(TutorialGraphics);
TutorialDrawingSurface->setEventProducer(TutorialWindow);
TutorialDrawingSurface->openWindow(MainInternalWindow);
// Create the UI Foreground Object
UIForegroundRecPtr TutorialUIForeground = UIForeground::create();
TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface);
// Tell the Manager what to manage
sceneManager.setRoot(Root);
// Add the UI Foreground Object to the Scene
ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0);
TutorialViewport->addForeground(TutorialUIForeground);
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);
// Show the whole Scene
sceneManager.showAll();
//Open Window
Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
TutorialWindow->openWindow(WinPos,
WinSize,
"52SceneGraphTree");
//Enter main Loop
TutorialWindow->mainLoop();
}
osgExit();
return 0;
}