本文整理汇总了C++中PanelRecPtr::setForegrounds方法的典型用法代码示例。如果您正苦于以下问题:C++ PanelRecPtr::setForegrounds方法的具体用法?C++ PanelRecPtr::setForegrounds怎么用?C++ PanelRecPtr::setForegrounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PanelRecPtr
的用法示例。
在下文中一共展示了PanelRecPtr::setForegrounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFCToolTip
//.........这里部分代码省略.........
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,
//SpringLayoutConstraints::SOUTH_EDGE, InheritanceLabel);
//MainLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, InheritancePanel, 0,
//SpringLayoutConstraints::EAST_EDGE, ToolTipPanel);
//MainLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, InheritancePanel, 0,
//SpringLayoutConstraints::WEST_EDGE, ToolTipPanel);
//DescriptionTextArea
MainLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, DescriptionLabel, 1,
SpringLayoutConstraints::SOUTH_EDGE, MainSeparator);
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());
ToolTipPanel->setLayout(MainLayout);
ToolTipPanel->pushToChildren(TypeLabel);
ToolTipPanel->pushToChildren(MainSeparator);
//ToolTipPanel->pushToChildren(InheritanceLabel);
//ToolTipPanel->pushToChildren(InheritancePanel);
ToolTipPanel->pushToChildren(DescriptionLabel);
ToolTipPanel->pushToChildren(DescriptionPanel);
Real32 Height(100.0f + DescriptionTextArea->getLineHeight()
* (DescriptionTextArea->getText().size()/40));
ToolTipPanel->setPreferredSize(Vec2f(300.0f,Height));
return ComponentTransitPtr(ToolTipPanel);
}
示例2: 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());
//.........这里部分代码省略.........