ComponentRefPtr createRightPanelCheckPanel(void)
{
    // Create and edit the CheckBoxes
    CheckboxButtonRefPtr RightPanelCheck1 = OSG::CheckboxButton::create();
    CheckboxButtonRefPtr RightPanelCheck2 = OSG::CheckboxButton::create();
    CheckboxButtonRefPtr RightPanelCheck3 = OSG::CheckboxButton::create();
    CheckboxButtonRefPtr RightPanelCheck4 = OSG::CheckboxButton::create();
	//NOTE HorizontalAlignment needs to be changed to Alignment only with Vec2f arg
        RightPanelCheck1->setText("Show Torus");
        RightPanelCheck1->setPreferredSize(Vec2f(125,50));
        RightPanelCheck1->setAlignment(0.0);
        // Add Listener
        RightPanelCheck1->addButtonSelectedListener(&RightPanelCheck1Listener);
    
        RightPanelCheck2->setText("Show Box");
        RightPanelCheck2->setPreferredSize(Vec2f(125,50));
        RightPanelCheck2->setAlignment(Vec2f (0.5,0.0));
        // Add Listener
        RightPanelCheck2->addButtonSelectedListener(&RightPanelCheck2Listener);

        RightPanelCheck3->setText("Show Sphere");
        RightPanelCheck3->setPreferredSize(Vec2f(125,50));
        RightPanelCheck3->setAlignment(Vec2f(0.0,0.0));
        // Add Listener
        RightPanelCheck3->addButtonSelectedListener(&RightPanelCheck3Listener);

        RightPanelCheck4->setText("Show Cone");
        RightPanelCheck4->setPreferredSize(Vec2f(125,50));
        RightPanelCheck4->setAlignment(Vec2f(0.0,0.0));
        // Add Listener
        RightPanelCheck4->addButtonSelectedListener(&RightPanelCheck4Listener);

    // Create an edit Panel Background
    ColorLayerRefPtr RightPanelCheckPanelBackground = OSG::ColorLayer::create();
        RightPanelCheckPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));

    // Create and edit Panel layout
    BoxLayoutRefPtr RightPanelCheckPanelLayout = OSG::BoxLayout::create();
        RightPanelCheckPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
        RightPanelCheckPanelLayout->setMinorAxisAlignment(0.5f);

    // Create Panel Border
    LineBorderRefPtr PanelBorder3 = OSG::LineBorder::create();
        PanelBorder3->setColor(Color4f(0.0,0.0,0.0,1.0));
        PanelBorder3->setWidth(1);

    // Create and edit Panel
    PanelRefPtr RightPanelCheckPanel = OSG::Panel::create();
        RightPanelCheckPanel->setPreferredSize(Vec2f(200, 300));
        RightPanelCheckPanel->pushToChildren(RightPanelCheck1);
        RightPanelCheckPanel->pushToChildren(RightPanelCheck2);
        RightPanelCheckPanel->pushToChildren(RightPanelCheck3);
        RightPanelCheckPanel->pushToChildren(RightPanelCheck4);
        RightPanelCheckPanel->setLayout(RightPanelCheckPanelLayout);
        RightPanelCheckPanel->setBackgrounds(RightPanelCheckPanelBackground);
        RightPanelCheckPanel->setBorders(PanelBorder3);

    return RightPanelCheckPanel;
}
ComponentRefPtr createRightPanelButtonPanel(void)
{
    // Create and edit the Panel Buttons
    ToggleButtonRefPtr RightPanelButton1 = OSG::ToggleButton::create();
    ToggleButtonRefPtr RightPanelButton2 = OSG::ToggleButton::create();
    ToggleButtonRefPtr RightPanelButton3 = OSG::ToggleButton::create();
    ToggleButtonRefPtr RightPanelButton4 = OSG::ToggleButton::create();

        RightPanelButton1->setText("These");
        RightPanelButton1->setPreferredSize(Vec2f(100,50));
    
        RightPanelButton2->setText("are");
        RightPanelButton2->setPreferredSize(Vec2f(100,50));

        RightPanelButton3->setText("toggle");
        RightPanelButton3->setPreferredSize(Vec2f(100,50));

        RightPanelButton4->setText("buttons");
        RightPanelButton4->setPreferredSize(Vec2f(100,50));


    // Create an edit Panel Background
    ColorLayerRefPtr RightPanelButtonPanelBackground = OSG::ColorLayer::create();
        RightPanelButtonPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));

    // Create and edit Panel layout
    BoxLayoutRefPtr RightPanelButtonPanelLayout = OSG::BoxLayout::create();
        RightPanelButtonPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);

    // Create Panel Border
    LineBorderRefPtr PanelBorder2 = OSG::LineBorder::create();
        PanelBorder2->setColor(Color4f(0.0,0.0,0.0,1.0));
        PanelBorder2->setWidth(1);

    // Create and edit Panel
    PanelRefPtr RightPanelButtonPanel = OSG::Panel::create();
        RightPanelButtonPanel->setPreferredSize(Vec2f(200, 300));
        RightPanelButtonPanel->pushToChildren(RightPanelButton1);
        RightPanelButtonPanel->pushToChildren(RightPanelButton2);
        RightPanelButtonPanel->pushToChildren(RightPanelButton3);
        RightPanelButtonPanel->pushToChildren(RightPanelButton4);
        RightPanelButtonPanel->setLayout(RightPanelButtonPanelLayout);
        RightPanelButtonPanel->setBackgrounds(RightPanelButtonPanelBackground);
        RightPanelButtonPanel->setBorders(PanelBorder2);

    return RightPanelButtonPanel;

}
void LuaDebuggerInterface::createCodeEditor(void)
{
    //Create the Breakpoint images
    BoostPath BreakpointIconPath(_BaseIconDir / BoostPath("breakpoint.png")),
              BreakpointDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-disabled.png")),
              BreakpointConditionalIconPath(_BaseIconDir / BoostPath("breakpoint-conditional.png")),
              BreakpointConditionalDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-conditional-disabled.png")),
              BreakpointCountIconPath(_BaseIconDir / BoostPath("breakpoint-count.png")),
              BreakpointCountDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-count-disabled.png"));
    
    //Breakpoint Button prototypes
    //Regular Breakpoint
    ButtonRecPtr BreakpointProtoButton = Button::create();
    BreakpointProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
    BreakpointProtoButton->setImages(BreakpointIconPath.string());
    BreakpointProtoButton->setDisabledImage(BreakpointDisabledIconPath.string());
    BreakpointProtoButton->setBorders(NULL);
    BreakpointProtoButton->setBackgrounds(NULL);
    BreakpointProtoButton->setForegrounds(NULL);

    //Count Breakpoint
    ButtonRecPtr BreakpointCountProtoButton = Button::create();
    BreakpointCountProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
    BreakpointCountProtoButton->setImages(BreakpointCountIconPath.string());
    BreakpointCountProtoButton->setDisabledImage(BreakpointCountDisabledIconPath.string());
    BreakpointCountProtoButton->setBorders(NULL);
    BreakpointCountProtoButton->setBackgrounds(NULL);
    BreakpointCountProtoButton->setForegrounds(NULL);

    //Conditional breakpoint
    ButtonRecPtr BreakpointConditionalProtoButton = Button::create();
    BreakpointConditionalProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f));
    BreakpointConditionalProtoButton->setImages(BreakpointConditionalIconPath.string());
    BreakpointConditionalProtoButton->setDisabledImage(BreakpointConditionalDisabledIconPath.string());
    BreakpointConditionalProtoButton->setBorders(NULL);
    BreakpointConditionalProtoButton->setBackgrounds(NULL);
    BreakpointConditionalProtoButton->setForegrounds(NULL);

    //Create the default font
    _CodeFont = UIFont::create();
    _CodeFont->setFamily("Courier New");
    _CodeFont->setSize(21);
    _CodeFont->setGlyphPixelSize(22);
    _CodeFont->setAntiAliasing(false);

    // Create a TextArea component
    _CodeTextArea = TextEditor::create();
    _CodeTextArea->setIsSplit(false);
    _CodeTextArea->setClipboardVisible(false);
    //_CodeTextArea->getTextDomArea()->setFont(_CodeFont);
    //_CodeTextArea->setGutterWidth(50.0f);
    _CodeTextArea->setText(createDefaultCodeText());

    //_CodeTextArea->connectCaretChanged(boost::bind(&LuaDebuggerInterface::codeAreaCaretChanged,this, _1));
    //_CodeTextArea->connectMouseClicked(boost::bind(&LuaDebuggerInterface::handleCodeAreaMouseClicked,this, _1));

    _MainSplitPanel = SplitPanel::create();
    _MainSplitPanel->setMinComponent(_CodeTextArea);
    _MainSplitPanel->setMaxComponent(_InfoTabPanel);
    _MainSplitPanel->setOrientation(SplitPanel::VERTICAL_ORIENTATION);
    _MainSplitPanel->setDividerPosition(0.7);
    // location from the left/top
    _MainSplitPanel->setDividerSize(4);
    _MainSplitPanel->setMaxDividerPosition(.8);
    _MainSplitPanel->setMinDividerPosition(.2);

    //Code Area Info
    LabelRefPtr LineLabel = Label::create();
    LineLabel->setText("Line:");
    LineLabel->setPreferredSize(Vec2f(40.0f, 30.0f));
    LineLabel->setAlignment(Vec2f(1.0f, 0.5f));

    _LineValueLabel = Label::create();
    _LineValueLabel->setText("");
    _LineValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f));

    LabelRefPtr ColumnLabel = Label::create();
    ColumnLabel->setText("Column:");
    ColumnLabel->setPreferredSize(Vec2f(55.0f, 30.0f));
    ColumnLabel->setAlignment(Vec2f(1.0f, 0.5f));

    _ColumnValueLabel = Label::create();
    _ColumnValueLabel->setText("");
    _ColumnValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f));
    //TextArea Info Panel

    _CodeAreaInfoPanel = Panel::create();

    SpringLayoutRefPtr CodeAreaInfoLayout = SpringLayout::create();

    //ColumnValueLabel
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::EAST_EDGE, _CodeAreaInfoPanel);

    //ColumnLabel    
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ColumnLabel, -1, SpringLayoutConstraints::WEST_EDGE, _ColumnValueLabel);

    //LineValueLabel    
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _LineValueLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _LineValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _LineValueLabel, -1, SpringLayoutConstraints::WEST_EDGE, ColumnLabel);

    //LineLabel    
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, LineLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, LineLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel);
    CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, LineLabel, -1, SpringLayoutConstraints::WEST_EDGE, _LineValueLabel);

    _CodeAreaInfoPanel->setPreferredSize(Vec2f(400.0f, 22.0f));
    _CodeAreaInfoPanel->pushToChildren(LineLabel);
    _CodeAreaInfoPanel->pushToChildren(_LineValueLabel);
    _CodeAreaInfoPanel->pushToChildren(ColumnLabel);
    _CodeAreaInfoPanel->pushToChildren(_ColumnValueLabel);
    _CodeAreaInfoPanel->setBorders(NULL);
    _CodeAreaInfoPanel->setLayout(CodeAreaInfoLayout);
}
ComponentTransitPtr ColorChooserComboBoxComponentGenerator::getComboBoxComponent(ComboBox* const Parent, const boost::any& Value, UInt32 Index, bool IsSelected, bool HasFocus)
{
	if(Value.empty()){
		return ComponentTransitPtr(NULL);
	}

	PanelRefPtr TheComponent = Panel::create();//dynamic_pointer_cast<Component>(getDrawObjectPrototype()->shallowCopy());
	TheComponent->setLayout(LayoutRefPtr(FlowLayout::create()));

	LabelRefPtr theColorLabel = Label::create();
	//theColorLabel->setPreferredSize(Vec2f(50.0f,50.0f));
	theColorLabel->setBorders(NULL);

	try
	{
		Color4f theColor = boost::any_cast<Color4f>(Value);

		if(theColor != NULL)
		{
			ColorLayerRefPtr theColorLabelBackground = ColorLayer::create();
			theColorLabelBackground->setColor(theColor);
			theColorLabel->setBackgrounds(theColorLabelBackground);
		}
	}
	catch(boost::bad_any_cast &)
	{
		std::string ValueString;

		try
		{
			ValueString = lexical_cast(Value);
		}
		catch (boost::bad_lexical_cast &)
		{
			//Could not convert to string
			SWARNING << "ColorChooserComboBoxComponentGenerator::getComboBoxComponent - The elements should either be a Color4f value or a std::string\n";
		}

		theColorLabel->setText(ValueString);

		if(IsSelected && HasFocus)
		{
			if(getFocusedTextColorHasPriority())
			{
				theColorLabel->setTextColors(getFocusedTextColor());
			}
			else
			{
				theColorLabel->setTextColors(getSelectedTextColor());
			}
		}
		else if(IsSelected)
		{
				theColorLabel->setTextColors(getSelectedTextColor());
		}
		else if(HasFocus)
		{
				theColorLabel->setTextColors(getFocusedTextColor());
		}
	}

	TheComponent->pushToChildren(theColorLabel);
    
	if(IsSelected && HasFocus)
	{
			if(getFocusedBorderHasPriority())
			{
				TheComponent->setBorders(getFocusedBorder());
			}
			else
			{
				TheComponent->setBorders(getSelectedBorder());
			}
			if(getFocusedBackgroundHasPriority())
			{
				TheComponent->setBackgrounds(getFocusedBackground());
			    TheComponent->setForegrounds(getFocusedForeground());
			}
			else
			{
				TheComponent->setBackgrounds(getSelectedBackground());
			    TheComponent->setForegrounds(getSelectedForeground());
			}
	}
	else if(IsSelected)
	{
			TheComponent->setBorders(getSelectedBorder());
			TheComponent->setBackgrounds(getSelectedBackground());
			TheComponent->setForegrounds(getSelectedForeground());
	}
	else if(HasFocus)
	{
			TheComponent->setBorders(getFocusedBorder());
			TheComponent->setBackgrounds(getFocusedBackground());
			TheComponent->setForegrounds(getFocusedForeground());
	}
	return ComponentTransitPtr(TheComponent.get());
}
ComponentRefPtr createLeftPanelRadioTextPanel(void)
{

    // Create the RadioButton group
    RadioButtonRefPtr RadioButton1 = OSG::RadioButton::create();
    RadioButtonRefPtr RadioButton2 = OSG::RadioButton::create();
    RadioButtonRefPtr RadioButton3 = OSG::RadioButton::create();
    RadioButtonRefPtr RadioButton4 = OSG::RadioButton::create();

        RadioButton1->setAlignment(Vec2f(0.0,0.5));
        RadioButton1->setPreferredSize(Vec2f(100, 40));
        RadioButton1->setText("Black Text");
        RadioButton1->setToolTipText("Set TextArea text black");
    RadioButton1->addButtonSelectedListener(&RadioButton1Listener);

        RadioButton2->setAlignment(Vec2f(0.0,0.5));
        RadioButton2->setPreferredSize(Vec2f(100, 40));
        RadioButton2->setText("Red Text");
        RadioButton2->setToolTipText("Set TextArea text red");
    RadioButton2->addButtonSelectedListener(&RadioButton2Listener);

        RadioButton3->setAlignment(Vec2f(0.0,0.5));
        RadioButton3->setPreferredSize(Vec2f(100, 40));
        RadioButton3->setText("Green Text");
        RadioButton3->setToolTipText("Set TextArea text green");
    RadioButton3->addButtonSelectedListener(&RadioButton3Listener);

        RadioButton4->setAlignment(Vec2f(0.0,0.5));
        RadioButton4->setPreferredSize(Vec2f(100, 40));
        RadioButton4->setText("Blue Text");
        RadioButton4->setToolTipText("Set TextArea text blue");
    RadioButton4->addButtonSelectedListener(&RadioButton4Listener);

    buttonGroup = RadioButtonGroup::create();
    buttonGroup->addButton(RadioButton1);
    buttonGroup->addButton(RadioButton2);
    buttonGroup->addButton(RadioButton3);
    buttonGroup->addButton(RadioButton4);


    // Create TextArea
    LeftPanelTextArea = OSG::TextArea::create();
        LeftPanelTextArea->setPreferredSize(Vec2f(125, 200));

    // Create Panel and its Background/Border to label TextField
    LabelRefPtr LeftPanelTextFieldLabel = OSG::Label::create();
    EmptyLayerRefPtr LeftPanelTextFieldLabelBackground = OSG::EmptyLayer::create();
    EmptyBorderRefPtr LeftPanelTextFieldLabelBorder = OSG::EmptyBorder::create();
        LeftPanelTextFieldLabel->setPreferredSize(Vec2f(100, 25));
        LeftPanelTextFieldLabel->setBorders(LeftPanelTextFieldLabelBorder);
        LeftPanelTextFieldLabel->setBackgrounds(LeftPanelTextFieldLabelBackground);
        LeftPanelTextFieldLabel->setText("Text Field");

    // Create TextField
    TextFieldRefPtr LeftPanelTextField = OSG::TextField::create();
        LeftPanelTextField->setPreferredSize(Vec2f(125.0f, 22.0f));

    
    // Create an edit Panel Background
    ColorLayerRefPtr LeftPanelRadioTextPanelBackground = OSG::ColorLayer::create();
        LeftPanelRadioTextPanelBackground->setColor(Color4f(0.93f,0.93f,0.93f,1.0f));

    // Create and edit Panel layouts
    FlowLayoutRefPtr LeftPanelRadioTextPanelLayout = OSG::FlowLayout::create();
    FlowLayoutRefPtr LeftPanelRadioTextPanelRadioPanelLayout = OSG::FlowLayout::create();
    FlowLayoutRefPtr LeftPanelRadioTextPanelTextPanelLayout = OSG::FlowLayout::create();
        LeftPanelRadioTextPanelLayout->setMinorAxisAlignment(0.0f);

    // Create two Panels for this Panel
    PanelRefPtr LeftPanelRadioTextPanelRadioPanel = OSG::Panel::create();
    PanelRefPtr LeftPanelRadioTextPanelTextPanel = OSG::Panel::create();

    // Create some Borders
    EmptyBorderRefPtr LeftPanelRadioTextPanelRadioPanelBorder = OSG::EmptyBorder::create();

        LeftPanelRadioTextPanelRadioPanel->setBorders(LeftPanelRadioTextPanelRadioPanelBorder);
        LeftPanelRadioTextPanelRadioPanel->setPreferredSize(Vec2f(125, 200));
        LeftPanelRadioTextPanelRadioPanel->setLayout(LeftPanelRadioTextPanelRadioPanelLayout);
        LeftPanelRadioTextPanelRadioPanel->setBackgrounds(LeftPanelRadioTextPanelBackground);
        LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton1);
        LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton2);
        LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton3);
        LeftPanelRadioTextPanelRadioPanel->pushToChildren(RadioButton4);

    // Create Panel Border
    LineBorderRefPtr PanelBorder1 = OSG::LineBorder::create();
        PanelBorder1->setColor(Color4f(0.0,0.0,0.0,1.0));
        PanelBorder1->setWidth(1);

    // Create and edit Panel
    PanelRefPtr LeftPanelRadioTextPanel = OSG::Panel::create();
        LeftPanelRadioTextPanel->setPreferredSize(Vec2f(180, 500));
        LeftPanelRadioTextPanel->pushToChildren(LeftPanelRadioTextPanelRadioPanel);
        LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextArea);
        LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextFieldLabel);
        LeftPanelRadioTextPanel->pushToChildren(LeftPanelTextField);
        LeftPanelRadioTextPanel->setLayout(LeftPanelRadioTextPanelLayout);
        LeftPanelRadioTextPanel->setBackgrounds(LeftPanelRadioTextPanelBackground);
        LeftPanelRadioTextPanel->setBorders(PanelBorder1);

    return LeftPanelRadioTextPanel;
}
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;
}