本文整理汇总了C++中TSharedPtr::AddMenuBarExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::AddMenuBarExtension方法的具体用法?C++ TSharedPtr::AddMenuBarExtension怎么用?C++ TSharedPtr::AddMenuBarExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::AddMenuBarExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupTranslationEditorMenu
void FTranslationEditorMenu::SetupTranslationEditorMenu( TSharedPtr< FExtender > Extender, FTranslationEditor& TranslationEditor)
{
// Add additional editor menu
{
struct Local
{
static void AddSaveMenuOption( FMenuBuilder& MenuBuilder )
{
MenuBuilder.AddMenuEntry( FTranslationEditorCommands::Get().SaveTranslations, "SaveTranslations", TAttribute<FText>(), TAttribute<FText>(), FSlateIcon(FEditorStyle::GetStyleSetName(), "AssetEditor.SaveAsset.Greyscale") );
}
static void AddTranslationEditorMenu( FMenuBarBuilder& MenuBarBuilder )
{
// View
MenuBarBuilder.AddPullDownMenu(
LOCTEXT("TranslationMenu", "Translation"),
LOCTEXT("TranslationMenu_ToolTip", "Open the Translation menu"),
FNewMenuDelegate::CreateStatic( &FTranslationEditorMenu::FillTranslationMenu ),
"View");
}
};
Extender->AddMenuExtension(
"FileLoadAndSave",
EExtensionHook::First,
TranslationEditor.GetToolkitCommands(),
FMenuExtensionDelegate::CreateStatic( &Local::AddSaveMenuOption ) );
Extender->AddMenuBarExtension(
"Edit",
EExtensionHook::After,
TranslationEditor.GetToolkitCommands(),
FMenuBarExtensionDelegate::CreateStatic( &Local::AddTranslationEditorMenu ) );
}
}
示例2: SetupInitialContent
void SStandaloneAssetEditorToolkitHost::SetupInitialContent( const TSharedRef<FTabManager::FLayout>& DefaultLayout, const TSharedPtr<SDockTab>& InHostTab, const bool bCreateDefaultStandaloneMenu )
{
// @todo toolkit major: Expose common asset editing features here! (or require the asset editor's content to do this itself!)
// - Add a "toolkit menu"
// - Toolkits can access this and add menu items as needed
// - In world-centric, main frame menu becomes extendable
// - e.g., "Blueprint", "Debug" menus added
// - In standalone, toolkits get their own menu
// - Also, the core menu is just added as the first pull-down in the standalone menu
// - Multiple toolkits can be active and add their own menu items!
// - In world-centric, the core toolkit menu is available from the drop down
// - No longer need drop down next to toolkit display? Not sure... Probably still want this
// - Add a "toolkit toolbar"
// - In world-centric, draws next to the level editor tool bar (or on top of)
// - Could either extend existing tool bar or add additional tool bars
// - May need to change arrangement to allow for wider tool bars (maybe displace grid settings too)
// - In standalone, just draws under the toolkit's menu
if (bCreateDefaultStandaloneMenu)
{
struct Local
{
static void FillFileMenu( FMenuBuilder& MenuBuilder, TWeakPtr< FAssetEditorToolkit > AssetEditorToolkitWeak )
{
auto AssetEditorToolkit( AssetEditorToolkitWeak.Pin().ToSharedRef() );
AssetEditorToolkit->FillDefaultFileMenuCommands( MenuBuilder );
}
static void AddAssetMenu( FMenuBarBuilder& MenuBarBuilder, TWeakPtr< FAssetEditorToolkit > AssetEditorToolkitWeak )
{
MenuBarBuilder.AddPullDownMenu(
LOCTEXT("AssetMenuLabel", "Asset"), // @todo toolkit major: Either use "Asset", "File", or the asset type name e.g. "Blueprint" (Also update custom pull-down menus)
LOCTEXT("AssetMenuLabel_ToolTip", "Opens a menu with commands for managing this asset"),
FNewMenuDelegate::CreateStatic( &Local::FillAssetMenu, AssetEditorToolkitWeak ),
"Asset");
auto AssetEditorToolkit( AssetEditorToolkitWeak.Pin().ToSharedRef() );
}
static void FillAssetMenu( FMenuBuilder& MenuBuilder, TWeakPtr< FAssetEditorToolkit > AssetEditorToolkitWeak )
{
auto AssetEditorToolkit( AssetEditorToolkitWeak.Pin().ToSharedRef() );
MenuBuilder.BeginSection("AssetEditorActions", LOCTEXT("ActionsHeading", "Actions") );
{
AssetEditorToolkit->FillDefaultAssetMenuCommands( MenuBuilder );
}
MenuBuilder.EndSection();
}
static void ExtendHelpMenu( FMenuBuilder& MenuBuilder, TWeakPtr< FAssetEditorToolkit > AssetEditorToolkitWeak )
{
auto AssetEditorToolkit( AssetEditorToolkitWeak.Pin().ToSharedRef() );
MenuBuilder.BeginSection("HelpBrowse", NSLOCTEXT("MainHelpMenu", "Browse", "Browse"));
{
AssetEditorToolkit->FillDefaultHelpMenuCommands( MenuBuilder );
}
MenuBuilder.EndSection();
}
};
TSharedPtr<FExtender> MenuExtender = MakeShareable(new FExtender());
auto AssetEditorToolkit = HostedAssetEditorToolkit.ToSharedRef();
// Add asset-specific menu items to the top of the "File" menu
MenuExtender->AddMenuExtension( "FileLoadAndSave", EExtensionHook::First, AssetEditorToolkit->GetToolkitCommands(), FMenuExtensionDelegate::CreateStatic( &Local::FillFileMenu, TWeakPtr< FAssetEditorToolkit >( AssetEditorToolkit ) ) );
// Add the "Asset" menu, if we're editing an asset
if (AssetEditorToolkit->IsActuallyAnAsset())
{
MenuExtender->AddMenuBarExtension( "Edit", EExtensionHook::After, AssetEditorToolkit->GetToolkitCommands(), FMenuBarExtensionDelegate::CreateStatic( &Local::AddAssetMenu, TWeakPtr< FAssetEditorToolkit >( AssetEditorToolkit ) ) );
}
MenuExtender->AddMenuExtension( "HelpOnline", EExtensionHook::Before, AssetEditorToolkit->GetToolkitCommands(), FMenuExtensionDelegate::CreateStatic( &Local::ExtendHelpMenu, TWeakPtr< FAssetEditorToolkit >( AssetEditorToolkit ) ) );
MenuExtenders.Add(MenuExtender);
}
DefaultMenuWidget = SNullWidget::NullWidget;
HostTabPtr = InHostTab;
RestoreFromLayout(DefaultLayout);
GenerateMenus(bCreateDefaultStandaloneMenu);
}