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


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

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


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

示例2: getQuestionComponent

ComponentPtr DefaultDialogComponentGenerator::getQuestionComponent(DialogInterfacePtr Parent, const boost::any& Value)
{
    std::string questionString("");
    try
    {
        questionString = lexical_cast(Value);
    }
    catch (boost::bad_lexical_cast &)
    {
        std::cout<<"Unable to display question"<<std::endl;
    }

    LabelPtr TheQuestionString = Label::Ptr::dcast(getQuestionPrototype()->shallowCopy());
    beginEditCP(TheQuestionString, Label::TextFieldMask);
        TheQuestionString->setText(questionString);
    endEditCP(TheQuestionString, Label::TextFieldMask);

    return TheQuestionString;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:19,代码来源:OSGDefaultDialogComponentGenerator.cpp

示例3: getCaptionComponent

/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/
ComponentPtr DefaultCaptionComponentGenerator::getCaptionComponent(CaptionPtr Parent, const boost::any& Value)
{
    std::string CaptionSegment("");
    try
    {
        CaptionSegment = lexical_cast(Value);
    }
    catch (boost::bad_lexical_cast &)
    {
        std::cout<<"Unable to display segment"<<std::endl;
    }

    LabelPtr TheCaptionSegment = Label::Ptr::dcast(getCaptionSegmentPrototype()->shallowCopy());
    beginEditCP(TheCaptionSegment, Label::TextFieldMask);
        TheCaptionSegment->setText(CaptionSegment);
    endEditCP(TheCaptionSegment, Label::TextFieldMask);

    return TheCaptionSegment;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:22,代码来源:OSGDefaultCaptionComponentGenerator.cpp

示例4: main


//.........这里部分代码省略.........

    //Setup scene
    NodePtr EmptyScene = osg::Node::create();
    beginEditCP(EmptyScene, Node::CoreFieldMask);
        EmptyScene->setCore(Group::create());
    endEditCP  (EmptyScene, Node::CoreFieldMask);

    mgr->setRoot(EmptyScene);



    //User Interface
    // Create the Graphics
    GraphicsPtr TutorialGraphics = osg::Graphics2D::create();

    // Initialize the LookAndFeelManager to enable default settings
    LookAndFeelManager::the()->getLookAndFeel()->init();

    // Create the DefaultBoundedRangeModelPtr and 
    // set its values
    DefaultBoundedRangeModelPtr UpperAnimationSliderRangeModel = DefaultBoundedRangeModel::create();
    UpperAnimationSliderRangeModel->setMinimum(0);
    UpperAnimationSliderRangeModel->setMaximum(100);
    UpperAnimationSliderRangeModel->setValue(BlendWalking * 100);
    UpperAnimationSliderRangeModel->setExtent(0);
    
    //Create the upper animation blend amount slider
    LabelPtr TempLabel;
    SliderPtr UpperAnimationSlider = Slider::create();
    beginEditCP(UpperAnimationSlider, Slider::LabelMapFieldMask | Slider::PreferredSizeFieldMask | Slider::MajorTickSpacingFieldMask | Slider::MinorTickSpacingFieldMask | Slider::SnapToTicksFieldMask | Slider::DrawLabelsFieldMask | Slider::RangeModelFieldMask);

     //Label the slider
        TempLabel = Label::Ptr::dcast(UpperAnimationSlider->getLabelPrototype()->shallowCopy());
        beginEditCP(TempLabel, Label::TextFieldMask); TempLabel->setText("0.0"); endEditCP(TempLabel, Label::TextFieldMask);
        UpperAnimationSlider->getLabelMap()[0] = TempLabel;

        TempLabel = Label::Ptr::dcast(UpperAnimationSlider->getLabelPrototype()->shallowCopy());
        beginEditCP(TempLabel, Label::TextFieldMask); TempLabel->setText("1.0"); endEditCP(TempLabel, Label::TextFieldMask);
        UpperAnimationSlider->getLabelMap()[100] = TempLabel;

        //Customize the slider
        UpperAnimationSlider->setPreferredSize(Vec2f(100, 300));
        UpperAnimationSlider->setSnapToTicks(false);
        UpperAnimationSlider->setMajorTickSpacing(10);
        UpperAnimationSlider->setMinorTickSpacing(5);
        UpperAnimationSlider->setOrientation(Slider::VERTICAL_ORIENTATION);
        UpperAnimationSlider->setInverted(true);
        UpperAnimationSlider->setDrawLabels(true);
        UpperAnimationSlider->setRangeModel(UpperAnimationSliderRangeModel);
    endEditCP(UpperAnimationSlider, Slider::LabelMapFieldMask | Slider::PreferredSizeFieldMask | Slider::MajorTickSpacingFieldMask | Slider::MinorTickSpacingFieldMask | Slider::SnapToTicksFieldMask | Slider::DrawLabelsFieldMask | Slider::RangeModelFieldMask);
    
    DefaultBoundedRangeModelPtr LowerAnimationSliderRangeModel = DefaultBoundedRangeModel::create();
    LowerAnimationSliderRangeModel->setMinimum(0);
    LowerAnimationSliderRangeModel->setMaximum(100);
    LowerAnimationSliderRangeModel->setValue(BlendTouchScreen * 100);
    LowerAnimationSliderRangeModel->setExtent(0);
    
    //Create the lower animation blend amount slider
    SliderPtr LowerAnimationSlider = Slider::create();
    beginEditCP(LowerAnimationSlider, Slider::LabelMapFieldMask | Slider::PreferredSizeFieldMask | Slider::MajorTickSpacingFieldMask | Slider::MinorTickSpacingFieldMask | Slider::SnapToTicksFieldMask | Slider::DrawLabelsFieldMask | Slider::RangeModelFieldMask);

     //Label the slider
        TempLabel = Label::Ptr::dcast(LowerAnimationSlider->getLabelPrototype()->shallowCopy());
        beginEditCP(TempLabel, Label::TextFieldMask); TempLabel->setText("0.0"); endEditCP(TempLabel, Label::TextFieldMask);
        LowerAnimationSlider->getLabelMap()[0] = TempLabel;
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:66,代码来源:23BlendXMLAnimations.cpp


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