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


C++ FMenuBuilder::MakeWidget方法代码示例

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


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

示例1: MenuBuilder

TSharedRef<SWidget> FMainMenu::MakeMainMenu( const TSharedPtr<FTabManager>& TabManager, const TSharedRef< FExtender > Extender )
{
#define LOCTEXT_NAMESPACE "MainMenu"

	// Cache all project names once
	FMainFrameActionCallbacks::CacheProjectNames();

	FMenuBarBuilder MenuBuilder(FMainFrameCommands::ActionList, Extender);
	{
		// File
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("FileMenu", "File"),
			LOCTEXT("FileMenu_ToolTip", "Open the file menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillFileMenu, Extender),
			"File",
			FName(TEXT("FileMenu"))
		);

		// Edit
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("EditMenu", "Edit"),
			LOCTEXT("EditMenu_ToolTip", "Open the edit menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillEditMenu, Extender, TabManager),
			"Edit"
		);

		// Window
		MenuBuilder.AddPullDownMenu(
			LOCTEXT("WindowMenu", "Window"),
			LOCTEXT("WindowMenu_ToolTip", "Open new windows or tabs."),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillWindowMenu, Extender, TabManager),
			"Window"
		);

		// Help
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("HelpMenu", "Help"),
			LOCTEXT("HelpMenu_ToolTip", "Open the help menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillHelpMenu, Extender),
			"Help"
		);
	}

	// Create the menu bar!
	TSharedRef<SWidget> MenuBarWidget = MenuBuilder.MakeWidget();

	return MenuBarWidget;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:48,代码来源:MainMenu.cpp

示例2: MenuBuilder

TSharedRef<SWidget> FMainMenu::MakeMainMenu(const TSharedPtr<FTabManager>& TabManager, const TSharedRef< FExtender > Extender)
{
#define LOCTEXT_NAMESPACE "MainMenu"

	
	// Put the toolbox into our menus
	{
		const IWorkspaceMenuStructure& MenuStructure = WorkspaceMenu::GetMenuStructure();
		IToolboxModule& ToolboxModule = FModuleManager::LoadModuleChecked<IToolboxModule>("Toolbox");
		ToolboxModule.RegisterSpawners(MenuStructure.GetDeveloperToolsDebugCategory(), MenuStructure.GetDeveloperToolsMiscCategory());
	}

	// Cache all project names once
	FMainFrameActionCallbacks::CacheProjectNames();

	FMenuBarBuilder MenuBuilder(FMainFrameCommands::ActionList, Extender);
	{
		// File
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("FileMenu", "File"),
			LOCTEXT("FileMenu_ToolTip", "Open the file menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillFileMenu, Extender),
			"File",
			FName(TEXT("FileMenu"))
		);

		// Edit
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("EditMenu", "Edit"),
			LOCTEXT("EditMenu_ToolTip", "Open the edit menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillEditMenu, Extender, TabManager),
			"Edit"
			,
			FName(TEXT("EditMenu"))
		);

		// Window
		MenuBuilder.AddPullDownMenu(
			LOCTEXT("WindowMenu", "Window"),
			LOCTEXT("WindowMenu_ToolTip", "Open new windows or tabs."),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillWindowMenu, Extender, TabManager),
			"Window"
		);

		// Help
		MenuBuilder.AddPullDownMenu( 
			LOCTEXT("HelpMenu", "Help"),
			LOCTEXT("HelpMenu_ToolTip", "Open the help menu"),
			FNewMenuDelegate::CreateStatic(&FMainMenu::FillHelpMenu, Extender),
			"Help"
		);
	}

	// Create the menu bar!
	TSharedRef<SWidget> MenuBarWidget = MenuBuilder.MakeWidget();

	// Tell tab-manager about the multi-box for platforms with a global menu bar
	TabManager->SetMenuMultiBox(MenuBuilder.GetMultiBox());
	
	return MenuBarWidget;
}
开发者ID:johndpope,项目名称:UE4,代码行数:61,代码来源:MainMenu.cpp


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