virtual void execute(void) { _HasBeenDone = true; _PreviousColor = _TheBorder->getColor(); _TheBorder->setColor(_ChangeToColor); }
ComponentTransitPtr DefaultTableCellEditor::getTableCellEditorComponent(Table* const table, const boost::any& value, bool isSelected, UInt32 row, UInt32 column) { if(value.empty()){ return ComponentTransitPtr(NULL); } TextFieldRefPtr TheTextField = TextField::create(); std::string tempString; try { tempString = lexical_cast(value); } catch (boost::bad_lexical_cast &) { //Could not convert to string } TheTextField->setText(tempString); TheTextField->setPreferredSize(Vec2f(100,30)); TheTextField->setAlignment(Vec2f(0.5,0.5)); TheTextField->selectAll(); TheTextField->setCaretPosition(TheTextField->getText().size()); ColorLayerRefPtr tempBackground; tempBackground = ColorLayer::create(); TheTextField->setBackground(tempBackground); //if(isSelected){ // tempBackground->setColor(Color4f(0.4, 0.4, 1.0, 1.0)); //} //else{ tempBackground->setColor(Color4f(1.0, 1.0, 1.0, 1.0)); //} LineBorderRefPtr tempBorder; tempBorder = LineBorder::create(); tempBorder->setColor(Color4f(0.0, 0.0, 1.0, 1.0)); TheTextField->setBorder(tempBorder); setDefaultStringEditor(TheTextField); _EditorActionConnection = getDefaultStringEditor()->connectActionPerformed(boost::bind(&DefaultTableCellEditor::handleEditorAction, this, _1)); _EditorFocusLostConnection = getDefaultStringEditor()->connectFocusLost(boost::bind(&DefaultTableCellEditor::handleEditorFocusLost, this, _1)); _EditorKeyPressedConnection = getDefaultStringEditor()->connectKeyPressed(boost::bind(&DefaultTableCellEditor::handleEditorKeyPressed, this, _1)); return ComponentTransitPtr(getDefaultStringEditor()); }
PanelUnrecPtr createSingleFieldPanel(void) { ChangableBorder = OSG::LineBorder::create(); ChangableBorder->setColor(Color4f(0.0,0.0,0.0,1.0)); ChangableBackground = OSG::ColorLayer::create(); ChangableBackground->setColor(Color4f(1.0,1.0,1.0,1.0)); LabelRefPtr ChangableLabel = OSG::Label::create(); ChangableLabel->setText("Changable"); ChangableLabel->setBorders(ChangableBorder); ChangableLabel->setBackgrounds(ChangableBackground); //Command Buttons TheCommandManager = CommandManager::create(TheUndoManager); ButtonRefPtr BorderRedButton = OSG::Button::create(); BorderRedButton->setText("Border Red"); SetBorderColorActionListener* TheSetRedBorderColorActionListener = new SetBorderColorActionListener(ChangableBorder, Color4f(1.0,0.0,0.0,1.0), TheCommandManager); BorderRedButton->addActionListener(TheSetRedBorderColorActionListener); ButtonRefPtr BorderGreenButton = OSG::Button::create(); BorderGreenButton->setText("Border Green"); SetBorderColorActionListener* TheSetGreenBorderColorActionListener = new SetBorderColorActionListener(ChangableBorder, Color4f(0.0,1.0,0.0,1.0), TheCommandManager); BorderGreenButton->addActionListener(TheSetGreenBorderColorActionListener); ButtonRefPtr BorderBlueButton = OSG::Button::create(); BorderBlueButton->setText("Border Blue"); SetBorderColorActionListener* TheSetBlueBorderColorActionListener = new SetBorderColorActionListener(ChangableBorder, Color4f(0.0,0.0,1.0,1.0), TheCommandManager); BorderBlueButton->addActionListener(TheSetBlueBorderColorActionListener); //Background ButtonRefPtr BackgroundRedButton = OSG::Button::create(); BackgroundRedButton->setText("Background Red"); SetBackgroundColorActionListener* TheSetRedBackgroundColorActionListener = new SetBackgroundColorActionListener(ChangableBackground, Color4f(1.0,0.0,0.0,1.0), TheCommandManager); BackgroundRedButton->addActionListener(TheSetRedBackgroundColorActionListener); ButtonRefPtr BackgroundGreenButton = OSG::Button::create(); BackgroundGreenButton->setText("Background Green"); SetBackgroundColorActionListener* TheSetGreenBackgroundColorActionListener = new SetBackgroundColorActionListener(ChangableBackground, Color4f(0.0,1.0,0.0,1.0), TheCommandManager); BackgroundGreenButton->addActionListener(TheSetGreenBackgroundColorActionListener); ButtonRefPtr BackgroundBlueButton = OSG::Button::create(); BackgroundBlueButton->setText("Background Blue"); SetBackgroundColorActionListener* TheSetBlueBackgroundColorActionListener = new SetBackgroundColorActionListener(ChangableBackground, Color4f(0.0,0.0,1.0,1.0), TheCommandManager); BackgroundBlueButton->addActionListener(TheSetBlueBackgroundColorActionListener); LayoutRefPtr ThePanelLayout = OSG::FlowLayout::create(); PanelRefPtr ThePanel = Panel::createEmpty(); ThePanel->setLayout(ThePanelLayout); ThePanel->pushToChildren(BorderRedButton); ThePanel->pushToChildren(BorderGreenButton); ThePanel->pushToChildren(BorderBlueButton); ThePanel->pushToChildren(BackgroundRedButton); ThePanel->pushToChildren(BackgroundGreenButton); ThePanel->pushToChildren(BackgroundBlueButton); ThePanel->pushToChildren(ChangableLabel); return ThePanel; }
OSG_BEGIN_NAMESPACE /***************************************************************************\ * Description * \***************************************************************************/ /*! \class OSG::DefaultStringTableCellRenderer A DefaultStringTableCellRenderer. */ /***************************************************************************\ * Class variables * \***************************************************************************/ /***************************************************************************\ * Class methods * \***************************************************************************/ /***************************************************************************\ * Instance methods * \***************************************************************************/ ComponentRefPtr DefaultStringTableCellRenderer::getTableCellRendererComponent(TableRefPtr table, const boost::any& value, bool isSelected, bool hasFocus, UInt32 row, UInt32 column) { if(value.empty()){ return NULL; } LabelRefPtr TheLabel = Label::create(); std::string tempString; try { tempString = lexical_cast(value); } catch (boost::bad_lexical_cast &) { //Could not convert to string } TheLabel->setText(tempString); TheLabel->setPreferredSize(Vec2f(100,30)); ColorLayerRefPtr tempBackground; tempBackground = ColorLayer::create(); TheLabel->setBackgrounds(tempBackground); if(isSelected){ tempBackground->setColor(Color4f(0.4, 0.4, 1.0, 1.0)); } else{ tempBackground->setColor(Color4f(1.0, 1.0, 1.0, 1.0)); } if(hasFocus){ LineBorderRefPtr tempBorder; tempBorder = LineBorder::create(); TheLabel->setBorders(tempBorder); tempBorder->setColor(Color4f(0.0, 0.0, 1.0, 1.0)); } else{ EmptyBorderRefPtr tempBorder; tempBorder = EmptyBorder::create(); TheLabel->setBorders(tempBorder); } return dynamic_pointer_cast<Component>(TheLabel); }
int main(int argc, char **argv) { // OSG init osgInit(argc,argv); // Set up Window TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); TutorialWindow->setDisplayCallback(display); TutorialWindow->setReshapeCallback(reshape); TutorialKeyListener TheKeyListener; TutorialWindow->addKeyListener(&TheKeyListener); // Make Torus Node (creates Torus in background of scene) NodeRefPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16); // Make Main Scene Node and add the Torus NodeRefPtr scene = OSG::Node::create(); scene->setCore(OSG::Group::create()); scene->addChild(TorusGeometryNode); // Create the Graphics GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create(); // Initialize the LookAndFeelManager to enable default settings LookAndFeelManager::the()->getLookAndFeel()->init(); /****************************************************** Create an Button Component and a simple Font. See 17Label_Font for more information about Fonts. ******************************************************/ ChangableBorder = OSG::LineBorder::create(); ChangableBorder->setColor(Color4f(0.0,0.0,0.0,1.0)); ChangableBackground = OSG::ColorLayer::create(); ChangableBackground->setColor(Color4f(1.0,1.0,1.0,1.0)); LabelRefPtr ChangableLabel = OSG::Label::create(); ChangableLabel->setText("Changable"); ChangableLabel->setBorders(ChangableBorder); ChangableLabel->setBackgrounds(ChangableBackground); //Command Buttons TheUndoManager = UndoManager::create(); UndoManagerChangeListener TheUndoManagerChangeListener; TheUndoManager->addChangeListener(&TheUndoManagerChangeListener); CommandManagerPtr TheCommandManager = CommandManager::create(TheUndoManager); ButtonRefPtr BorderRedButton = OSG::Button::create(); BorderRedButton->setText("Border Red"); SetBorderColorActionListener TheSetRedBorderColorActionListener(ChangableBorder, Color4f(1.0,0.0,0.0,1.0), TheCommandManager); BorderRedButton->addActionListener(&TheSetRedBorderColorActionListener); ButtonRefPtr BorderGreenButton = OSG::Button::create(); BorderGreenButton->setText("Border Green"); SetBorderColorActionListener TheSetGreenBorderColorActionListener(ChangableBorder, Color4f(0.0,1.0,0.0,1.0), TheCommandManager); BorderGreenButton->addActionListener(&TheSetGreenBorderColorActionListener); ButtonRefPtr BorderBlueButton = OSG::Button::create(); BorderBlueButton->setText("Border Blue"); SetBorderColorActionListener TheSetBlueBorderColorActionListener(ChangableBorder, Color4f(0.0,0.0,1.0,1.0), TheCommandManager); BorderBlueButton->addActionListener(&TheSetBlueBorderColorActionListener); //Background ButtonRefPtr BackgroundRedButton = OSG::Button::create(); BackgroundRedButton->setText("Background Red"); SetBackgroundColorActionListener TheSetRedBackgroundColorActionListener(ChangableBackground, Color4f(1.0,0.0,0.0,1.0), TheCommandManager); BackgroundRedButton->addActionListener(&TheSetRedBackgroundColorActionListener); ButtonRefPtr BackgroundGreenButton = OSG::Button::create(); BackgroundGreenButton->setText("Background Green"); SetBackgroundColorActionListener TheSetGreenBackgroundColorActionListener(ChangableBackground, Color4f(0.0,1.0,0.0,1.0), TheCommandManager); BackgroundGreenButton->addActionListener(&TheSetGreenBackgroundColorActionListener); ButtonRefPtr BackgroundBlueButton = OSG::Button::create(); BackgroundBlueButton->setText("Background Blue"); SetBackgroundColorActionListener TheSetBlueBackgroundColorActionListener(ChangableBackground, Color4f(0.0,0.0,1.0,1.0), TheCommandManager); BackgroundBlueButton->addActionListener(&TheSetBlueBackgroundColorActionListener); //UndoList UndoRedoListModel = DefaultListModel::create(); UndoRedoListModel->pushBack(boost::any(std::string("Top"))); ListSelectionModelPtr UndoRedoListSelectionModel(new DefaultListSelectionModel()); UndoRedoList = List::create(); UndoRedoList->setPreferredSize(Vec2f(200, 300)); UndoRedoList->setOrientation(List::VERTICAL_ORIENTATION); UndoRedoList->setModel(UndoRedoListModel); UndoRedoList->setSelectionModel(UndoRedoListSelectionModel); UndoRedoListListener TheUndoRedoListListener; UndoRedoList->getSelectionModel()->addListSelectionListener(&TheUndoRedoListListener); UndoButton = OSG::Button::create(); UndoButton->setText("Undo"); UndoButton->setEnabled(TheUndoManager->numberOfUndos() != 0); UndoButtonActionListener TheUndoButtonActionListener; UndoButton->addActionListener(&TheUndoButtonActionListener); RedoButton = OSG::Button::create(); RedoButton->setText("Redo"); RedoButton->setEnabled(TheUndoManager->numberOfRedos() != 0); RedoButtonActionListener TheRedoButtonActionListener; RedoButton->addActionListener(&TheRedoButtonActionListener); // Create a ScrollPanel for easier viewing of the List (see 27ScrollPanel) ScrollPanelRefPtr UndoRedoScrollPanel = ScrollPanel::create(); UndoRedoScrollPanel->setPreferredSize(Vec2f(200,200)); UndoRedoScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW); UndoRedoScrollPanel->setViewComponent(UndoRedoList); // Create The Main InternalWindow // Create Background to be used with the Main InternalWindow ColorLayerRefPtr MainInternalWindowBackground = OSG::ColorLayer::create(); MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5)); InternalWindowRefPtr MainInternalWindow = OSG::InternalWindow::create(); LayoutRefPtr MainInternalWindowLayout = OSG::FlowLayout::create(); MainInternalWindow->pushToChildren(BorderRedButton); MainInternalWindow->pushToChildren(BorderGreenButton); MainInternalWindow->pushToChildren(BorderBlueButton); MainInternalWindow->pushToChildren(BackgroundRedButton); MainInternalWindow->pushToChildren(BackgroundGreenButton); MainInternalWindow->pushToChildren(BackgroundBlueButton); MainInternalWindow->pushToChildren(ChangableLabel); MainInternalWindow->pushToChildren(UndoRedoScrollPanel); MainInternalWindow->pushToChildren(UndoButton); MainInternalWindow->pushToChildren(RedoButton); MainInternalWindow->setLayout(MainInternalWindowLayout); MainInternalWindow->setBackgrounds(MainInternalWindowBackground); MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f)); MainInternalWindow->setScalingInDrawingSurface(Vec2f(0.95f,0.95f)); 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, "40UndoableCommand"); //Enter main Loop TutorialWindow->mainLoop(); osgExit(); return 0; }
virtual void undo(void) { Inherited::undo(); _TheBorder->setColor(_PreviousColor); }
virtual void redo(void) { Inherited::redo(); _TheBorder->setColor(_ChangeToColor); }
OSG_BEGIN_NAMESPACE /***************************************************************************\ * Description * \***************************************************************************/ /*! \class OSG::DefaultBoolTableCellRenderer A DefaultBoolTableCellRenderer. */ /***************************************************************************\ * Class variables * \***************************************************************************/ /***************************************************************************\ * Class methods * \***************************************************************************/ /***************************************************************************\ * Instance methods * \***************************************************************************/ ComponentTransitPtr DefaultBoolTableCellRenderer::getTableCellRendererComponent(Table* const table, const boost::any& value, bool isSelected, bool hasFocus, UInt32 row, UInt32 column) { if(value.empty()){ return ComponentTransitPtr(NULL); } LabelRefPtr TheLabel = Label::create(); std::string tempString; try { if(boost::any_cast<bool>(value)) { tempString = "True"; } else { tempString = "False"; } } catch (boost::bad_any_cast &) { //Not a bool } TheLabel->setText(tempString); TheLabel->setPreferredSize(Vec2f(100,30)); ColorLayerRefPtr tempBackground; tempBackground = ColorLayer::create(); TheLabel->setBackgrounds(tempBackground); if(isSelected){ tempBackground->setColor(Color4f(0.4, 0.4, 1.0, 1.0)); } else{ tempBackground->setColor(Color4f(1.0, 1.0, 1.0, 1.0)); } if(hasFocus){ LineBorderRefPtr tempBorder; tempBorder = LineBorder::create(); TheLabel->setBorders(tempBorder); tempBorder->setColor(Color4f(0.0, 0.0, 1.0, 1.0)); } else{ EmptyBorderRefPtr tempBorder; tempBorder = EmptyBorder::create(); TheLabel->setBorders(tempBorder); } return ComponentTransitPtr(TheLabel.get()); }
ComponentRefPtr createLeftPanelButtonPanel(void) { // Create Label for this Panel LabelRefPtr LeftPanelButtonPanelLabel = OSG::Label::create(); LeftPanelButtonPanelLabel->setTextColor(Color4f(1.0,1.0,1.0,1.0)); LeftPanelButtonPanelLabel->setRolloverTextColor(Color4f(1.0,1.0,1.0,1.0)); LeftPanelButtonPanelLabel->setBackground(createComplexBackground()); LeftPanelButtonPanelLabel->setPreferredSize(Vec2f(100, 50)); LeftPanelButtonPanelLabel->setText("Various Options"); LeftPanelButtonPanelLabel->setAlignment(Vec2f(0.5,0.5)); // Create and edit the Panel buttons ButtonRefPtr LeftPanelButton1 = OSG::Button::create(); ButtonRefPtr LeftPanelButton2 = OSG::Button::create(); ButtonRefPtr LeftPanelButton3 = OSG::Button::create(); ButtonRefPtr LeftPanelButton4 = OSG::Button::create(); ButtonRefPtr LeftPanelButton5 = OSG::Button::create(); ButtonRefPtr LeftPanelButton6 = OSG::Button::create(); LeftPanelButton1->setText("This"); LeftPanelButton1->setPreferredSize(Vec2f(100,50)); LeftPanelButton2->setText("is"); LeftPanelButton2->setPreferredSize(Vec2f(100,50)); LeftPanelButton3->setText("an"); LeftPanelButton3->setPreferredSize(Vec2f(100,50)); LeftPanelButton4->setText("example"); LeftPanelButton4->setPreferredSize(Vec2f(100,50)); LeftPanelButton5->setText("user"); LeftPanelButton5->setPreferredSize(Vec2f(100,50)); LeftPanelButton6->setText("interface."); LeftPanelButton6->setPreferredSize(Vec2f(100,50)); // Create and edit Panel layout BoxLayoutRefPtr LeftPanelButtonPanelLayout = OSG::BoxLayout::create(); LeftPanelButtonPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION); // Create an edit Panel Background ColorLayerRefPtr LeftPanelButtonPanelBackground = OSG::ColorLayer::create(); LeftPanelButtonPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0)); // Create Panel Border LineBorderRefPtr LeftPanelBorder = OSG::LineBorder::create(); LeftPanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0)); LeftPanelBorder->setWidth(1); // Create and edit Panel PanelRefPtr LeftPanelButtonPanel = OSG::Panel::create(); LeftPanelButtonPanel->setPreferredSize(Vec2f(180, 500)); LeftPanelButtonPanel->pushToChildren(LeftPanelButtonPanelLabel); LeftPanelButtonPanel->pushToChildren(LeftPanelButton1); LeftPanelButtonPanel->pushToChildren(LeftPanelButton2); LeftPanelButtonPanel->pushToChildren(LeftPanelButton3); LeftPanelButtonPanel->pushToChildren(LeftPanelButton4); LeftPanelButtonPanel->pushToChildren(LeftPanelButton5); LeftPanelButtonPanel->pushToChildren(LeftPanelButton6); LeftPanelButtonPanel->setLayout(LeftPanelButtonPanelLayout); LeftPanelButtonPanel->setBackgrounds(LeftPanelButtonPanelBackground); LeftPanelButtonPanel->setBorders(LeftPanelBorder); return LeftPanelButtonPanel; }
int main(int argc, char **argv) { // OSG init osgInit(argc,argv); // Set up Window TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); TutorialWindow->setDisplayCallback(display); TutorialWindow->setReshapeCallback(reshape); TutorialMouseListener mouseListener; TutorialMouseMotionListener mouseMotionListener; TutorialWindow->addMouseListener(&mouseListener); TutorialWindow->addMouseMotionListener(&mouseMotionListener); TutorialKeyListener TheKeyListener; TutorialWindow->addKeyListener(&TheKeyListener); // Create the SimpleSceneManager helper mgr = new SimpleSceneManager; // Tell the Manager what to manage mgr->setWindow(TutorialWindow); // Set up Window //Load in File NodeRefPtr LoadedFile = SceneFileHandler::the()->read("C:\\Documents and Settings\\All Users\\Documents\\Cell.osb"); // Make Main Scene Node create3DObjects(); scene = OSG::Node::create(); scene->setCore(OSG::Group::create()); scene->addChild(LoadedFile); // Create the Graphics GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create(); // Initialize the LookAndFeelManager to enable default settings LookAndFeelManager::the()->getLookAndFeel()->init(); /****************************************************** Create a Background ******************************************************/ ColorLayerRefPtr GreyBackground = OSG::ColorLayer::create(); GreyBackground->setColor(Color4f(.93,.93,.93,1.0)); /****************************************************** Create some Borders ******************************************************/ LineBorderRefPtr PanelBorder = OSG::LineBorder::create(); EmptyBorderRefPtr Panel1Border = OSG::EmptyBorder::create(); EmptyBorderRefPtr Panel2Border = OSG::EmptyBorder::create(); EmptyBorderRefPtr emptyBorder = OSG::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 ******************************************************/ LabelRefPtr LeftPanelLabel1 = OSG::Label::create(); UIFontRefPtr LeftPanelLabel1Font = OSG::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 ******************************************************/ BoxLayoutRefPtr MainInternalWindowLayout = OSG::BoxLayout::create(); FlowLayoutRefPtr LeftPanelLayout = OSG::FlowLayout::create(); BoxLayoutRefPtr RightPanelLayout = OSG::BoxLayout::create(); MainInternalWindowLayout->setOrientation(BoxLayout::HORIZONTAL_ORIENTATION); LeftPanelLayout->setOrientation(FlowLayout::HORIZONTAL_ORIENTATION); LeftPanelLayout->setMinorAxisAlignment(1.0f); RightPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION); /****************************************************** Create MainFrame and Panels ******************************************************/ PanelRefPtr LeftPanel = OSG::Panel::create(); PanelRefPtr RightPanel = OSG::Panel::create(); // LeftPanel stuff LeftPanel->setPreferredSize(Vec2f(400, 500)); LeftPanel->pushToChildren(LeftPanelLabel1); LeftPanel->pushToChildren(createLeftPanelButtonPanel()); LeftPanel->pushToChildren(createLeftPanelRadioTextPanel()); LeftPanel->setLayout(LeftPanelLayout); LeftPanel->setBackgrounds(GreyBackground); LeftPanel->setBorders(Panel1Border); //RightPanel stuff RightPanel->setPreferredSize(Vec2f(200, 620)); RightPanel->pushToChildren(createRightPanelButtonPanel()); RightPanel->pushToChildren(createRightPanelCheckPanel()); RightPanel->setLayout(RightPanelLayout); RightPanel->setBackgrounds(GreyBackground); RightPanel->setBorders(Panel2Border); // Create The Main InternalWindow InternalWindowRefPtr MainInternalWindow = OSG::InternalWindow::create(); MainInternalWindow->pushToChildren(LeftPanel); MainInternalWindow->pushToChildren(RightPanel); MainInternalWindow->setLayout(MainInternalWindowLayout); MainInternalWindow->setBackgrounds(GreyBackground); MainInternalWindow->setBorders(PanelBorder); 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); // Make A 3D Rectangle to draw the UI on UIRectangleRefPtr UIRectCore = UIRectangle::create(); UIRectCore->setPoint(Pnt3f(-310.0,-310.0,370.0)); UIRectCore->setWidth(620); UIRectCore->setHeight(620); UIRectCore->setDrawingSurface(TutorialDrawingSurface); NodeRefPtr UIRectNode = OSG::Node::create(); UIRectNode->setCore(UIRectCore); // add the UIRect as a child scene->addChild(UIRectNode); mgr->setRoot(scene); // 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, "21ExampleInterface"); //Enter main Loop TutorialWindow->mainLoop(); osgExit(); return 0; }