本文整理汇总了C++中FMenuBuilder::GetStyleSet方法的典型用法代码示例。如果您正苦于以下问题:C++ FMenuBuilder::GetStyleSet方法的具体用法?C++ FMenuBuilder::GetStyleSet怎么用?C++ FMenuBuilder::GetStyleSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FMenuBuilder
的用法示例。
在下文中一共展示了FMenuBuilder::GetStyleSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildProfilesSubMenu
/**
* Takes the provided menu builder and adds elements representing various
* profiles that the user can choose from (default, tutorial, etc.).
*
* @param MenuBuilder The builder to modify and add entries to.
*/
static void BuildProfilesSubMenu(FMenuBuilder& MenuBuilder)
{
TArray<FString> AvailableProfiles;
const UEditorPerProjectUserSettings* EditorPerProjectUserSettings = GetDefault<UEditorPerProjectUserSettings>();
if (EditorPerProjectUserSettings->BlueprintFavorites != NULL)
{
static FString const ProfilesConfigKey("Profiles");
GConfig->GetArray(*SBlueprintFavoritesPaletteUtils::ConfigSection, *ProfilesConfigKey, AvailableProfiles, GEditorIni);
}
struct LocalUtils
{
static bool CanExecute() { return true; }
static bool CannotExecute() { return false; }
static void NavigateToURL(FString URL) { FPlatformProcess::LaunchURL(*URL, NULL, NULL); }
};
if (AvailableProfiles.Num() > 0)
{
for (FString const& Profile : AvailableProfiles)
{
FString ProfileName;
FParse::Value(*Profile, TEXT("Name="), ProfileName);
FString FriendlyProfileName;
FParse::Value(*Profile, TEXT("FriendlyName="), FriendlyProfileName);
FString ProfileToolTip;
FParse::Value(*Profile, TEXT("ToolTip="), ProfileToolTip);
FString ProfileURL;
FParse::Value(*Profile, TEXT("URL="), ProfileURL);
FString ProfileURLName;
FParse::Value(*Profile, TEXT("URLText="), ProfileURLName);
// @TODO how to best localize this?
FText ToolTipText = FText::FromString(ProfileToolTip);
if (ProfileURLName.IsEmpty())
{
ProfileURLName = ProfileURL;
}
if (FriendlyProfileName.IsEmpty())
{
FriendlyProfileName = ProfileName;
}
FUIAction ProfileAction;
if (SBlueprintFavoritesPaletteUtils::CanLoadFavoritesProfile(ProfileName))
{
if (ToolTipText.IsEmpty())
{
ToolTipText = FText::Format(LOCTEXT("ProfileAvailableFmt", "Loads {0} node favorites"), FText::FromString(FriendlyProfileName));
}
ProfileAction = FUIAction(
FExecuteAction::CreateStatic(&SBlueprintFavoritesPaletteUtils::LoadFavoritesProfile, ProfileName),
FCanExecuteAction::CreateStatic(&LocalUtils::CanExecute)
);
}
else
{
if (ToolTipText.IsEmpty())
{
ToolTipText = LOCTEXT("ProfileLoaded", "Current profile");
}
ProfileAction = FUIAction(
FExecuteAction(),
FCanExecuteAction::CreateStatic(&LocalUtils::CannotExecute)
);
}
// build the text that goes in the sub-menu
TSharedRef<STextBlock> MenuTextEntry = SNew(STextBlock)
.TextStyle(MenuBuilder.GetStyleSet(), FEditorStyle::Join("Menu", ".Label"))
// @TODO how do we best localize this
.Text(FText::FromString(FriendlyProfileName));
FSlateFontInfo ToolTipFont(FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 8);
TSharedPtr<SVerticalBox> ToolTipBox;
// build the specialized tooltip
TSharedRef<SToolTip> ToolTipWidget = SNew(SToolTip)
[
SAssignNew(ToolTipBox, SVerticalBox)
+SVerticalBox::Slot()
[
SNew(STextBlock)
.WrapTextAt(400)
.Font(ToolTipFont)
.Text(ToolTipText)
]
];
// add the url if one was specified
if (!ProfileURL.IsEmpty())
//.........这里部分代码省略.........