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


C++ TSharedPtr::AsShared方法代码示例

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


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

示例1: Construct

	void Construct(const FArguments& InArgs)
	{
		PoseWatch = InArgs._PoseWatch;

		static FColor PoseWatchColours[] = { FColor::Red, FColor::Green, FColor::Blue, FColor::Cyan, FColor::Orange, FColor::Purple, FColor::Yellow, FColor::Black };

		const int32 Rows = 2;
		const int32 Columns = 4;

		TSharedPtr<SVerticalBox> Layout = SNew(SVerticalBox);

		for (int32 RowIndex = 0; RowIndex < Rows; ++RowIndex)
		{
			TSharedPtr<SHorizontalBox> Row = SNew(SHorizontalBox);

			for (int32 RowItem = 0; RowItem < Columns; ++RowItem)
			{
				int32 ColourIndex = RowItem + (RowIndex * Columns);
				FColor Colour = PoseWatchColours[ColourIndex];

				Row->AddSlot()
				.Padding(5.f, 2.f)
				[
					SNew(SButton)
					.HAlign(HAlign_Center)
					.OnClicked(this, &SPoseViewColourPickerPopup::NewPoseWatchColourPicked, Colour)
					.ButtonColorAndOpacity(Colour)
				];

			}

			Layout->AddSlot()
			[
				Row.ToSharedRef()
			];
		}

		Layout->AddSlot()
			.AutoHeight()
			.Padding(5.f, 2.f)
			[
				SNew(SButton)
				.Text(NSLOCTEXT("AnimationGraphNode", "RemovePoseWatch", "Remove Pose Watch"))
				.OnClicked(this, &SPoseViewColourPickerPopup::RemovePoseWatch)
			];

		this->ChildSlot
			[
				SNew(SBorder)
				.BorderImage(FEditorStyle::GetBrush(TEXT("Menu.Background")))
				.Padding(10)
				[
					Layout->AsShared()
				]
			];
	}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:56,代码来源:SAnimationGraphNode.cpp

示例2: Construct

void SVoxOptionWidget::Construct(const FArguments& InArgs)
{
	ImportOption = InArgs._ImportOption;
	Window = InArgs._Window;

	TSharedPtr<SBox> InspectorBox;

	this->ChildSlot[
		SNew(SVerticalBox)
		+ SVerticalBox::Slot().AutoHeight().Padding(2) [
			SAssignNew(InspectorBox, SBox).MaxDesiredHeight(650.0f).WidthOverride(400.0f)
		]
		+ SVerticalBox::Slot().AutoHeight().HAlign(HAlign_Right).Padding(2)
		[
			SNew(SUniformGridPanel).SlotPadding(2)
			+ SUniformGridPanel::Slot(0, 0)[
				SNew(SButton).HAlign(HAlign_Center).Text(NSLOCTEXT("VOX4U", "VoxOptionWindow_ImportAll", "Import All"))
				.OnClicked(this, &SVoxOptionWidget::OnImportAll)
			]
			+ SUniformGridPanel::Slot(1, 0) [
				SNew(SButton).HAlign(HAlign_Center).Text(NSLOCTEXT("VOX4U", "VoxOptionWindow_Import", "Import"))
				.OnClicked(this, &SVoxOptionWidget::OnImport)
			]
			+ SUniformGridPanel::Slot(2, 0) [
				SNew(SButton).HAlign(HAlign_Center).Text(NSLOCTEXT("VOX4U", "VoxOptionWindow_Cancel", "Cancel"))
				.OnClicked(this, &SVoxOptionWidget::OnCancel)
			]
		]
	];

	FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
	FDetailsViewArgs DetailsViewArgs;
	DetailsViewArgs.bAllowSearch = false;
	DetailsViewArgs.NameAreaSettings = FDetailsViewArgs::HideNameArea;
	TSharedPtr<IDetailsView> DetailsView = PropertyEditorModule.CreateDetailView(DetailsViewArgs);

	InspectorBox->SetContent(DetailsView->AsShared());
	DetailsView->SetObject(ImportOption);
}
开发者ID:mik14a,项目名称:VOX4U,代码行数:39,代码来源:VoxOptionWidget.cpp

