当前位置: 首页>>代码示例>>C++>>正文


C++ LabelPtr::setBackgrounds方法代码示例

本文整理汇总了C++中LabelPtr::setBackgrounds方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelPtr::setBackgrounds方法的具体用法?C++ LabelPtr::setBackgrounds怎么用?C++ LabelPtr::setBackgrounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LabelPtr的用法示例。


在下文中一共展示了LabelPtr::setBackgrounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createEditorTab

PanelPtr SceneEditor::createEditorTab(SceneComponentEditorPtr Editor, IconManagerPtr TheIconManager) const
{
	//Editor Icon
	ImageComponentPtr EditorIcon = TheIconManager->createIconImageComponent(Editor->getPresentationIconName());
    if(EditorIcon == NullFC)
    {
        EditorIcon = ImageComponent::create();
    }

	beginEditCP(EditorIcon, ImageComponent::ScaleFieldMask | ImageComponent::AlignmentFieldMask);
		EditorIcon->setAlignment(Vec2f(0.5f,0.5f));
		EditorIcon->setScale(ImageComponent::SCALE_MIN_AXIS);
	endEditCP(EditorIcon, ImageComponent::ScaleFieldMask | ImageComponent::AlignmentFieldMask);
	
	//Editor Label
	LabelPtr TabLabel = Label::create();
	beginEditCP(TabLabel, Label::TextFieldMask | Label::BordersFieldMask | Label::BackgroundsFieldMask | Label::AlignmentFieldMask);
		TabLabel->setBorders(NullFC);
		TabLabel->setBackgrounds(NullFC);
		TabLabel->setText(Editor->getPresentationName());
		TabLabel->setAlignment(Vec2f(0.5f,0.5f));
	endEditCP(TabLabel, Label::TextFieldMask | Label::BordersFieldMask | Label::BackgroundsFieldMask | Label::AlignmentFieldMask);

	//Tab
	PanelPtr Tab = Panel::createEmpty();

	//Layout
	SpringLayoutPtr TabLayout = SpringLayout::create();

	//Editor Icon
    TabLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, EditorIcon, 0, SpringLayoutConstraints::WEST_EDGE, Tab);
    TabLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, EditorIcon, 0, SpringLayoutConstraints::EAST_EDGE, Tab);
	TabLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, EditorIcon, 0, SpringLayoutConstraints::NORTH_EDGE, Tab);
	TabLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, EditorIcon, -1, SpringLayoutConstraints::NORTH_EDGE, TabLabel);
	
	//Editor Label
    TabLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TabLabel, 0, SpringLayoutConstraints::WEST_EDGE, Tab);
    TabLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TabLabel, 0, SpringLayoutConstraints::EAST_EDGE, Tab);
	TabLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, TabLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, Tab);
	TabLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, TabLabel, LayoutSpring::height(TabLabel));
    
    //Tab Layout
    //TabLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, Tab, LayoutSpring::max(TabLayout->getConstraint(SpringLayoutConstraints::WIDTH_EDGE,TabLabel),TabLayout->getConstraint(SpringLayoutConstraints::WIDTH_EDGE,EditorIcon)));
    //TabLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, Tab, LayoutSpring::sum(TabLayout->getConstraint(SpringLayoutConstraints::HEIGHT_EDGE,TabLabel),TabLayout->getConstraint(SpringLayoutConstraints::HEIGHT_EDGE,EditorIcon)));
    TabLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, Tab, LayoutSpring::width(Tab));
    TabLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, Tab, LayoutSpring::height(Tab));

	beginEditCP(Tab, Panel::ChildrenFieldMask | Panel::LayoutFieldMask | Panel::PreferredSizeFieldMask);
		Tab->getChildren().push_back(EditorIcon);
		Tab->getChildren().push_back(TabLabel);
		Tab->setLayout(TabLayout);
		Tab->setPreferredSize(Vec2f(70.0f,50.0f));
	endEditCP(Tab, Panel::ChildrenFieldMask | Panel::LayoutFieldMask | Panel::PreferredSizeFieldMask);

	return Tab;
}
开发者ID:Langkamp,项目名称:KabalaEngine,代码行数:56,代码来源:KESceneEditor.cpp


注:本文中的LabelPtr::setBackgrounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。