You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- On Mac OS X we hide the per-window menu bar. - MultiBlocks have a type so that the Mac-specific menu creation code can generate the proper native widget. - The menu builder can now be asked for the constructed MultiBox so that on menu creation it can be set on the TabManager. - That allows the TabManager to be told to update the current global menu bar when the tab or window focus changes. - A window activation delegate has been added to SWindow to permit this. - Widgets that used to live in the LevelEditor menu bar have been hoisted into the window titlebar on OS X as on that platform there's no menu bar anymore. - There's limited support for parsing custom widgets in the menu MultiBlock in order to support the platform list in the File->Package... sub-menu, this is sufficient for now but is quite fragile. - We can support custom Slate widgets inside native Mac menus should we ever need to - but it is tricky. reviewedby michael.trepka, nick.atamas [CL 2228398 by Mark Satterthwaite in Main branch]
90 lines
2.2 KiB
C++
90 lines
2.2 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SlatePrivatePCH.h"
|
|
#include "MultiBox.h"
|
|
#include "SWidgetBlock.h"
|
|
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param InHeadingText Heading text
|
|
*/
|
|
FWidgetBlock::FWidgetBlock( TSharedRef<SWidget> InContent, const FText& InLabel, bool bInNoIndent )
|
|
: FMultiBlock( NULL, NULL, NAME_None, EMultiBlockType::Widget )
|
|
, ContentWidget( InContent )
|
|
, Label( InLabel )
|
|
, bNoIndent( bInNoIndent )
|
|
{
|
|
}
|
|
|
|
|
|
void FWidgetBlock::CreateMenuEntry(FMenuBuilder& MenuBuilder) const
|
|
{
|
|
FText EntryLabel = (!Label.IsEmpty()) ? Label : NSLOCTEXT("WidgetBlock", "CustomControl", "Custom Control");
|
|
MenuBuilder.AddWidget(ContentWidget, FText::GetEmpty(), true);
|
|
}
|
|
|
|
|
|
/**
|
|
* Allocates a widget for this type of MultiBlock. Override this in derived classes.
|
|
*
|
|
* @return MultiBlock widget object
|
|
*/
|
|
TSharedRef< class IMultiBlockBaseWidget > FWidgetBlock::ConstructWidget() const
|
|
{
|
|
return SNew( SWidgetBlock )
|
|
.Cursor(EMouseCursor::Default);
|
|
}
|
|
|
|
|
|
/**
|
|
* Construct this widget
|
|
*
|
|
* @param InArgs The declaration data for this widget
|
|
*/
|
|
void SWidgetBlock::Construct( const FArguments& InArgs )
|
|
{
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Builds this MultiBlock widget up from the MultiBlock associated with it
|
|
*/
|
|
void SWidgetBlock::BuildMultiBlockWidget(const ISlateStyle* StyleSet, const FName& StyleName)
|
|
{
|
|
TSharedRef< const FWidgetBlock > WidgetBlock = StaticCastSharedRef< const FWidgetBlock >( MultiBlock.ToSharedRef() );
|
|
|
|
bool bHasLabel = !WidgetBlock->Label.IsEmpty();
|
|
FMargin Padding = WidgetBlock->bNoIndent ? StyleSet->GetMargin( StyleName, ".Block.Padding" ) : StyleSet->GetMargin( StyleName, ".Block.IndentedPadding" );
|
|
|
|
ChildSlot
|
|
.Padding( Padding ) // Large left margin mimics the indent of normal menu items when bNoIndent is false
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+ SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
[
|
|
SNew(SHorizontalBox)
|
|
.Visibility( bHasLabel ? EVisibility::Visible : EVisibility::Collapsed )
|
|
+ SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.Padding(0.f, 0.f, 4.f, 0.f)
|
|
.VAlign( VAlign_Center )
|
|
[
|
|
SNew( STextBlock )
|
|
.TextStyle( StyleSet, ISlateStyle::Join( StyleName, ".Label" ) )
|
|
.Text( WidgetBlock->Label )
|
|
]
|
|
]
|
|
+SHorizontalBox::Slot()
|
|
.VAlign( VAlign_Bottom )
|
|
.FillWidth(1.f)
|
|
[
|
|
WidgetBlock->ContentWidget
|
|
]
|
|
];
|
|
}
|
|
|