示例3: Construct

	/**
	 * Construct this widget
	 *
	 * @param	InArgs	The declaration data for this widget
	 */
	void Construct( const FArguments& InArgs )
	{
		FName ButtonStyle = FEditorStyle::Join(InArgs._Style.Get(), ".Button");
		FName CheckboxStyle = FEditorStyle::Join(InArgs._Style.Get(), ".ToggleButton");
	
		const FSlateIcon& Icon = InArgs._Icon.Get();

		ParentToolBar = InArgs._ParentToolBar;
	
		TSharedPtr<SCheckBox> ToggleControl;
		{
			ToggleControl = SNew(SCheckBox)
			.Cursor( EMouseCursor::Default )
			.Padding(FMargin( 4.0f ))
			.Style(FEditorStyle::Get(), EMultiBlockLocation::ToName(CheckboxStyle, EMultiBlockLocation::Start))
			.OnCheckStateChanged(InArgs._OnCheckStateChanged)
			.ToolTipText(InArgs._ToggleButtonToolTip)
			.IsChecked(InArgs._IsChecked)
			.Content()
			[
				SNew( SBox )
				.WidthOverride( TransformViewportToolbarDefs::ToggleImageScale )
				.HeightOverride( TransformViewportToolbarDefs::ToggleImageScale )
				.HAlign(HAlign_Center)
				.VAlign(VAlign_Center)
				[
					SNew(SImage)
					.Image(Icon.GetIcon())
				]
			];
		}

		{
			SAssignNew( MenuAnchor, SMenuAnchor )
			.Placement( MenuPlacement_BelowAnchor )
			[
				SNew(SButton)
				.ButtonStyle( FEditorStyle::Get(), EMultiBlockLocation::ToName(ButtonStyle,EMultiBlockLocation::End) )
				.ContentPadding( FMargin( 5.0f, 0.0f ) )
				.ToolTipText(InArgs._MenuButtonToolTip)
				.OnClicked(this, &SGridSnapSetting::OnMenuClicked)
				[
					SNew(SVerticalBox)
					+SVerticalBox::Slot()
					.AutoHeight()
					.HAlign(HAlign_Center)
					.VAlign(VAlign_Top)
					[
						SNew(STextBlock)
						.Font( FEditorStyle::GetFontStyle( InArgs._Style.Get(), ".Label.Font" ) )
						.Text(InArgs._Label)
					]
					+SVerticalBox::Slot()
					.AutoHeight()
					.VAlign(VAlign_Bottom)
					[
						SNew(SHorizontalBox)
						+SHorizontalBox::Slot()
						.FillWidth(1.0f)

						+SHorizontalBox::Slot()
						.AutoWidth()
						[
							SNew( SBox )
							.WidthOverride( TransformViewportToolbarDefs::DownArrowSize )
							.HeightOverride( TransformViewportToolbarDefs::DownArrowSize )
							[
								SNew(SImage)
								.Image(FEditorStyle::GetBrush("ComboButton.Arrow"))
								.ColorAndOpacity(FLinearColor::Black)
							]
						]

						+SHorizontalBox::Slot()
							.FillWidth(1.0f)
					]
				]
			]
			.OnGetMenuContent( InArgs._OnGetMenuContent );
		}


		ChildSlot
		[
			SNew(SHorizontalBox)

			//Checkbox concept
			+SHorizontalBox::Slot()
			.AutoWidth()
			[
				ToggleControl->AsShared()
			]

			// Black Seperator line
			+SHorizontalBox::Slot()
//.........这里部分代码省略.........
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:101,代码来源:STransformViewportToolbar.cpp

示例4: Construct


//.........这里部分代码省略.........
                            .VAlign(VAlign_Center)
                            [
                                SNew(SImage)
                                .Image(Icon.GetIcon())
                            ]
                        ];
    }

    {
        TSharedRef<SWidget> ButtonContents =
            SNew(SButton)
            .ButtonStyle( FEditorStyle::Get(), EMultiBlockLocation::ToName(ButtonStyle,EMultiBlockLocation::End) )
            .ContentPadding( FMargin( 5.0f, 0.0f ) )
            .ToolTipText(InArgs._MenuButtonToolTip)
            .OnClicked(this, &SViewportToolBarComboMenu::OnMenuClicked)
            [
                SNew(SVerticalBox)
                +SVerticalBox::Slot()
                .AutoHeight()
                .HAlign(HAlign_Center)
                .VAlign(VAlign_Top)
                [
                    SNew(STextBlock)
                    .TextStyle( FEditorStyle::Get(), FEditorStyle::Join( InArgs._Style.Get(), ".Label" ) )
                    .Text(InArgs._Label)
                ]
                +SVerticalBox::Slot()
                .AutoHeight()
                .VAlign(VAlign_Bottom)
                [
                    SNew(SHorizontalBox)
                    +SHorizontalBox::Slot()
                    .FillWidth(1.0f)

                    +SHorizontalBox::Slot()
                    .AutoWidth()
                    [
                        SNew( SBox )
                        .WidthOverride( 4 )
                        .HeightOverride( 4 )
                        [
                            SNew(SImage)
                            .Image(FEditorStyle::GetBrush("ComboButton.Arrow"))
                            .ColorAndOpacity(FLinearColor::Black)
                        ]
                    ]

                    +SHorizontalBox::Slot()
                    .FillWidth(1.0f)
                ]
            ];

        if (InArgs._MinDesiredButtonWidth > 0.0f)
        {
            ButtonContents =
                SNew(SBox)
                .MinDesiredWidth(InArgs._MinDesiredButtonWidth)
                [
                    ButtonContents
                ];
        }

        MenuAnchor = SNew(SMenuAnchor)
                     .Placement( MenuPlacement_BelowAnchor )
                     [
                         ButtonContents
                     ]
                     .OnGetMenuContent( InArgs._OnGetMenuContent );
    }


    ChildSlot
    [
        SNew(SHorizontalBox)

        //Checkbox concept
        +SHorizontalBox::Slot()
        .AutoWidth()
        [
            ToggleControl->AsShared()
        ]

        // Black Separator line
        +SHorizontalBox::Slot()
        .AutoWidth()
        [
            SNew(SBorder)
            .Padding(FMargin(1.0f, 0.0f, 0.0f, 0.0f))
            .BorderImage(FEditorStyle::GetDefaultBrush())
            .BorderBackgroundColor(FLinearColor::Black)
        ]

        // Menu dropdown concept
        +SHorizontalBox::Slot()
        .AutoWidth()
        [
            MenuAnchor->AsShared()
        ]
    ];
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:101,代码来源:SViewportToolBarComboMenu.cpp


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