本文整理汇总了C++中TSharedPtr::AddSlot方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::AddSlot方法的具体用法?C++ TSharedPtr::AddSlot怎么用?C++ TSharedPtr::AddSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::AddSlot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSourceCodeToVerticalBox
/* Add the source code box to any vertical box*/
void AddSourceCodeToVerticalBox(TSharedPtr<SVerticalBox>& VerticalBox, const FString& SourceCode)
{
if (SourceCode.Len() > 0)
{
// Replace tabs with two spaces for display in the widget, as the rich text block doesn't support tabs
FString spacedSource = SourceCode.Replace(TEXT("\t"), TEXT(" "));
VerticalBox->AddSlot()
.AutoHeight()
[
SNew(SSeparator)
];
VerticalBox->AddSlot()
.AutoHeight()
[
SNew(SExpandableArea)
.AreaTitle(FText::FromString(TEXT("Source Code")))
.AreaTitleFont(FEditorStyle::GetFontStyle(TEXT("DetailsView.CategoryFontStyle")))
.InitiallyCollapsed(true)
.Padding(WidgetPadding)
.BodyContent()
[
SNew(SRichTextBlock)
.Text(FText::FromString(spacedSource))
.TextStyle(FMaliOCStyle::Get(), "Text.Normal")
.AutoWrapText(true)
]
];
}
}
示例2: 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()
]
];
}
示例3: MakeHeaderRow
void FMathStructCustomization::MakeHeaderRow( TSharedRef<class IPropertyHandle>& StructPropertyHandle, FDetailWidgetRow& Row )
{
// We'll set up reset to default ourselves
const bool bDisplayResetToDefault = false;
const FString DisplayNameOverride = TEXT("");
TSharedPtr<SHorizontalBox> HorizontalBox;
Row.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget( DisplayNameOverride, bDisplayResetToDefault )
]
.ValueContent()
// Make enough space for each child handle
.MinDesiredWidth(125.0f * SortedChildHandles.Num() )
.MaxDesiredWidth(125.0f * SortedChildHandles.Num() )
[
SAssignNew( HorizontalBox, SHorizontalBox )
];
for( int32 ChildIndex = 0; ChildIndex < SortedChildHandles.Num(); ++ChildIndex )
{
TSharedRef<IPropertyHandle> ChildHandle = SortedChildHandles[ChildIndex];
const bool bLastChild = SortedChildHandles.Num()-1 == ChildIndex;
// Make a widget for each property. The vector component properties will be displayed in the header
HorizontalBox->AddSlot()
.Padding( FMargin(0.0f, 2.0f, bLastChild ? 0.0f : 3.0f, 2.0f ) )
[
MakeChildWidget( ChildHandle )
];
}
}
示例4: CustomizeHeader
void FMarginStructCustomization::CustomizeHeader( TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
this->StructPropertyHandle = StructPropertyHandle;
const FString UVSpaceString( StructPropertyHandle->GetProperty()->GetMetaData( TEXT( "UVSpace" ) ) );
bIsMarginUsingUVSpace = UVSpaceString.Len() > 0 && UVSpaceString == TEXT( "true" );
uint32 NumChildren;
StructPropertyHandle->GetNumChildren( NumChildren );
for( uint32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex )
{
ChildPropertyHandles.Add( StructPropertyHandle->GetChildHandle( ChildIndex ).ToSharedRef() );
}
TSharedPtr<SHorizontalBox> HorizontalBox;
HeaderRow.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
.MinDesiredWidth( 250.0f )
.MaxDesiredWidth( 250.0f )
[
SAssignNew( HorizontalBox, SHorizontalBox )
];
HorizontalBox->AddSlot()
[
MakePropertyWidget()
];
}
示例5: SNew
TSharedRef< class SWidget > FTextPropertyTableCellPresenter::ConstructEditModeDropDownWidget()
{
TSharedRef< SWidget > Result = SNullWidget::NullWidget;
TArray< TSharedRef<SWidget> > RequiredButtons;
PropertyEditorHelpers::MakeRequiredPropertyButtons( PropertyEditor, /*OUT*/RequiredButtons );
if ( RequiredButtons.Num() > 0 )
{
TSharedPtr< SHorizontalBox > ButtonBox;
Result = SNew( SBorder )
.BorderImage(FEditorStyle::GetBrush("PropertyTable.Cell.DropDown.Background"))
.Padding( 0 )
.Content()
[
SAssignNew( ButtonBox, SHorizontalBox )
];
for( int32 ButtonIndex = 0; ButtonIndex < RequiredButtons.Num(); ++ButtonIndex )
{
ButtonBox->AddSlot()
.AutoWidth()
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.Padding( 2.0f, 1.0f )
[
RequiredButtons[ButtonIndex]
];
}
}
return Result;
}
示例6: if
TSharedRef<SWidget> SFriendsItem::OnGetMenuContent()
{
TArray< EFriendsActionType::Type > FriendActions;
if ( FriendItem.IsValid() )
{
if ( FriendItem->GetListType() == EFriendsDisplayLists::RecentPlayersDisplay )
{
if ( !FFriendsAndChatManager::Get()->FindUserID( FriendItem->GetName() ).IsValid() && FFriendsAndChatManager::Get()->IsPendingInvite( FriendItem->GetName() ) == false )
{
FriendActions.Add( EFriendsActionType::Add_Friend );
}
}
else if ( FriendItem->GetInviteStatus() == EInviteStatus::Accepted )
{
if ( FFriendsAndChatManager::Get()->IsInSession() )
{
FriendActions.Add(EFriendsActionType::Invite_To_Game );
}
FriendActions.Add( EFriendsActionType::Delete_Friend );
}
else if ( FriendItem->GetInviteStatus() == EInviteStatus::PendingOutbound && FriendItem->GetOnlineFriend().IsValid() )
{
FriendActions.Add( EFriendsActionType::Cancel_Request );
}
else if ( FriendItem->GetInviteStatus() == EInviteStatus::PendingInbound )
{
FriendActions.Add( EFriendsActionType::Accept_Friend );
FriendActions.Add( EFriendsActionType::Reject_Friend );
}
}
if ( FriendActions.Num() == 0 )
{
return SNullWidget::NullWidget;
}
TSharedPtr< SVerticalBox > DisplayBox;
SAssignNew( DisplayBox, SVerticalBox );
for( auto Iter(FriendActions.CreateConstIterator()); Iter; Iter++ )
{
DisplayBox->AddSlot()
.AutoHeight()
[
SNew( SButton )
.OnClicked( this, &SFriendsItem::OnOptionSelected, *Iter )
[
SNew( STextBlock )
.Text( GetActionText( *Iter ) )
.TextStyle( &FriendStyle.TextStyle )
.ColorAndOpacity( FriendStyle.MenuSetColor )
]
];
}
return DisplayBox.ToSharedRef();
}
示例7: Construct
void SDetailCategoryTableRow::Construct( const FArguments& InArgs, TSharedRef<IDetailTreeNode> InOwnerTreeNode, const TSharedRef<STableViewBase>& InOwnerTableView )
{
OwnerTreeNode = InOwnerTreeNode;
bIsInnerCategory = InArgs._InnerCategory;
TSharedPtr<SHorizontalBox> MyContent;
ChildSlot
.Padding( 0.0f, 2.0f, 0.0f, 0.0f )
[
SNew( SBorder )
.BorderImage( this, &SDetailCategoryTableRow::GetBackgroundImage )
.Padding( FMargin( 0.0f, 3.0f, SDetailTableRowBase::ScrollbarPaddingSize, 3.0f ) )
.BorderBackgroundColor( FLinearColor( .6,.6,.6, 1.0f ) )
[
SAssignNew( MyContent, SHorizontalBox )
+SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.Padding(2.0f, 2.0f, 2.0f, 2.0f)
.AutoWidth()
[
SNew( SExpanderArrow, SharedThis(this) )
]
+SHorizontalBox::Slot()
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew( STextBlock )
.Text( InArgs._DisplayName )
.Font( FEditorStyle::GetFontStyle( bIsInnerCategory ? "PropertyWindow.NormalFont" : "DetailsView.CategoryFontStyle" ) )
.ShadowOffset( bIsInnerCategory ? FVector2D::ZeroVector : FVector2D(1.0f, 1.0f) )
]
]
];
if( InArgs._HeaderContent.IsValid() )
{
MyContent->AddSlot()
.VAlign(VAlign_Center)
[
InArgs._HeaderContent.ToSharedRef()
];
}
STableRow< TSharedPtr< IDetailTreeNode > >::ConstructInternal(
STableRow::FArguments()
.Style(FEditorStyle::Get(), "DetailsView.TreeView.TableRow")
.ShowSelection(false),
InOwnerTableView
);
}
示例8: CreateConfigWidgets
void AUTDomGameMode::CreateConfigWidgets(TSharedPtr<class SVerticalBox> MenuSpace, bool bCreateReadOnly, TArray< TSharedPtr<TAttributePropertyBase> >& ConfigProps, int32 MinimumPlayers)
{
Super::CreateConfigWidgets(MenuSpace, bCreateReadOnly, ConfigProps, MinimumPlayers);
TSharedPtr< TAttributePropertyBool > AllowTransAttr = StaticCastSharedPtr<TAttributePropertyBool>(FindGameURLOption(ConfigProps, TEXT("AllowTrans")));
if (AllowTransAttr.IsValid())
{
MenuSpace->AddSlot()
.Padding(0.0f, 0.0f, 0.0f, 5.0f)
.AutoHeight()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
[
SNew(SBox)
.WidthOverride(350)
[
SNew(STextBlock)
.TextStyle(SUWindowsStyle::Get(), "UT.Common.NormalText")
.Text(NSLOCTEXT("UTDomGameMode", "AllowTranslocator", "Translocator"))
]
]
+ SHorizontalBox::Slot()
.Padding(20.0f, 0.0f, 0.0f, 0.0f)
.AutoWidth()
[
SNew(SBox)
.WidthOverride(300)
[
bCreateReadOnly ?
StaticCastSharedRef<SWidget>(
SNew(SCheckBox)
.IsChecked(AllowTransAttr.ToSharedRef(), &TAttributePropertyBool::GetAsCheckBox)
.Type(ESlateCheckBoxType::CheckBox)
.Style(SUWindowsStyle::Get(), "UT.Common.CheckBox")
) :
StaticCastSharedRef<SWidget>(
SNew(SCheckBox)
.IsChecked(AllowTransAttr.ToSharedRef(), &TAttributePropertyBool::GetAsCheckBox)
.OnCheckStateChanged(AllowTransAttr.ToSharedRef(), &TAttributePropertyBool::SetFromCheckBox)
.Type(ESlateCheckBoxType::CheckBox)
.Style(SUWindowsStyle::Get(), "UT.Common.CheckBox")
)
]
]
];
}
}
示例9: MakeShareable
void SGraphNodeK2CreateDelegate::CreateBelowWidgetControls(TSharedPtr<SVerticalBox> MainBox)
{
if(UK2Node_CreateDelegate* Node = Cast<UK2Node_CreateDelegate>(GraphNode))
{
UFunction* FunctionSignature = Node->GetDelegateSignature();
UClass* ScopeClass = Node->GetScopeClass();
if(FunctionSignature && ScopeClass)
{
FunctionDataItems.Empty();
for(TFieldIterator<UFunction> It(ScopeClass); It; ++It)
{
UFunction* Func = *It;
if (Func && FunctionSignature->IsSignatureCompatibleWith(Func) &&
UEdGraphSchema_K2::FunctionCanBeUsedInDelegate(Func))
{
TSharedPtr<FFunctionItemData> ItemData = MakeShareable(new FFunctionItemData());
ItemData->Name = Func->GetFName();
ItemData->Description = FunctionDescription(Func);
FunctionDataItems.Add(ItemData);
}
}
TSharedRef<SComboButton> SelectFunctionWidgetRef = SNew(SComboButton)
.Method(EPopupMethod::UseCurrentWindow)
.ButtonContent()
[
SNew(STextBlock)
.Text(this, &SGraphNodeK2CreateDelegate::GetCurrentFunctionDescription)
]
.MenuContent()
[
SNew(SListView<TSharedPtr<FFunctionItemData> >)
.ListItemsSource( &FunctionDataItems )
.OnGenerateRow(this, &SGraphNodeK2CreateDelegate::HandleGenerateRowFunction)
.OnSelectionChanged(this, &SGraphNodeK2CreateDelegate::OnFunctionSelected)
];
MainBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Fill)
[
SelectFunctionWidgetRef
];
SelectFunctionWidget = SelectFunctionWidgetRef;
}
}
}
示例10: CreateOutputSideRemoveButton
void SGraphNode_MultiCompareGameplayTag::CreateOutputSideRemoveButton(TSharedPtr<SVerticalBox> OutputBox)
{
TSharedPtr<SWidget> ButtonContent;
SAssignNew(ButtonContent, SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.HAlign(HAlign_Left)
[
SNew(STextBlock)
.Text(NSLOCTEXT("CompareNode", "CompareNodeRemovePinButton", "Remove Case"))
.ColorAndOpacity(FLinearColor::White)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.VAlign(VAlign_Center)
.Padding(7, 0, 0, 0)
[
SNew(SImage)
.Image(FEditorStyle::GetBrush(TEXT("PropertyWindow.Button_RemoveFromArray")))
];
TSharedPtr<SToolTip> Tooltip;
Tooltip = IDocumentation::Get()->CreateToolTip(NSLOCTEXT("CompareNode", "CompareNodeRemoveCaseButton_Tooltip", "Remove last case pins"), NULL, GraphNode->GetDocumentationLink(), FString());
TSharedRef<SButton> RemovePinButton = SNew(SButton)
.ContentPadding(0.0f)
.ButtonStyle(FEditorStyle::Get(), "NoBorder")
.OnClicked(this, &SGraphNode_MultiCompareGameplayTag::OnRemovePin)
.ToolTipText(NSLOCTEXT("CompareNode", "CompareNodeRemovePinButton_Tooltip", "Remove last pin"))
.ToolTip(Tooltip)
.Visibility(this, &SGraphNode_MultiCompareGameplayTag::IsRemovePinButtonVisible)
[
ButtonContent.ToSharedRef()
];
RemovePinButton->SetCursor(EMouseCursor::Hand);
FMargin AddPinPadding = Settings->GetOutputPinPadding();
AddPinPadding.Top += 6.0f;
OutputBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Center)
.Padding(AddPinPadding)
[
RemovePinButton
];
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:48,代码来源:SGraphNode_MultiCompareGameplayTag.cpp
示例11: GenerateMidgardStatsTable
/* Generate a Midgard stats table */
TSharedRef<SVerticalBox> GenerateMidgardStatsTable(const TSharedRef<FMaliOCReport::FMidgardReport::FRenderTarget>& RenderTarget)
{
TSharedRef<SVerticalBox> rtBox = SNew(SVerticalBox);
int index = 0;
// Four rows, 5 columns
for (int i = 0; i < 4; i++)
{
TSharedPtr<SHorizontalBox> curRow = nullptr;
rtBox->AddSlot()
.AutoHeight()
[
SAssignNew(curRow, SHorizontalBox)
];
const float columnWidths[] = { 2.5f, 1.0f, 1.0f, 1.0f, 2.0f };
const float widthScaleFactor = 50.0f;
for (int j = 0; j < 5; j++)
{
curRow->AddSlot()
.FillWidth(columnWidths[j])
.MaxWidth(columnWidths[j] * widthScaleFactor)
[
SNew(STextBlock)
.Text(*RenderTarget->StatsTable[index])
.Font(FEditorStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont")))
];
index++;
}
}
rtBox->AddSlot()
.AutoHeight()
[
SNew(SSeparator)
];
rtBox->AddSlot()
.AutoHeight()
[
GenerateFStringListView(RenderTarget->ExtraDetails)
];
return rtBox;
};
示例12: AddPinButtonContent
void SGraphNodeK2Sequence::CreateOutputSideAddButton(TSharedPtr<SVerticalBox> OutputBox)
{
TSharedRef<SWidget> AddPinButton = AddPinButtonContent(
NSLOCTEXT("SequencerNode", "SequencerNodeAddPinButton", "Add pin"),
NSLOCTEXT("SequencerNode", "SequencerNodeAddPinButton_ToolTip", "Add new pin"));
FMargin AddPinPadding = Settings->GetOutputPinPadding();
AddPinPadding.Top += 6.0f;
OutputBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Center)
.Padding(AddPinPadding)
[
AddPinButton
];
}
示例13: CreateOutputSideAddButton
void SGraphNode_MultiCompareGameplayTag::CreateOutputSideAddButton(TSharedPtr<SVerticalBox> OutputBox)
{
TSharedRef<SWidget> AddPinButton = AddPinButtonContent(
NSLOCTEXT("CompareNode", "CompareNodeAddPinButton", "Add Case"),
NSLOCTEXT("CompareNode", "CompareNodeAddPinButton_Tooltip", "Add new case pins"));
FMargin AddPinPadding = Settings->GetOutputPinPadding();
AddPinPadding.Top += 6.0f;
OutputBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Center)
.Padding(AddPinPadding)
[
AddPinButton
];
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:17,代码来源:SGraphNode_MultiCompareGameplayTag.cpp
示例14: CreateOutputSideAddButton
void SGraphNodeSoundBase::CreateOutputSideAddButton(TSharedPtr<SVerticalBox> OutputBox)
{
TSharedRef<SWidget> AddPinButton = AddPinButtonContent(
NSLOCTEXT("SoundNode", "SoundNodeAddPinButton", "Add input"),
NSLOCTEXT("SoundNode", "SoundNodeAddPinButton_Tooltip", "Adds an input to the sound node")
);
FMargin AddPinPadding = Settings->GetOutputPinPadding();
AddPinPadding.Top += 6.0f;
OutputBox->AddSlot()
.AutoHeight()
.VAlign(VAlign_Center)
.Padding(AddPinPadding)
[
AddPinButton
];
}
示例15: RegenerateWidgets
void SScreenHistoryView::RegenerateWidgets()
{
// Clear the box before regenerating the widgets
WidgetBox->ClearChildren();
TSharedPtr< SHorizontalBox > HolderBox;
// Box where all widgets go
WidgetBox->AddSlot()
.AutoHeight()
.VAlign( VAlign_Center )
.HAlign( HAlign_Left )
[
SAssignNew( HolderBox, SHorizontalBox )
];
// Get the filtered views
TArray<TSharedPtr<IScreenShotData> >& DevicesArray = ScreenShotData->GetFilteredChildren();
// Create a new widget for each screen shot
for ( int32 ChildSlots = FirstItemToShow; ChildSlots < DevicesArray.Num(); ChildSlots++ )
{
HolderBox->AddSlot()
.AutoWidth()
.VAlign( VAlign_Center )
.HAlign( HAlign_Center )
[
SNew( SScreenShotItem )
.ScreenShotData( DevicesArray[ChildSlots] )
];
}
// Only show scroll bar if we have more than 1 screenshot
if ( DevicesArray.Num() > 1 )
{
// Add the cached scrollbar back to the created widgets
WidgetBox->AddSlot()
.AutoHeight()
.Padding(8, 0)
[
ScrollBox.ToSharedRef()
];
}
}