TSharedRef<SWidget> SDistributionCurveEditor::BuildMenuWidgetCurve() { const bool bShouldCloseWindowAfterMenuSelection = true; // Set the menu to automatically close when the user commits to a choice FMenuBuilder MenuBuilder(bShouldCloseWindowAfterMenuSelection, UICommandList); { MenuBuilder.BeginSection("AllCurvesSection", LOCTEXT("AllCurvesMenuHeader", "All Curves")); { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().ScaleTimes); MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().ScaleValues); } MenuBuilder.EndSection(); MenuBuilder.BeginSection("CurrentCurveSection", LOCTEXT("CurrentCurveMenuHeader", "Current Curve")); { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().ScaleSingleCurveTimes); MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().ScaleSingleCurveValues); } MenuBuilder.EndSection(); MenuBuilder.BeginSection("SubCurveSection", LOCTEXT("SubCurveMenuHeader", "Sub-Curve")); { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().ScaleSingleSubCurveValues); } MenuBuilder.EndSection(); } return MenuBuilder.MakeWidget(); }
TSharedPtr<SWidget> FLightmapCustomNodeBuilder::OnGetLightMapContextMenuContent() { TArray<TSharedPtr<FLightmapItem>> SelectedLightmaps = LightmapListView->GetSelectedItems(); TSharedPtr<FLightmapItem> SelectedLightmap; if ( SelectedLightmaps.Num() > 0 ) { SelectedLightmap = SelectedLightmaps[0]; } if ( SelectedLightmap.IsValid() ) { FMenuBuilder MenuBuilder(/*bInShouldCloseWindowAfterMenuSelection=*/true, NULL); MenuBuilder.BeginSection("LightMapsContextMenuSection", LOCTEXT("LightMapsContextMenuHeading", "Options") ); { MenuBuilder.AddMenuEntry( LOCTEXT("ViewLightmapLabel", "View"), LOCTEXT("ViewLightmapTooltip", "Opens the texture editor with this lightmap."), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &FLightmapCustomNodeBuilder::ExecuteViewLightmap, SelectedLightmap->ObjectPath)) ); } MenuBuilder.EndSection(); //LightMapsContextMenuSection return MenuBuilder.MakeWidget(); } return NULL; }
TSharedRef< SWidget > SProfileVisualizer::MakeMainMenu() { FMenuBarBuilder MenuBuilder( NULL ); { // File MenuBuilder.AddPullDownMenu( NSLOCTEXT("TaskGraph", "FileMenu", "File"), NSLOCTEXT("TaskGraph", "FileMenu_ToolTip", "Open the file menu"), FNewMenuDelegate::CreateSP( this, &SProfileVisualizer::FillFileMenu ) ); // Apps MenuBuilder.AddPullDownMenu( NSLOCTEXT("TaskGraph", "AppMenu", "Window"), NSLOCTEXT("TaskGraph", "AppMenu_ToolTip", "Open the summoning menu"), FNewMenuDelegate::CreateSP( this, &SProfileVisualizer::FillAppMenu ) ); // Help MenuBuilder.AddPullDownMenu( NSLOCTEXT("TaskGraph", "HelpMenu", "Help"), NSLOCTEXT("TaskGraph", "HelpMenu_ToolTip", "Open the help menu"), FNewMenuDelegate::CreateSP( this, &SProfileVisualizer::FillHelpMenu ) ); } // Create the menu bar TSharedRef< SWidget > MenuBarWidget = MenuBuilder.MakeWidget(); return MenuBarWidget; }
TSharedRef<SWidget> SVisualLoggerTimelinesContainer::GetRightClickMenuContent() { FMenuBuilder MenuBuilder(true, NULL); MenuBuilder.BeginSection("VisualLogReports", LOCTEXT("VisualLogReports", "VisualLog Reports")); { MenuBuilder.AddMenuEntry( LOCTEXT("GenarateReport", "Genarate Report"), LOCTEXT("GenarateReportTooltip", "Genarate report from Visual Log events."), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SVisualLoggerTimelinesContainer::GenerateReport)) ); } MenuBuilder.EndSection(); FDisplayMetrics DisplayMetrics; FSlateApplication::Get().GetDisplayMetrics(DisplayMetrics); const FVector2D DisplaySize( DisplayMetrics.PrimaryDisplayWorkAreaRect.Right - DisplayMetrics.PrimaryDisplayWorkAreaRect.Left, DisplayMetrics.PrimaryDisplayWorkAreaRect.Bottom - DisplayMetrics.PrimaryDisplayWorkAreaRect.Top); return SNew(SVerticalBox) + SVerticalBox::Slot() .MaxHeight(DisplaySize.Y * 0.5) [ MenuBuilder.MakeWidget() ]; }
TSharedRef<SWidget> SSequencerCurveEditorToolBar::MakeCurveEditorViewOptionsMenu(TSharedPtr<FUICommandList> CurveEditorCommandList) { FMenuBuilder MenuBuilder( true, CurveEditorCommandList ); MenuBuilder.BeginSection( "CurveVisibility", LOCTEXT( "CurveEditorMenuCurveVisibilityHeader", "Curve Visibility" ) ); { MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetAllCurveVisibility ); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetSelectedCurveVisibility ); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetAnimatedCurveVisibility ); } MenuBuilder.EndSection(); MenuBuilder.BeginSection( "TangentVisibility", LOCTEXT( "CurveEditorMenuTangentVisibilityHeader", "Tangent Visibility" ) ); { MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetAllTangentsVisibility ); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetSelectedKeysTangentVisibility ); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().SetNoTangentsVisibility ); } MenuBuilder.EndSection(); MenuBuilder.AddMenuSeparator(); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().ToggleAutoFrameCurveEditor); MenuBuilder.AddMenuEntry( FRichCurveEditorCommands::Get().ToggleShowCurveEditorCurveToolTips); return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SFilterWidget::GetRightClickMenuContent() { FMenuBuilder MenuBuilder(true, NULL); if (IsEnabled()) { FText FiletNameAsText = FText::FromString(GetFilterNameAsString()); MenuBuilder.BeginSection("VerbositySelection", LOCTEXT("VerbositySelection", "Current verbosity selection")); { for (int32 Index = ELogVerbosity::NoLogging + 1; Index <= ELogVerbosity::VeryVerbose; Index++) { const FString VerbosityStr = FOutputDevice::VerbosityToString((ELogVerbosity::Type)Index); MenuBuilder.AddMenuEntry( FText::Format(LOCTEXT("UseVerbosity", "Use: {0}"), FText::FromString(VerbosityStr)), LOCTEXT("UseVerbosityTooltip", "Applay verbosity to selected flter."), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SFilterWidget::SetVerbosityFilter, Index)) ); } } MenuBuilder.EndSection(); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> STextureEditorViewportToolbar::GenerateViewOptionsMenu( ) const { FMenuBuilder MenuBuilder(true, ToolkitCommands); FTextureEditorViewOptionsMenu::MakeMenu(MenuBuilder); return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FCameraDetails::OnGetComboContent() const { // Fill the combo menu with presets of common screen resolutions FMenuBuilder MenuBuilder(true, NULL); TArray<FText> Items; Items.Add(LOCTEXT("PresetRatio640x480", "640x480 (4:3, 1.33) SDTV")); Items.Add(LOCTEXT("PresetRatio852x480", "852x480 (16:9, 1.78) SDTV Widescreen")); Items.Add(LOCTEXT("PresetRatio1280x720", "1280x720 (16:9, 1.78) HDTV 720")); Items.Add(LOCTEXT("PresetRatio1920x1080", "1920x1080 (16:9, 1.78) HDTV 1080")); Items.Add(LOCTEXT("PresetRatio960x544", "960x544 (16:9, 1.76) PS Vita")); Items.Add(LOCTEXT("PresetRatio1024x640", "1024x640 (1.6)")); Items.Add(LOCTEXT("PresetRatio1024x76", "1024x768 (4:3, 1.33)")); Items.Add(LOCTEXT("PresetRatio1366x768", "1366x768 (16:9, 1.78)")); Items.Add(LOCTEXT("PresetRatio2048x1536", "2048x1536 (4:3, 1.33) iPad 3")); Items.Add(LOCTEXT("PresetRatio4096x2304", "4096x2304 (16:9, 1.78) 4K")); for (auto ItemIter = Items.CreateConstIterator(); ItemIter; ++ItemIter) { FText ItemText = *ItemIter; FUIAction ItemAction( FExecuteAction::CreateSP( this, &FCameraDetails::CommitAspectRatioText, ItemText ) ); MenuBuilder.AddMenuEntry(ItemText, TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef< SWidget > FLevelEditorToolBar::GenerateCompileMenuContent( TSharedRef<FUICommandList> InCommandList ) { #define LOCTEXT_NAMESPACE "LevelToolBarViewMenu" // Get all menu extenders for this context menu from the level editor module FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>( TEXT("LevelEditor") ); TArray<FLevelEditorModule::FLevelEditorMenuExtender> MenuExtenderDelegates = LevelEditorModule.GetAllLevelEditorToolbarCompileMenuExtenders(); TArray<TSharedPtr<FExtender>> Extenders; for (int32 i = 0; i < MenuExtenderDelegates.Num(); ++i) { if (MenuExtenderDelegates[i].IsBound()) { Extenders.Add(MenuExtenderDelegates[i].Execute(InCommandList)); } } TSharedPtr<FExtender> MenuExtender = FExtender::Combine(Extenders); const bool bShouldCloseWindowAfterMenuSelection = true; FMenuBuilder MenuBuilder( bShouldCloseWindowAfterMenuSelection, InCommandList, MenuExtender ); if (LevelEditorModule.CanBeRecompiled()) { MenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().RecompileLevelEditor ); MenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().ReloadLevelEditor ); } MenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().RecompileGameCode ); #undef LOCTEXT_NAMESPACE return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SDistributionCurveEditor::BuildMenuWidgetKey() { const bool bShouldCloseWindowAfterMenuSelection = true; // Set the menu to automatically close when the user commits to a choice FMenuBuilder MenuBuilder(bShouldCloseWindowAfterMenuSelection, UICommandList); { MenuBuilder.BeginSection("DistributionCurveWidgetKey"); { if(SharedData->SelectedKeys.Num() == 1) { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().SetTime); MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().SetValue); FCurveEditorSelectedKey& SelKey = SharedData->SelectedKeys[0]; FCurveEdEntry& Entry = SharedData->EdSetup->Tabs[SharedData->EdSetup->ActiveTab].Curves[SelKey.CurveIndex]; FCurveEdInterface* EdInterface = UInterpCurveEdSetup::GetCurveEdInterfacePointer(Entry); if(Entry.bColorCurve && EdInterface->GetNumSubCurves() == 3) { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().SetColor); } } } MenuBuilder.EndSection(); MenuBuilder.BeginSection("DistributionCurveWidgetKey2"); { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().DeleteKeys); } MenuBuilder.EndSection(); } return MenuBuilder.MakeWidget(); }
void UJavascriptEditorLibrary::OpenPopupWindow(UWidget* Widget, const FVector2D& PopupDesiredSize, const FText& HeadingText) { // Create the contents of the popup TSharedRef<SWidget> ActualWidget = Widget->TakeWidget(); // Wrap the picker widget in a multibox-style menu body FMenuBuilder MenuBuilder(/*BShouldCloseAfterSelection=*/ false, /*CommandList=*/ nullptr); MenuBuilder.BeginSection("OpenPopupWindow", HeadingText); MenuBuilder.AddWidget(ActualWidget, FText::GetEmpty(), /*bNoIndent=*/ true); MenuBuilder.EndSection(); auto WindowContents = MenuBuilder.MakeWidget(); // Determine where the pop-up should open TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().GetActiveTopLevelWindow(); FVector2D WindowPosition = FSlateApplication::Get().GetCursorPos(); if (!ParentWindow.IsValid()) { return; } if (ParentWindow.IsValid()) { FSlateRect ParentMonitorRect = ParentWindow->GetFullScreenInfo(); const FVector2D MonitorCenter((ParentMonitorRect.Right + ParentMonitorRect.Left) * 0.5f, (ParentMonitorRect.Top + ParentMonitorRect.Bottom) * 0.5f); WindowPosition = MonitorCenter - PopupDesiredSize * 0.5f; // Open the pop-up FPopupTransitionEffect TransitionEffect(FPopupTransitionEffect::None); auto Menu = FSlateApplication::Get().PushMenu(ParentWindow.ToSharedRef(), FWidgetPath(), WindowContents, WindowPosition, TransitionEffect, /*bFocusImmediately=*/ true); } }
void SScrubWidget::CreateContextMenu(float CurrentFrameTime) { if ((OnCropAnimSequence.IsBound() || OnReZeroAnimSequence.IsBound()) && (SequenceLength.Get() >= MINIMUM_ANIMATION_LENGTH)) { const bool CloseAfterSelection = true; FMenuBuilder MenuBuilder( CloseAfterSelection, NULL ); MenuBuilder.BeginSection("SequenceEditingContext", LOCTEXT("SequenceEditing", "Sequence Editing") ); { float CurrentFrameFraction = CurrentFrameTime / SequenceLength.Get(); uint32 CurrentFrameNumber = CurrentFrameFraction * NumOfKeys.Get(); FUIAction Action; FText Label; if (OnCropAnimSequence.IsBound()) { //Menu - "Remove Before" //Only show this option if the selected frame is greater than frame 1 (first frame) if (CurrentFrameNumber > 0) { CurrentFrameFraction = float(CurrentFrameNumber) / (float)NumOfKeys.Get(); //Corrected frame time based on selected frame number float CorrectedFrameTime = CurrentFrameFraction * SequenceLength.Get(); Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnSequenceCropped, true, CorrectedFrameTime)); Label = FText::Format(LOCTEXT("RemoveTillFrame", "Remove frame 0 to frame {0}"), FText::AsNumber(CurrentFrameNumber)); MenuBuilder.AddMenuEntry(Label, LOCTEXT("RemoveBefore_ToolTip", "Remove sequence before current position"), FSlateIcon(), Action); } uint32 NextFrameNumber = CurrentFrameNumber + 1; //Menu - "Remove After" //Only show this option if next frame (CurrentFrameNumber + 1) is valid if (NextFrameNumber < NumOfKeys.Get()) { float NextFrameFraction = float(NextFrameNumber) / (float)NumOfKeys.Get(); float NextFrameTime = NextFrameFraction * SequenceLength.Get(); Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnSequenceCropped, false, NextFrameTime)); Label = FText::Format(LOCTEXT("RemoveFromFrame", "Remove from frame {0} to frame {1}"), FText::AsNumber(NextFrameNumber), FText::AsNumber(NumOfKeys.Get())); MenuBuilder.AddMenuEntry(Label, LOCTEXT("RemoveAfter_ToolTip", "Remove sequence after current position"), FSlateIcon(), Action); } } if (OnReZeroAnimSequence.IsBound()) { //Menu - "ReZero" Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnReZero)); Label = FText::Format(LOCTEXT("ReZeroAtFrame", "ReZero at frame {0}"), FText::AsNumber(CurrentFrameNumber)); MenuBuilder.AddMenuEntry(Label, LOCTEXT("ReZeroAtFrame_ToolTip", "Resets the root track of the frame to (0, 0, 0), and apply the difference to all root transform of the sequence. It moves whole sequence to the amount of current root transform. "), FSlateIcon(), Action); } } MenuBuilder.EndSection(); FSlateApplication::Get().PushMenu( SharedThis( this ), MenuBuilder.MakeWidget(), FSlateApplication::Get().GetCursorPos(), FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu ) ); } }
TSharedPtr<SWidget> FSplineComponentVisualizer::GenerateContextMenu() const { FMenuBuilder MenuBuilder(true, SplineComponentVisualizerActions); { MenuBuilder.BeginSection("SplinePointEdit", LOCTEXT("SplinePoint", "Spline Point")); { if (SelectedSegmentIndex != INDEX_NONE) { MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().AddKey); } else if (LastKeyIndexSelected != INDEX_NONE) { MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().DeleteKey); MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().DuplicateKey); MenuBuilder.AddSubMenu( LOCTEXT("SplinePointType", "Spline Point Type"), LOCTEXT("KeyTypeTooltip", "Define the type of the spline point."), FNewMenuDelegate::CreateSP(this, &FSplineComponentVisualizer::GenerateSplinePointTypeSubMenu)); // Only add the Automatic Tangents submenu if any of the keys is a curve type USplineComponent* SplineComp = GetEditedSplineComponent(); if (SplineComp != nullptr) { for (int32 SelectedKeyIndex : SelectedKeys) { const auto& Point = SplineComp->SplineInfo.Points[SelectedKeyIndex]; if (Point.IsCurveKey()) { MenuBuilder.AddSubMenu( LOCTEXT("ResetToAutomaticTangent", "Reset to Automatic Tangent"), LOCTEXT("ResetToAutomaticTangentTooltip", "Reset the spline point tangent to an automatically generated value."), FNewMenuDelegate::CreateSP(this, &FSplineComponentVisualizer::GenerateTangentTypeSubMenu)); break; } } } } } MenuBuilder.EndSection(); MenuBuilder.BeginSection("Spline", LOCTEXT("Spline", "Spline")); { MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().ResetToDefault); } MenuBuilder.EndSection(); MenuBuilder.BeginSection("Visualization", LOCTEXT("Visualization", "Visualization")); { MenuBuilder.AddMenuEntry(FSplineComponentVisualizerCommands::Get().VisualizeRollAndScale); } MenuBuilder.EndSection(); } TSharedPtr<SWidget> MenuWidget = MenuBuilder.MakeWidget(); return MenuWidget; }
TSharedRef< SWidget > SRealtimeProfilerVisualizer::MakeMainMenu() { FMenuBarBuilder MenuBuilder( NULL ); // Create the menu bar TSharedRef< SWidget > MenuBarWidget = MenuBuilder.MakeWidget(); return MenuBarWidget; }
TSharedPtr<SWidget> SHierarchyView::WidgetHierarchy_OnContextMenuOpening() { FMenuBuilder MenuBuilder(true, nullptr); FWidgetBlueprintEditorUtils::CreateWidgetContextMenu(MenuBuilder, BlueprintEditor.Pin().ToSharedRef(), FVector2D(0, 0)); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Rename); return MenuBuilder.MakeWidget(); }
// NOTE: We intentionally receive a WEAK pointer here because we want to be callable by a delegate whose // payload contains a weak reference to a level editor instance TSharedPtr< SWidget > FLevelEditorContextMenu::BuildMenuWidget( TWeakPtr< SLevelEditor > LevelEditor, LevelEditorMenuContext ContextType, TSharedPtr<FExtender> Extender ) { // Build up the menu const bool bShouldCloseWindowAfterMenuSelection = true; FMenuBuilder MenuBuilder(bShouldCloseWindowAfterMenuSelection, TSharedPtr<const FUICommandList>()); FillMenu(MenuBuilder, LevelEditor, ContextType, Extender); return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SProfileVisualizer::MakeBarVisualizerContextMenu() { const bool bCloseAfterSelection = true; FMenuBuilder MenuBuilder( bCloseAfterSelection, NULL ); { FUIAction Action( FExecuteAction::CreateSP( this, &SProfileVisualizer::ShowGraphBarInEventsWindow, (int32)INDEX_NONE ) ); MenuBuilder.AddMenuEntry( NSLOCTEXT("TaskGraph", "GraphBarShowInNew", "Show in New Events Window"), FText::GetEmpty(), FSlateIcon(), Action, NAME_None, EUserInterfaceActionType::Button ); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SDistributionCurveEditor::BuildMenuWidgetLabel() { const bool bShouldCloseWindowAfterMenuSelection = true; // Set the menu to automatically close when the user commits to a choice FMenuBuilder MenuBuilder(bShouldCloseWindowAfterMenuSelection, UICommandList); { MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().RemoveCurve); MenuBuilder.AddMenuEntry(FCurveEditorCommands::Get().RemoveAllCurves); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FEnvTraceDataCustomization::OnGetTraceModeContent() { FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < TraceModes.Num(); i++) { FUIAction ItemAction( FExecuteAction::CreateSP( this, &FEnvTraceDataCustomization::OnTraceModeChanged, TraceModes[i].Int ) ); MenuBuilder.AddMenuEntry( TraceModes[i].Text, TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FBlackboardDecoratorDetails::OnGetEnumValueContent() const { FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < EnumPropValues.Num(); i++) { FUIAction ItemAction( FExecuteAction::CreateSP( this, &FBlackboardDecoratorDetails::OnEnumValueComboChange, i ) ); MenuBuilder.AddMenuEntry( FText::FromString( EnumPropValues[i] ), TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FBehaviorDecoratorDetails::OnGetAbortModeContent() const { FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < ModeValues.Num(); i++) { FUIAction ItemAction( FExecuteAction::CreateSP( this, &FBehaviorDecoratorDetails::OnAbortModeChange, ModeValues[i].Int ) ); MenuBuilder.AddMenuEntry(FText::FromString( ModeValues[i].Str ), TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FBlackboardSelectorDetails::OnGetKeyContent() const { FMenuBuilder MenuBuilder(true, NULL); for (int32 Idx = 0; Idx < KeyValues.Num(); Idx++) { FUIAction ItemAction( FExecuteAction::CreateSP( this, &FBlackboardSelectorDetails::OnKeyComboChange, Idx) ); MenuBuilder.AddMenuEntry( FText::FromName( KeyValues[Idx] ), TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FAIDataProviderValueDetails::OnGetDataFieldContent() { FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < MatchingProperties.Num(); i++) { FUIAction ItemAction(FExecuteAction::CreateSP(this, &FAIDataProviderValueDetails::OnDataFieldNameChange, i)); MenuBuilder.AddMenuEntry(FText::FromName(MatchingProperties[i]), TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FCookerStatsPage::HandleFilterComboButtonGetMenuContent( ) const { // visitor for the directory enumerator class FCookedDirectoryVisitor : public IPlatformFile::FDirectoryVisitor { public: FCookedDirectoryVisitor( const FCookerStatsPage& InCookerStatsPage, FMenuBuilder& InMenuBuilder ) : CookerStatsPage(InCookerStatsPage) , MenuBuilder(InMenuBuilder) { } virtual bool Visit( const TCHAR* FilenameOrDirectory, bool bIsDirectory ) override { if (bIsDirectory) { FString PlatformName = FPaths::GetBaseFilename(FilenameOrDirectory); MenuBuilder.AddMenuEntry( FText::FromString(PlatformName), FText::FromString(PlatformName), FSlateIcon(), FUIAction( FExecuteAction::CreateRaw(&CookerStatsPage, &FCookerStatsPage::HandleFilterMenuEntryExecute, PlatformName), FCanExecuteAction(), FIsActionChecked::CreateRaw(&CookerStatsPage, &FCookerStatsPage::HandleFilterMenuEntryIsChecked, PlatformName) ), NAME_None, EUserInterfaceActionType::RadioButton ); } return true; } private: const FCookerStatsPage& CookerStatsPage; FMenuBuilder& MenuBuilder; }; // create menu entries for each cooked directory FMenuBuilder MenuBuilder(true, nullptr); { FCookedDirectoryVisitor CookedDirectoryVisitor(*this, MenuBuilder); FPlatformFileManager::Get().GetPlatformFile().IterateDirectory(*(FPaths::GameSavedDir() / TEXT("Cooked")), CookedDirectoryVisitor); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FEnvQueryTestDetails::OnGetClampMaxTypeContent() { BuildScoreClampingTypeValues(false, ClampMaxTypeValues); FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < ClampMaxTypeValues.Num(); i++) { FUIAction ItemAction(FExecuteAction::CreateSP(this, &FEnvQueryTestDetails::OnClampMaxTestChange, ClampMaxTypeValues[i].Int)); MenuBuilder.AddMenuEntry(ClampMaxTypeValues[i].Text, TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> FEnvQueryTestDetails::OnGetEquationValuesContent() { BuildScoreEquationValues(); FMenuBuilder MenuBuilder(true, NULL); for (int32 i = 0; i < ScoreEquationValues.Num(); i++) { FUIAction ItemAction(FExecuteAction::CreateSP(this, &FEnvQueryTestDetails::OnScoreEquationChange, ScoreEquationValues[i].Int)); MenuBuilder.AddMenuEntry(ScoreEquationValues[i].Text, TAttribute<FText>(), FSlateIcon(), ItemAction); } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SVisualLoggerFilters::MakeGraphsFilterMenu() { FMenuBuilder MenuBuilder(true, NULL); MenuBuilder.BeginSection(TEXT("Graphs")); { TSharedRef<SSearchBox> FiltersSearchBox = SNew(SSearchBox) .InitialText(FText::FromString(GraphsFilter)) .HintText(LOCTEXT("GraphsFilterSearchHint", "Quick filter")) .OnTextChanged(this, &SVisualLoggerFilters::OnSearchChanged); MenuBuilder.AddWidget(FiltersSearchBox, LOCTEXT("FiltersSearchMenuWidget", "")); for (auto Iter = GraphFilters.CreateIterator(); Iter; ++Iter) { const FText& LabelText = FText::FromString(Iter->Key.ToString()); MenuBuilder.AddSubMenu( LabelText, FText::Format(LOCTEXT("FilterByTooltipPrefix", "Filter by {0}"), LabelText), FNewMenuDelegate::CreateSP(this, &SVisualLoggerFilters::CreateFiltersMenuCategoryForGraph, Iter->Key), FUIAction( FExecuteAction::CreateSP(this, &SVisualLoggerFilters::GraphFilterCategoryClicked, Iter->Key), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SVisualLoggerFilters::IsGraphFilterCategoryInUse, Iter->Key), FIsActionButtonVisible::CreateLambda([this, LabelText]()->bool{return GraphSubmenuVisibility(*LabelText.ToString()); }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); } } MenuBuilder.EndSection(); //ContentBrowserFilterBasicAsset FDisplayMetrics DisplayMetrics; FSlateApplication::Get().GetDisplayMetrics(DisplayMetrics); const FVector2D DisplaySize( DisplayMetrics.PrimaryDisplayWorkAreaRect.Right - DisplayMetrics.PrimaryDisplayWorkAreaRect.Left, DisplayMetrics.PrimaryDisplayWorkAreaRect.Bottom - DisplayMetrics.PrimaryDisplayWorkAreaRect.Top); return SNew(SVerticalBox) + SVerticalBox::Slot() .MaxHeight(DisplaySize.Y * 0.5) [ MenuBuilder.MakeWidget() ]; }
TSharedRef<SWidget> SMultiBoxWidget::OnWrapButtonClicked() { FMenuBuilder MenuBuilder(true, NULL, TSharedPtr<FExtender>(), false, GetStyleSet()); { // Iterate through the array of blocks telling each one to add itself to the menu const TArray< TSharedRef< const FMultiBlock > >& Blocks = MultiBox->GetBlocks(); for (int32 BlockIdx = ClippedHorizontalBox->GetClippedIndex(); BlockIdx < Blocks.Num(); ++BlockIdx) { Blocks[BlockIdx]->CreateMenuEntry(MenuBuilder); } } return MenuBuilder.MakeWidget(); }
TSharedRef<SWidget> SFlipbookTimeline::GenerateContextMenu() { FMenuBuilder MenuBuilder(true, CommandList); MenuBuilder.BeginSection("KeyframeActions", LOCTEXT("KeyframeActionsSectionHeader", "Keyframe Actions")); // MenuBuilder.AddMenuEntry(FGenericCommands::Get().Cut); // MenuBuilder.AddMenuEntry(FGenericCommands::Get().Copy); // MenuBuilder.AddMenuEntry(FGenericCommands::Get().Paste); MenuBuilder.AddMenuEntry(FFlipbookEditorCommands::Get().AddNewFrame); MenuBuilder.EndSection(); return MenuBuilder.MakeWidget(); }
TSharedPtr<SWidget> SSequencerLabelBrowser::HandleLabelTreeViewContextMenuOpening() { FMenuBuilder MenuBuilder(true /*bInShouldCloseWindowAfterMenuSelection*/, nullptr); { MenuBuilder.BeginSection("Edit", LOCTEXT("EditContextMenuSectionName", "Edit")); { MenuBuilder.AddMenuEntry( LOCTEXT("RemoveLabelMenuEntryLabel", "Remove"), LOCTEXT("RemoveLabelMenuEntryTip", "Remove this label from this list and all tracks"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP(this, &SSequencerLabelBrowser::HandleRemoveLabelMenuEntryExecute), FCanExecuteAction::CreateSP(this, &SSequencerLabelBrowser::HandleRemoveLabelMenuEntryCanExecute) ) ); MenuBuilder.AddMenuEntry( LOCTEXT("RenameLabelMenuEntryLabel", "Rename"), LOCTEXT("RenameLabelMenuEntryTip", "Change the name of this label"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP(this, &SSequencerLabelBrowser::HandleRenameLabelMenuEntryExecute), FCanExecuteAction::CreateSP(this, &SSequencerLabelBrowser::HandleRenameLabelMenuEntryCanExecute) ) ); } MenuBuilder.EndSection(); } return MenuBuilder.MakeWidget(); }