本文整理汇总了C++中TSharedRef::GetAction方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::GetAction方法的具体用法?C++ TSharedRef::GetAction怎么用?C++ TSharedRef::GetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedRef
的用法示例。
在下文中一共展示了TSharedRef::GetAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BlockRemoved
void FMultiBoxCustomizationData::BlockRemoved( TSharedRef< const FMultiBlock> RemovedBlock, int32 Index, const TArray< TSharedRef< const FMultiBlock > >& AllBlocks )
{
FCustomBlockTransaction Remove = FCustomBlockTransaction::CreateRemove( RemovedBlock->GetAction().ToSharedRef(), Index );
SaveTransaction( Remove, AllBlocks );
}
示例2: GetSmallIconBrush
const FSlateBrush* SToolBarButtonBlock::GetSmallIconBrush() const
{
TSharedRef< const FToolBarButtonBlock > ToolBarButtonBlock = StaticCastSharedRef< const FToolBarButtonBlock >( MultiBlock.ToSharedRef() );
const FSlateIcon ActionIcon = ToolBarButtonBlock->GetAction().IsValid() ? ToolBarButtonBlock->GetAction()->GetIcon() : FSlateIcon();
const FSlateIcon& ActualIcon = ToolBarButtonBlock->IconOverride.IsSet() ? ToolBarButtonBlock->IconOverride.Get() : ActionIcon;
if( ActualIcon.IsSet() )
{
return ActualIcon.GetSmallIcon();
}
else
{
check( OwnerMultiBoxWidget.IsValid() );
TSharedPtr<SMultiBoxWidget> MultiBoxWidget = OwnerMultiBoxWidget.Pin();
const ISlateStyle* const StyleSet = MultiBoxWidget->GetStyleSet();
return StyleSet->GetBrush( "MultiBox.GenericToolBarIcon.Small" );
}
}
示例3: InsertCustomMultiBlock
void FMultiBox::InsertCustomMultiBlock( TSharedRef<const FMultiBlock> InBlock, int32 Index )
{
if( IsCustomizable() && ensure( InBlock->GetAction().IsValid() ) )
{
int32 ExistingIndex = Blocks.Find( InBlock );
if( ExistingIndex != INDEX_NONE )
{
Blocks.RemoveAt( ExistingIndex );
CustomizationData->BlockRemoved( InBlock, ExistingIndex, Blocks );
if( ExistingIndex < Index )
{
--Index;
}
}
Blocks.Insert( InBlock, Index );
CustomizationData->BlockAdded( InBlock, Index, Blocks );
}
}
示例4: BuildMultiBlockWidget
/**
* Builds this MultiBlock widget up from the MultiBlock associated with it
*/
void SToolBarButtonBlock::BuildMultiBlockWidget(const ISlateStyle* StyleSet, const FName& StyleName)
{
struct Local
{
/** Appends the key binding to the end of the provided ToolTip */
static FText AppendKeyBindingToToolTip( const TAttribute<FText> ToolTip, TWeakPtr< const FUICommandInfo> Command )
{
TSharedPtr<const FUICommandInfo> CommandPtr = Command.Pin();
if( CommandPtr.IsValid() && CommandPtr->GetActiveChord()->IsValidChord() )
{
FFormatNamedArguments Args;
Args.Add( TEXT("ToolTipDescription"), ToolTip.Get() );
Args.Add( TEXT("Keybinding"), CommandPtr->GetInputText() );
return FText::Format( NSLOCTEXT("ToolBar", "ToolTip + Keybinding", "{ToolTipDescription} ({Keybinding})"), Args );
}
else
{
return ToolTip.Get();
}
}
};
TSharedRef< const FMultiBox > MultiBox( OwnerMultiBoxWidget.Pin()->GetMultiBox() );
TSharedRef< const FToolBarButtonBlock > ToolBarButtonBlock = StaticCastSharedRef< const FToolBarButtonBlock >( MultiBlock.ToSharedRef() );
// Allow the block to override the action's label and tool tip string, if desired
TAttribute<FText> ActualLabel;
if (ToolBarButtonBlock->LabelOverride.IsSet())
{
ActualLabel = ToolBarButtonBlock->LabelOverride;
}
else
{
ActualLabel = ToolBarButtonBlock->GetAction()->GetLabel();
}
// Add this widget to the search list of the multibox
if (MultiBlock->GetSearchable())
OwnerMultiBoxWidget.Pin()->AddSearchElement(this->AsWidget(), ActualLabel.Get());
TAttribute<FText> ActualToolTip;
if (ToolBarButtonBlock->ToolTipOverride.IsSet())
{
ActualToolTip = ToolBarButtonBlock->ToolTipOverride;
}
else
{
ActualToolTip = ToolBarButtonBlock->GetAction()->GetDescription();
}
// If a key is bound to the command, append it to the tooltip text.
TWeakPtr<const FUICommandInfo> Action = ToolBarButtonBlock->GetAction();
ActualToolTip = TAttribute< FText >::Create( TAttribute< FText >::FGetter::CreateStatic( &Local::AppendKeyBindingToToolTip, ActualToolTip, Action ) );
// If we were supplied an image than go ahead and use that, otherwise we use a null widget
TSharedRef< SWidget > IconWidget =
SNew( SImage )
.Visibility( this, &SToolBarButtonBlock::GetIconVisibility, false )
.Image( this, &SToolBarButtonBlock::GetIconBrush );
TSharedRef< SWidget > SmallIconWidget =
SNew( SImage )
.Visibility( this, &SToolBarButtonBlock::GetIconVisibility, true )
.Image( this, &SToolBarButtonBlock::GetSmallIconBrush );
// Create the content for our button
TSharedRef< SWidget > ButtonContent =
SNew(SHorizontalBox)
.AddMetaData<FTagMetaData>(FTagMetaData(TutorialHighlightName))
+ SHorizontalBox::Slot()
.FillWidth(1)
.VAlign(VAlign_Center)
[
SNew( SVerticalBox )
// Icon image
+ SVerticalBox::Slot()
.AutoHeight()
.HAlign( HAlign_Center ) // Center the icon horizontally, so that large labels don't stretch out the artwork
[
IconWidget
]
+ SVerticalBox::Slot().AutoHeight()
.HAlign( HAlign_Center )
[
SmallIconWidget
]
// Label text
+ SVerticalBox::Slot().AutoHeight()
.HAlign( HAlign_Center ) // Center the label text horizontally
[
SNew( STextBlock )
//.........这里部分代码省略.........
示例5: BlockAdded
void FMultiBoxCustomizationData::BlockAdded( TSharedRef< const FMultiBlock > AddedBlock, int32 Index, const TArray< TSharedRef< const FMultiBlock > >& AllBlocks )
{
FCustomBlockTransaction Add = FCustomBlockTransaction::CreateAdd( AddedBlock->GetAction().ToSharedRef(), Index );
SaveTransaction( Add, AllBlocks );
}