本文整理汇总了C++中PanelRecPtr::setBackgrounds方法的典型用法代码示例。如果您正苦于以下问题:C++ PanelRecPtr::setBackgrounds方法的具体用法?C++ PanelRecPtr::setBackgrounds怎么用?C++ PanelRecPtr::setBackgrounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PanelRecPtr
的用法示例。
在下文中一共展示了PanelRecPtr::setBackgrounds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createRightPanelButtonPanel
PanelTransitPtr createRightPanelButtonPanel(void)
{
// Create and edit the Panel Buttons
ToggleButtonRecPtr RightPanelButton1 = ToggleButton::create();
ToggleButtonRecPtr RightPanelButton2 = ToggleButton::create();
ToggleButtonRecPtr RightPanelButton3 = ToggleButton::create();
ToggleButtonRecPtr RightPanelButton4 = 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
ColorLayerRecPtr RightPanelButtonPanelBackground = ColorLayer::create();
RightPanelButtonPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));
// Create and edit Panel layout
BoxLayoutRecPtr RightPanelButtonPanelLayout = BoxLayout::create();
RightPanelButtonPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
// Create Panel Border
LineBorderRecPtr PanelBorder2 = LineBorder::create();
PanelBorder2->setColor(Color4f(0.0,0.0,0.0,1.0));
PanelBorder2->setWidth(1);
// Create and edit Panel
PanelRecPtr RightPanelButtonPanel = Panel::createEmpty();
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 PanelTransitPtr(RightPanelButtonPanel);
}
示例2: createFCToolTip
ComponentTransitPtr GenericFieldContainerEditor::createFCToolTip(const FieldContainerType &FCType)
{
std::string FieldDoc(doxygenToPlainFormatting(FCType.getDocumentation()));
//TypeName
LabelRecPtr TypeLabel = Label::create();
TypeLabel->setText(FCType.getName());
TypeLabel->setAlignment(Vec2f(0.5f,0.5f));
TypeLabel->setBackgrounds(NULL);
//Separator
SeparatorRecPtr MainSeparator = Separator::create();
MainSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION);
MainSeparator->setSeparatorSize(1.0f);
MainSeparator->setPreferredSize(Vec2f(1.0f,5.0f));
MainSeparator->setBackgrounds(NULL);
//Inheritance Panel Layout
//LabelRecPtr InheritanceLabel = Label::create();
//InheritanceLabel->setText("Inheritance");
//FlowLayoutRecPtr InheritancePanelLayout = FlowLayout::create();
//InheritancePanelLayout->setOrientation(FlowLayout::VERTICAL_ORIENTATION);
//InheritancePanelLayout->setVerticalGap(3.0f);
//InheritancePanelLayout->setMajorAxisAlignment(0.0f);
//InheritancePanelLayout->setMinorAxisAlignment(0.5f);
//InheritancePanelLayout->setComponentAlignment(0.5f);
////Inheritance Panel
//PanelRecPtr InheritancePanel = Panel::createEmpty();
//InheritancePanel->setAllInsets(5.0f);
//InheritancePanel->setLayout(InheritancePanelLayout);
//const TypeBase *ParentType(&FCType);
////while()
////{
////ToolTipPanel->pushToChildren(DescriptionTextArea);
////}
//LabelRecPtr TypeNameLabel = Label::create();
//TypeNameLabel->setText(FCType.getName());
//TypeNameLabel->setAlignment(Vec2f(0.5f,0.5f));
//InheritancePanel->pushToChildren(TypeNameLabel);
//Set the layout constraints
BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create();
CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER);
//Description Panel
LabelRecPtr DescriptionLabel = Label::create();
DescriptionLabel->setText("Description:");
DescriptionLabel->setBackgrounds(NULL);
TextAreaRecPtr DescriptionTextArea = TextArea::create();
DescriptionTextArea->setText(FieldDoc);
DescriptionTextArea->setEditable(false);
DescriptionTextArea->setBorders(NULL);
DescriptionTextArea->setBackgrounds(NULL);
DescriptionTextArea->setConstraints(CenterConstraints);
//Description Panel
PanelRecPtr DescriptionPanel = Panel::create();
BorderLayoutRecPtr DescriptionPanelLayout = BorderLayout::create();
DescriptionPanel->setAllInsets(5.0f);
DescriptionPanel->setLayout(DescriptionPanelLayout);
DescriptionPanel->pushToChildren(DescriptionTextArea);
DescriptionPanel->setBackgrounds(NULL);
//ToolTip Layout
PanelRecPtr ToolTipPanel = Panel::createEmpty();
SpringLayoutRecPtr MainLayout = SpringLayout::create();
//TypeLabel
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TypeLabel, 5,
SpringLayoutConstraints::NORTH_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TypeLabel, -5,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TypeLabel, 5,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//MainSeparator
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MainSeparator, 1,
SpringLayoutConstraints::SOUTH_EDGE, TypeLabel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MainSeparator, -15,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MainSeparator, 15,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
////InheritancePanel
//MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritanceLabel, 1,
//SpringLayoutConstraints::SOUTH_EDGE, MainSeparator);
//MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritanceLabel, 0,
//SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
//MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritanceLabel, 0,
//SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
////InheritancePanel
//MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, InheritancePanel, 1,
//.........这里部分代码省略.........
示例3: createEventToolTip
ComponentTransitPtr GenericFieldContainerEditor::createEventToolTip(const EventDescription *EventDesc)
{
std::string FieldDoc(doxygenToPlainFormatting(EventDesc->getDescription()));
//TypeName
LabelRecPtr TypeLabel = Label::create();
TypeLabel->setText(EventDesc->getName());
TypeLabel->setAlignment(Vec2f(0.5f,0.5f));
TypeLabel->setBackgrounds(NULL);
//Separator
SeparatorRecPtr MainSeparator = Separator::create();
MainSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION);
MainSeparator->setSeparatorSize(1.0f);
MainSeparator->setPreferredSize(Vec2f(1.0f,5.0f));
MainSeparator->setBackgrounds(NULL);
//Consumable Label
LabelRecPtr ConsumableLabel = Label::create();
ConsumableLabel->setText(EventDesc->getConsumable() ? "Consumable" : "Not Consumable");
ConsumableLabel->setAlignment(Vec2f(0.0f,0.5f));
ConsumableLabel->setBackgrounds(NULL);
//Set the layout constraints
BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create();
CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER);
//Description Panel
LabelRecPtr DescriptionLabel = Label::create();
DescriptionLabel->setText("Description:");
DescriptionLabel->setBackgrounds(NULL);
TextAreaRecPtr DescriptionTextArea = TextArea::create();
DescriptionTextArea->setText(FieldDoc);
DescriptionTextArea->setEditable(false);
DescriptionTextArea->setBorders(NULL);
DescriptionTextArea->setBackgrounds(NULL);
DescriptionTextArea->setConstraints(CenterConstraints);
//Description Panel
PanelRecPtr DescriptionPanel = Panel::create();
BorderLayoutRecPtr DescriptionPanelLayout = BorderLayout::create();
DescriptionPanel->setAllInsets(5.0f);
DescriptionPanel->setLayout(DescriptionPanelLayout);
DescriptionPanel->pushToChildren(DescriptionTextArea);
DescriptionPanel->setBackgrounds(NULL);
//ToolTip Layout
PanelRecPtr ToolTipPanel = Panel::createEmpty();
SpringLayoutRecPtr MainLayout = SpringLayout::create();
//TypeLabel
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TypeLabel, 5,
SpringLayoutConstraints::NORTH_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TypeLabel, -5,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TypeLabel, 5,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//MainSeparator
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MainSeparator, 1,
SpringLayoutConstraints::SOUTH_EDGE, TypeLabel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MainSeparator, -15,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MainSeparator, 15,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//ConsumableLabel
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ConsumableLabel, 1,
SpringLayoutConstraints::NORTH_EDGE, MainSeparator);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ConsumableLabel, -5,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, ConsumableLabel, 5,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//DescriptionTextArea
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionLabel, 5,
SpringLayoutConstraints::SOUTH_EDGE, ConsumableLabel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionLabel, -5,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionLabel, 5,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//DescriptionTextArea
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionPanel, 1,
SpringLayoutConstraints::SOUTH_EDGE, DescriptionLabel);
MainLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, DescriptionPanel, -5,
SpringLayoutConstraints::SOUTH_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, DescriptionPanel, -5,
SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, DescriptionPanel, 5,
SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//ToolTip Panel
Component* DefaultToolTip(LookAndFeelManager::the()->getLookAndFeel()->getDefaultToolTip());
ToolTipPanel->setBorders(DefaultToolTip->getBorder());
ToolTipPanel->setBackgrounds(DefaultToolTip->getBackground());
ToolTipPanel->setForegrounds(DefaultToolTip->getForeground());
//.........这里部分代码省略.........
示例4: createRightPanelCheckPanel
PanelTransitPtr createRightPanelCheckPanel(Node* const TorusNode,
Node* const SphereNode,
Node* const ConeNode,
Node* const BoxNode)
{
// Create and edit the CheckBoxes
CheckboxButtonRecPtr RightPanelCheck1 = CheckboxButton::create();
CheckboxButtonRecPtr RightPanelCheck2 = CheckboxButton::create();
CheckboxButtonRecPtr RightPanelCheck3 = CheckboxButton::create();
CheckboxButtonRecPtr RightPanelCheck4 = 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);
RightPanelCheck1->connectButtonSelected(boost::bind(setNodeTravMask,
TorusNode,
1));
RightPanelCheck1->connectButtonDeselected(boost::bind(setNodeTravMask,
TorusNode,
0));
RightPanelCheck2->setText("Show Box");
RightPanelCheck2->setPreferredSize(Vec2f(125,50));
RightPanelCheck2->setAlignment(Vec2f (0.5,0.0));
RightPanelCheck2->connectButtonSelected(boost::bind(setNodeTravMask, BoxNode, 1));
RightPanelCheck2->connectButtonDeselected(boost::bind(setNodeTravMask, BoxNode, 0));
RightPanelCheck3->setText("Show Sphere");
RightPanelCheck3->setPreferredSize(Vec2f(125,50));
RightPanelCheck3->setAlignment(Vec2f(0.0,0.0));
RightPanelCheck3->connectButtonSelected(boost::bind(setNodeTravMask, SphereNode, 1));
RightPanelCheck3->connectButtonDeselected(boost::bind(setNodeTravMask, SphereNode, 0));
RightPanelCheck4->setText("Show Cone");
RightPanelCheck4->setPreferredSize(Vec2f(125,50));
RightPanelCheck4->setAlignment(Vec2f(0.0,0.0));
RightPanelCheck4->connectButtonSelected(boost::bind(setNodeTravMask, ConeNode, 1));
RightPanelCheck4->connectButtonDeselected(boost::bind(setNodeTravMask, ConeNode, 0));
// Create an edit Panel Background
ColorLayerRecPtr RightPanelCheckPanelBackground = ColorLayer::create();
RightPanelCheckPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));
// Create and edit Panel layout
BoxLayoutRecPtr RightPanelCheckPanelLayout = BoxLayout::create();
RightPanelCheckPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
RightPanelCheckPanelLayout->setMinorAxisAlignment(0.5f);
// Create Panel Border
LineBorderRecPtr PanelBorder3 = LineBorder::create();
PanelBorder3->setColor(Color4f(0.0,0.0,0.0,1.0));
PanelBorder3->setWidth(1);
// Create and edit Panel
PanelRecPtr RightPanelCheckPanel = Panel::createEmpty();
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 PanelTransitPtr(RightPanelCheckPanel);
}
示例5: createLeftPanelRadioTextPanel
PanelTransitPtr createLeftPanelRadioTextPanel(void)
{
// Create TextArea
TextAreaRecPtr LeftPanelTextArea = TextArea::create();
LeftPanelTextArea->setPreferredSize(Vec2f(125, 200));
LeftPanelTextArea->setText("Text Area");
// Create the RadioButton group
RadioButtonRecPtr RadioButton1 = RadioButton::create();
RadioButtonRecPtr RadioButton2 = RadioButton::create();
RadioButtonRecPtr RadioButton3 = RadioButton::create();
RadioButtonRecPtr RadioButton4 = 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->connectButtonSelected(boost::bind(setTextColors,
LeftPanelTextArea.get(),
Color4f(0.0f,0.0f,0.0f,1.0f)));
RadioButton2->setAlignment(Vec2f(0.0,0.5));
RadioButton2->setPreferredSize(Vec2f(100, 40));
RadioButton2->setText("Red Text");
RadioButton2->setToolTipText("Set TextArea text red");
RadioButton2->connectButtonSelected(boost::bind(setTextColors,
LeftPanelTextArea.get(),
Color4f(1.0f,0.0f,0.0f,1.0f)));
RadioButton3->setAlignment(Vec2f(0.0,0.5));
RadioButton3->setPreferredSize(Vec2f(100, 40));
RadioButton3->setText("Green Text");
RadioButton3->setToolTipText("Set TextArea text green");
RadioButton3->connectButtonSelected(boost::bind(setTextColors,
LeftPanelTextArea.get(),
Color4f(0.0f,1.0f,0.0f,1.0f)));
RadioButton4->setAlignment(Vec2f(0.0,0.5));
RadioButton4->setPreferredSize(Vec2f(100, 40));
RadioButton4->setText("Blue Text");
RadioButton4->setToolTipText("Set TextArea text blue");
RadioButton4->connectButtonSelected(boost::bind(setTextColors,
LeftPanelTextArea.get(),
Color4f(0.0f,0.0f,1.0f,1.0f)));
RadioButtonGroupRecPtr buttonGroup = RadioButtonGroup::create();
buttonGroup->addButton(RadioButton1);
buttonGroup->addButton(RadioButton2);
buttonGroup->addButton(RadioButton3);
buttonGroup->addButton(RadioButton4);
// Create Panel and its Background/Border to label TextField
LabelRecPtr LeftPanelTextFieldLabel = Label::create();
EmptyLayerRecPtr LeftPanelTextFieldLabelBackground = EmptyLayer::create();
EmptyBorderRecPtr LeftPanelTextFieldLabelBorder = EmptyBorder::create();
LeftPanelTextFieldLabel->setPreferredSize(Vec2f(100, 25));
LeftPanelTextFieldLabel->setBorders(LeftPanelTextFieldLabelBorder);
LeftPanelTextFieldLabel->setBackgrounds(LeftPanelTextFieldLabelBackground);
LeftPanelTextFieldLabel->setText("Text Field");
// Create TextField
TextFieldRecPtr LeftPanelTextField = TextField::create();
LeftPanelTextField->setPreferredSize(Vec2f(125.0f, 22.0f));
// Create an edit Panel Background
ColorLayerRecPtr LeftPanelRadioTextPanelBackground = ColorLayer::create();
LeftPanelRadioTextPanelBackground->setColor(Color4f(0.93f,0.93f,0.93f,1.0f));
// Create and edit Panel layouts
FlowLayoutRecPtr LeftPanelRadioTextPanelLayout = FlowLayout::create();
FlowLayoutRecPtr LeftPanelRadioTextPanelRadioPanelLayout = FlowLayout::create();
FlowLayoutRecPtr LeftPanelRadioTextPanelTextPanelLayout = FlowLayout::create();
LeftPanelRadioTextPanelLayout->setMinorAxisAlignment(0.0f);
// Create two Panels for this Panel
PanelRecPtr LeftPanelRadioTextPanelRadioPanel = Panel::createEmpty();
PanelRecPtr LeftPanelRadioTextPanelTextPanel = Panel::createEmpty();
// Create some Borders
EmptyBorderRecPtr LeftPanelRadioTextPanelRadioPanelBorder = 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
LineBorderRecPtr PanelBorder1 = LineBorder::create();
PanelBorder1->setColor(Color4f(0.0,0.0,0.0,1.0));
PanelBorder1->setWidth(1);
// Create and edit Panel
PanelRecPtr LeftPanelRadioTextPanel = Panel::createEmpty();
LeftPanelRadioTextPanel->setPreferredSize(Vec2f(180, 500));
LeftPanelRadioTextPanel->pushToChildren(LeftPanelRadioTextPanelRadioPanel);
//.........这里部分代码省略.........
示例6: createLeftPanelButtonPanel
PanelTransitPtr createLeftPanelButtonPanel(void)
{
// Create Label for this Panel
LabelRecPtr LeftPanelButtonPanelLabel = Label::create();
LeftPanelButtonPanelLabel->setTextColor(Color4f(1.0,1.0,1.0,1.0));
LeftPanelButtonPanelLabel->setRolloverTextColor(Color4f(1.0,1.0,1.0,1.0));
LayerRecPtr ComplexBackground = createComplexBackground();
LeftPanelButtonPanelLabel->setBackground(ComplexBackground);
LeftPanelButtonPanelLabel->setPreferredSize(Vec2f(100, 50));
LeftPanelButtonPanelLabel->setText("Various Options");
LeftPanelButtonPanelLabel->setAlignment(Vec2f(0.5,0.5));
// Create and edit the Panel buttons
ButtonRecPtr LeftPanelButton1 = Button::create();
ButtonRecPtr LeftPanelButton2 = Button::create();
ButtonRecPtr LeftPanelButton3 = Button::create();
ButtonRecPtr LeftPanelButton4 = Button::create();
ButtonRecPtr LeftPanelButton5 = Button::create();
ButtonRecPtr LeftPanelButton6 = 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
BoxLayoutRecPtr LeftPanelButtonPanelLayout = BoxLayout::create();
LeftPanelButtonPanelLayout->setOrientation(BoxLayout::VERTICAL_ORIENTATION);
// Create an edit Panel Background
ColorLayerRecPtr LeftPanelButtonPanelBackground = ColorLayer::create();
LeftPanelButtonPanelBackground->setColor(Color4f(0.93,0.93,0.93,1.0));
// Create Panel Border
LineBorderRecPtr LeftPanelBorder = LineBorder::create();
LeftPanelBorder->setColor(Color4f(0.0,0.0,0.0,1.0));
LeftPanelBorder->setWidth(1);
// Create and edit Panel
PanelRecPtr LeftPanelButtonPanel = Panel::createEmpty();
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 PanelTransitPtr(LeftPanelButtonPanel);
}
示例7: 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
******************************************************/
//.........这里部分代码省略.........