Files
UnrealEngineUWP/Engine/Source/Editor/UnrealEd/Private/SEditorViewportToolBarMenuButton.cpp
Marc Audy 0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00

35 lines
986 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SEditorViewportToolBarMenuButton.h"
#include "Widgets/Input/SMenuAnchor.h"
void SEditorViewportToolBarMenuButton::Construct(const FArguments& InArgs, TSharedRef<SMenuAnchor> InMenuAnchor)
{
SButton::Construct(SButton::FArguments()
// Allows users to drag with the mouse to select options after opening the menu
.ClickMethod(EButtonClickMethod::MouseDown)
.OnClicked(InArgs._OnClicked)
.ForegroundColor(InArgs._ForegroundColor)
.HAlign(InArgs._HAlign)
.VAlign(InArgs._VAlign)
.ContentPadding(InArgs._ContentPadding)
.ButtonStyle(InArgs._ButtonStyle)
[
InArgs._Content.Widget
]
);
SetAppearPressed(TAttribute<bool>::CreateSP(this, &SEditorViewportToolBarMenuButton::IsMenuOpen));
MenuAnchor = InMenuAnchor;
}
bool SEditorViewportToolBarMenuButton::IsMenuOpen() const
{
if (TSharedPtr<SMenuAnchor> MenuAnchorPinned = MenuAnchor.Pin())
{
return MenuAnchorPinned->IsOpen();
}
return false;
}