2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
2014-04-26 20:23:08 -04:00
# include "SlatePrivatePCH.h"
2015-06-05 20:19:33 -04:00
# include "Menu.h"
# include "SPopup.h"
2015-06-08 18:12:31 -04:00
# include "SMenuAnchor.h"
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2015-06-05 20:19:33 -04:00
# define LOCTEXT_NAMESPACE "MenuStack"
2014-03-14 14:13:41 -04:00
namespace FMenuStackDefs
{
/** Maximum size of menus as a fraction of the work area height */
const float MaxMenuScreenHeightFraction = 0.8f ;
2015-06-05 20:19:33 -04:00
const float AnimationDuration = 0.15f ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
/** Overlay widget class used to hold menu contents and display them on top of the current window */
class SMenuPanel : public SOverlay
{
public :
SLATE_BEGIN_ARGS ( SMenuPanel )
{
_Visibility = EVisibility : : SelfHitTestInvisible ;
}
SLATE_END_ARGS ( )
void Construct ( const FArguments & InArgs )
{
SOverlay : : Construct ( SOverlay : : FArguments ( ) ) ;
}
void PushMenu ( TSharedRef < FMenuBase > InMenu , const FVector2D & InLocation )
{
check ( InMenu - > GetContent ( ) . IsValid ( ) ) ;
TSharedPtr < SWindow > ParentWindow = InMenu - > GetParentWindow ( ) ;
check ( ParentWindow . IsValid ( ) ) ;
// Transform InLocation into a position local to this panel (assumes the panel is in an overlay that covers the whole of the panel window)
FVector2D PanelInScreen = ParentWindow - > GetRectInScreen ( ) . GetTopLeft ( ) ;
FVector2D PanelInWindow = ParentWindow - > GetLocalToScreenTransform ( ) . Inverse ( ) . TransformPoint ( PanelInScreen ) ;
FVector2D LocationInWindow = ParentWindow - > GetLocalToScreenTransform ( ) . Inverse ( ) . TransformPoint ( InLocation ) ;
FVector2D LocationInPanel = LocationInWindow - PanelInWindow ;
// Add the new menu into a slot on this panel and set the padding so that its position is correct
AddSlot ( )
. HAlign ( HAlign_Left )
. VAlign ( VAlign_Top )
. Padding ( LocationInPanel . X , LocationInPanel . Y , 0 , 0 )
[
InMenu - > GetContent ( ) . ToSharedRef ( )
] ;
// Make sure that the menu will remove itself from the panel when dismissed
InMenu - > GetOnMenuDismissed ( ) . AddSP ( this , & SMenuPanel : : OnMenuClosed ) ;
}
void OnMenuClosed ( TSharedRef < IMenu > InMenu )
{
RemoveSlot ( InMenu - > GetContent ( ) . ToSharedRef ( ) ) ;
}
} ;
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2014-03-14 14:13:41 -04:00
namespace
{
2015-06-05 20:19:33 -04:00
/** Widget that wraps any menu created in FMenuStack to provide default key handling, focus tracking and helps us spot menus in widget paths */
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
DECLARE_DELEGATE_RetVal_OneParam ( FReply , FOnKeyDown , FKey )
2015-06-05 20:19:33 -04:00
DECLARE_DELEGATE_OneParam ( FOnMenuLostFocus , const FWidgetPath & )
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
class SMenuContentWrapper : public SCompoundWidget
2014-03-14 14:13:41 -04:00
{
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
public :
SLATE_BEGIN_ARGS ( SMenuContentWrapper )
: _MenuContent ( )
, _OnKeyDown ( )
{ }
2014-03-14 14:13:41 -04:00
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
SLATE_DEFAULT_SLOT ( FArguments , MenuContent )
SLATE_EVENT ( FOnKeyDown , OnKeyDown )
2015-06-05 20:19:33 -04:00
SLATE_EVENT ( FOnMenuLostFocus , OnMenuLostFocus )
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
SLATE_END_ARGS ( )
2014-03-14 14:13:41 -04:00
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
/** Construct this widget */
void Construct ( const FArguments & InArgs )
2014-03-14 14:13:41 -04:00
{
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
OnKeyDownDelegate = InArgs . _OnKeyDown ;
2015-06-05 20:19:33 -04:00
OnMenuLostFocus = InArgs . _OnMenuLostFocus ;
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
ChildSlot
[
InArgs . _MenuContent . Widget
] ;
}
2015-06-05 20:19:33 -04:00
virtual void OnFocusChanging ( const FWeakWidgetPath & PreviousFocusPath , const FWidgetPath & NewWidgetPath ) override
{
// if focus changed and this menu content had focus (or one of its children did) then inform the stack via the OnMenuLostFocus event
if ( OnMenuLostFocus . IsBound ( ) & & PreviousFocusPath . ContainsWidget ( AsShared ( ) ) )
{
return OnMenuLostFocus . Execute ( NewWidgetPath ) ;
}
}
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
private :
/** This widget must support keyboard focus */
2014-06-09 14:21:31 -04:00
virtual bool SupportsKeyboardFocus ( ) const override
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
{
return true ;
}
2014-10-30 12:29:36 -04:00
virtual FReply OnKeyDown ( const FGeometry & MyGeometry , const FKeyEvent & InKeyEvent ) override
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
{
if ( OnKeyDownDelegate . IsBound ( ) )
{
2014-10-30 12:29:36 -04:00
return OnKeyDownDelegate . Execute ( InKeyEvent . GetKey ( ) ) ;
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
}
return FReply : : Unhandled ( ) ;
}
/** Delegate to forward keys down events on the menu */
FOnKeyDown OnKeyDownDelegate ;
2015-06-05 20:19:33 -04:00
/** Delegate to inform the stack that a menu has lost focus and might need to be closed */
FOnMenuLostFocus OnMenuLostFocus ;
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
} ;
/** Global handler used to handle key presses on popup menus */
FReply OnMenuKeyDown ( const FKey Key )
{
if ( Key = = EKeys : : Escape )
{
FSlateApplication : : Get ( ) . DismissAllMenus ( ) ;
return FReply : : Handled ( ) ;
2014-03-14 14:13:41 -04:00
}
return FReply : : Unhandled ( ) ;
}
} // anon namespace
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2014-03-14 14:13:41 -04:00
TSharedRef < SWindow > FMenuStack : : PushMenu ( const TSharedRef < SWindow > & ParentWindow , const TSharedRef < SWidget > & InContent , const FVector2D & SummonLocation , const FPopupTransitionEffect & TransitionEffect , const bool bFocusImmediately , const bool bShouldAutoSize , const FVector2D & WindowSize , const FVector2D & SummonLocationSize )
{
2015-06-05 20:19:33 -04:00
// Deprecated method that is no longer called by its deprecated counterpart in FSlateApplication so it will only create a dummy message warning the caller not to use this method
// Backwards compatibility of the API is taken care of by FSlateApplication.
ensureMsg ( false , TEXT ( " PushMenu() returning an SWindow is deprecated. Use Push() that returns an IMenu instead. " ) ) ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
FSlateRect Anchor ( SummonLocation , SummonLocation + SummonLocationSize ) ;
FVector2D ExpectedSize ( 300 , 200 ) ;
FVector2D AdjustedSummonLocation = FSlateApplication : : Get ( ) . CalculatePopupWindowPosition ( Anchor , ExpectedSize , Orient_Vertical ) ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
TSharedRef < SWindow > NewMenuWindow =
SNew ( SWindow )
. IsPopupWindow ( true )
. SizingRule ( bShouldAutoSize ? ESizingRule : : Autosized : ESizingRule : : UserSized )
. ScreenPosition ( AdjustedSummonLocation )
. AutoCenter ( EAutoCenter : : None )
. ClientSize ( ExpectedSize )
. FocusWhenFirstShown ( true )
. ActivateWhenFirstShown ( true )
2014-03-14 14:13:41 -04:00
[
2015-06-05 20:19:33 -04:00
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. VAlign ( VAlign_Center )
. HAlign ( HAlign_Center )
2014-03-14 14:13:41 -04:00
[
2015-06-05 20:19:33 -04:00
SNew ( STextBlock )
. Text ( LOCTEXT ( " PushMenuDeprecatedWarning " , " WARNING: PushMenu() returning an SWindow is deprecated. Use Push() that returns an IMenu instead. " ) )
2014-03-14 14:13:41 -04:00
]
] ;
2015-06-05 20:19:33 -04:00
FSlateApplication : : Get ( ) . AddWindowAsNativeChild ( NewMenuWindow , ParentWindow , true ) ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
return NewMenuWindow ;
}
TSharedRef < IMenu > FMenuStack : : Push ( const FWidgetPath & InOwnerPath , const TSharedRef < SWidget > & InContent , const FVector2D & SummonLocation , const FPopupTransitionEffect & TransitionEffect , const bool bFocusImmediately , const FVector2D & SummonLocationSize , TOptional < EPopupMethod > InMethod )
{
FSlateRect Anchor ( SummonLocation , SummonLocation + SummonLocationSize ) ;
TSharedPtr < IMenu > ParentMenu ;
if ( HasMenus ( ) )
{
// Find a menu in the stack in InOwnerPath to determine the level to insert this
ParentMenu = FindMenuInWidgetPath ( InOwnerPath ) ;
check ( HostWindow . IsValid ( ) ) ;
}
if ( ! ParentMenu . IsValid ( ) )
{
// pushing a new root menu (leave ParentMenu invalid)
// The active method is determined when a new root menu is pushed
2015-06-08 18:12:31 -04:00
ActiveMethod = InMethod . IsSet ( ) ? InMethod : QueryPopupMethod ( InOwnerPath ) ;
2015-06-05 20:19:33 -04:00
// The host window is determined when a new root menu is pushed
SetHostWindow ( InOwnerPath . GetWindow ( ) ) ;
}
return PushInternal ( ParentMenu , InContent , Anchor , TransitionEffect , bFocusImmediately ) ;
}
TSharedRef < IMenu > FMenuStack : : Push ( const TSharedPtr < IMenu > & InParentMenu , const TSharedRef < SWidget > & InContent , const FVector2D & SummonLocation , const FPopupTransitionEffect & TransitionEffect , const bool bFocusImmediately , const FVector2D & SummonLocationSize )
{
check ( Stack . Contains ( InParentMenu ) ) ;
check ( HostWindow . IsValid ( ) ) ;
FSlateRect Anchor ( SummonLocation , SummonLocation + SummonLocationSize ) ;
return PushInternal ( InParentMenu , InContent , Anchor , TransitionEffect , bFocusImmediately ) ;
}
TSharedRef < IMenu > FMenuStack : : PushHosted ( const FWidgetPath & InOwnerPath , const TSharedRef < IMenuHost > & InMenuHost , const TSharedRef < SWidget > & InContent , TSharedPtr < SWidget > & OutWrappedContent , const FPopupTransitionEffect & TransitionEffect )
{
TSharedPtr < IMenu > ParentMenu ;
if ( HasMenus ( ) )
{
// Find a menu in the stack in InOwnerPath to determine the level to insert this
ParentMenu = FindMenuInWidgetPath ( InOwnerPath ) ;
check ( HostWindow . IsValid ( ) ) ;
}
if ( ! ParentMenu . IsValid ( ) )
{
// pushing a new root menu (leave ParentMenu invalid)
// The active method is determined when a new root menu is pushed and hosted menus are always UseCurrentWindow
ActiveMethod = EPopupMethod : : UseCurrentWindow ;
// The host window is determined when a new root menu is pushed
SetHostWindow ( InOwnerPath . GetWindow ( ) ) ;
}
return PushHosted ( ParentMenu , InMenuHost , InContent , OutWrappedContent , TransitionEffect ) ;
}
TSharedRef < IMenu > FMenuStack : : PushHosted ( const TSharedPtr < IMenu > & InParentMenu , const TSharedRef < IMenuHost > & InMenuHost , const TSharedRef < SWidget > & InContent , TSharedPtr < SWidget > & OutWrappedContent , const FPopupTransitionEffect & TransitionEffect )
{
check ( HostWindow . IsValid ( ) ) ;
// Create a FMenuInHostWidget
TSharedRef < SWidget > WrappedContent = WrapContent ( InContent ) ;
TSharedRef < FMenuInHostWidget > OutMenu = MakeShareable ( new FMenuInHostWidget ( InMenuHost , WrappedContent ) ) ;
PendingNewMenu = OutMenu ;
// Set the returned content - this must be drawn by the hosting widget until the menu gets dismissed and calls IMenuHost::OnMenuDismissed on its host
OutWrappedContent = WrappedContent ;
// Register to get a callback when it's dismissed - to fixup stack
OutMenu - > GetOnMenuDismissed ( ) . AddRaw ( this , & FMenuStack : : OnMenuDestroyed ) ;
PostPush ( InParentMenu , OutMenu ) ;
PendingNewMenu . Reset ( ) ;
return OutMenu ;
}
TSharedRef < IMenu > FMenuStack : : PushInternal ( const TSharedPtr < IMenu > & InParentMenu , const TSharedRef < SWidget > & InContent , FSlateRect Anchor , const FPopupTransitionEffect & TransitionEffect , const bool bFocusImmediately )
{
FPrePushArgs PrePushArgs ;
PrePushArgs . Content = InContent ;
PrePushArgs . Anchor = Anchor ;
PrePushArgs . TransitionEffect = TransitionEffect ;
PrePushArgs . bFocusImmediately = bFocusImmediately ;
// Pre-push stage
// Determines correct layout
// Wraps content
// Other common setup steps needed by all (non-hosted) menus
const FPrePushResults PrePushResults = PrePush ( PrePushArgs ) ;
// Menu object creation stage
2015-06-08 18:12:31 -04:00
TSharedRef < FMenuBase > OutMenu = ActiveMethod . Get ( EPopupMethod : : CreateNewWindow ) = = EPopupMethod : : CreateNewWindow
2015-06-05 20:19:33 -04:00
? PushNewWindow ( InParentMenu , PrePushResults )
: PushPopup ( InParentMenu , PrePushResults ) ;
// Post-push stage
// Updates the stack and content map member variables
PostPush ( InParentMenu , OutMenu ) ;
PendingNewMenu . Reset ( ) ;
return OutMenu ;
}
FMenuStack : : FPrePushResults FMenuStack : : PrePush ( const FPrePushArgs & InArgs )
{
FPrePushResults OutResults ;
OutResults . bFocusImmediately = InArgs . bFocusImmediately ;
// Only enable window position/size transitions if we're running at a decent frame rate
OutResults . bAllowAnimations = FSlateApplication : : Get ( ) . AreMenuAnimationsEnabled ( ) & & FSlateApplication : : Get ( ) . IsRunningAtTargetFrameRate ( ) ;
// Calc the max height available on screen for the menu
float MaxHeight ;
2015-06-08 18:12:31 -04:00
if ( ActiveMethod . Get ( EPopupMethod : : CreateNewWindow ) = = EPopupMethod : : CreateNewWindow )
2015-06-05 20:19:33 -04:00
{
FSlateRect WorkArea = FSlateApplication : : Get ( ) . GetWorkArea ( InArgs . Anchor ) ;
MaxHeight = FMenuStackDefs : : MaxMenuScreenHeightFraction * WorkArea . GetSize ( ) . Y ;
}
else
{
MaxHeight = FMenuStackDefs : : MaxMenuScreenHeightFraction * HostWindow - > GetClientSizeInScreen ( ) . Y ;
}
bool bAnchorSetsMinWidth = InArgs . TransitionEffect . SlideDirection = = FPopupTransitionEffect : : ComboButton ;
// Wrap menu content in a box needed for various sizing and tracking purposes
FOptionalSize OptionalMinWidth = bAnchorSetsMinWidth ? InArgs . Anchor . GetSize ( ) . X : FOptionalSize ( ) ;
FOptionalSize OptionalMinHeight = MaxHeight ;
// Wrap content in an SPopup before the rest of the wrapping process - should make menus appear on top using deferred presentation
TSharedRef < SWidget > TempContent = SNew ( SPopup ) [ InArgs . Content . ToSharedRef ( ) ] ;
OutResults . WrappedContent = WrapContent ( TempContent , OptionalMinWidth , OptionalMinHeight ) ;
// @todo slate: Assumes that popup is not Scaled up or down from application scale.
OutResults . WrappedContent - > SlatePrepass ( FSlateApplication : : Get ( ) . GetApplicationScale ( ) ) ;
// @todo slate: Doesn't take into account potential window border size
OutResults . ExpectedSize = OutResults . WrappedContent - > GetDesiredSize ( ) ;
EOrientation Orientation = ( InArgs . TransitionEffect . SlideDirection = = FPopupTransitionEffect : : SubMenu ) ? Orient_Horizontal : Orient_Vertical ;
// Calculate the correct position for the menu based on the popup method
2015-06-08 18:12:31 -04:00
if ( ActiveMethod . Get ( EPopupMethod : : CreateNewWindow ) = = EPopupMethod : : CreateNewWindow )
2015-06-05 20:19:33 -04:00
{
// Places the menu's window in the work area
OutResults . AnimStartLocation = OutResults . AnimFinalLocation = FSlateApplication : : Get ( ) . CalculatePopupWindowPosition ( InArgs . Anchor , OutResults . ExpectedSize , Orientation ) ;
}
else
{
// Places the menu's content in the host window
const FVector2D ProposedPlacement (
Orientation = = Orient_Horizontal ? InArgs . Anchor . Right : InArgs . Anchor . Left ,
Orientation = = Orient_Horizontal ? InArgs . Anchor . Top : InArgs . Anchor . Bottom ) ;
OutResults . AnimStartLocation = OutResults . AnimFinalLocation =
ComputePopupFitInRect ( InArgs . Anchor , FSlateRect ( ProposedPlacement , ProposedPlacement + OutResults . ExpectedSize ) , Orientation , HostWindow - > GetClientRectInScreen ( ) ) ;
}
2014-03-14 14:13:41 -04:00
// Start the pop-up menu at an offset location, then animate it to its target location over time
2015-06-05 20:19:33 -04:00
// @todo: Anims aren't supported or attempted - this is legacy code left in in case we reinstate menu anims
if ( OutResults . bAllowAnimations )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
const bool bSummonRight = OutResults . AnimFinalLocation . X > = OutResults . AnimStartLocation . X ;
const bool bSummonBelow = OutResults . AnimFinalLocation . Y > = OutResults . AnimStartLocation . Y ;
2014-03-14 14:13:41 -04:00
const int32 SummonDirectionX = bSummonRight ? 1 : - 1 ;
const int32 SummonDirectionY = bSummonBelow ? 1 : - 1 ;
2015-06-05 20:19:33 -04:00
switch ( InArgs . TransitionEffect . SlideDirection )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : None :
// No sliding
break ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : ComboButton :
OutResults . AnimStartLocation . Y = FMath : : Max ( OutResults . AnimStartLocation . Y + 30.0f * SummonDirectionY , 0.0f ) ;
break ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : TopMenu :
OutResults . AnimStartLocation . Y = FMath : : Max ( OutResults . AnimStartLocation . Y + 60.0f * SummonDirectionY , 0.0f ) ;
break ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : SubMenu :
OutResults . AnimStartLocation . X + = 60.0f * SummonDirectionX ;
break ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : TypeInPopup :
OutResults . AnimStartLocation . Y = FMath : : Max ( OutResults . AnimStartLocation . Y + 30.0f * SummonDirectionY , 0.0f ) ;
break ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
case FPopupTransitionEffect : : ContextMenu :
OutResults . AnimStartLocation . X + = 30.0f * SummonDirectionX ;
OutResults . AnimStartLocation . Y + = 50.0f * SummonDirectionY ;
break ;
2014-03-14 14:13:41 -04:00
}
}
2015-06-05 20:19:33 -04:00
// Release the mouse so that context can be properly restored upon closing menus. See CL 1411833 before changing this.
if ( InArgs . bFocusImmediately )
{
FSlateApplication : : Get ( ) . ReleaseMouseCapture ( ) ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
return OutResults ;
}
TSharedRef < FMenuBase > FMenuStack : : PushNewWindow ( TSharedPtr < IMenu > InParentMenu , const FPrePushResults & InPrePushResults )
{
2015-06-08 18:12:31 -04:00
check ( ActiveMethod . GetValue ( ) = = EPopupMethod : : CreateNewWindow ) ;
2015-06-05 20:19:33 -04:00
// Start pop-up windows out transparent, then fade them in over time
const EWindowTransparency Transparency ( InPrePushResults . bAllowAnimations ? EWindowTransparency : : PerWindow : EWindowTransparency : : None ) ;
const float InitialWindowOpacity = InPrePushResults . bAllowAnimations ? 0.0f : 1.0f ;
const float TargetWindowOpacity = 1.0f ;
2014-03-14 14:13:41 -04:00
// Create a new window for the menu
TSharedRef < SWindow > NewMenuWindow = SNew ( SWindow )
2015-06-05 20:19:33 -04:00
. IsPopupWindow ( true )
. SizingRule ( ESizingRule : : Autosized )
. ScreenPosition ( InPrePushResults . AnimStartLocation )
. AutoCenter ( EAutoCenter : : None )
. ClientSize ( InPrePushResults . ExpectedSize )
2014-03-14 14:13:41 -04:00
. InitialOpacity ( InitialWindowOpacity )
2015-06-05 20:19:33 -04:00
. SupportsTransparency ( Transparency )
. FocusWhenFirstShown ( InPrePushResults . bFocusImmediately )
. ActivateWhenFirstShown ( InPrePushResults . bFocusImmediately )
2014-03-14 14:13:41 -04:00
[
2015-06-05 20:19:33 -04:00
InPrePushResults . WrappedContent . ToSharedRef ( )
2014-03-14 14:13:41 -04:00
] ;
2015-06-05 20:19:33 -04:00
PendingNewWindow = NewMenuWindow ;
if ( InPrePushResults . bFocusImmediately )
2014-03-14 14:13:41 -04:00
{
// Focus the content rather than just the window
2015-06-05 20:19:33 -04:00
NewMenuWindow - > SetWidgetToFocusOnActivate ( InPrePushResults . WrappedContent ) ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
TSharedRef < FMenuInWindow > Menu = MakeShareable ( new FMenuInWindow ( NewMenuWindow , InPrePushResults . WrappedContent . ToSharedRef ( ) ) ) ;
PendingNewMenu = Menu ;
TSharedPtr < SWindow > ParentWindow ;
if ( InParentMenu . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
ParentWindow = InParentMenu - > GetParentWindow ( ) ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
else
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
ParentWindow = HostWindow ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
FSlateApplication : : Get ( ) . AddWindowAsNativeChild ( NewMenuWindow , ParentWindow . ToSharedRef ( ) , true ) ;
2014-03-14 14:13:41 -04:00
// Kick off the intro animation!
2015-06-05 20:19:33 -04:00
// @todo: Anims aren't supported or attempted - this is legacy code left in in case we reinstate menu anims
if ( InPrePushResults . bAllowAnimations )
2014-03-14 14:13:41 -04:00
{
FCurveSequence Sequence ;
2015-06-05 20:19:33 -04:00
Sequence . AddCurve ( 0 , FMenuStackDefs : : AnimationDuration , ECurveEaseFunction : : CubicOut ) ;
NewMenuWindow - > MorphToPosition ( Sequence , TargetWindowOpacity , InPrePushResults . AnimFinalLocation ) ;
}
PendingNewWindow . Reset ( ) ;
return Menu ;
}
TSharedRef < FMenuBase > FMenuStack : : PushPopup ( TSharedPtr < IMenu > InParentMenu , const FPrePushResults & InPrePushResults )
{
2015-06-08 18:12:31 -04:00
check ( ActiveMethod . GetValue ( ) = = EPopupMethod : : UseCurrentWindow ) ;
2015-06-05 20:19:33 -04:00
// Create a FMenuInPopup
check ( InPrePushResults . WrappedContent . IsValid ( ) ) ;
TSharedRef < FMenuInPopup > Menu = MakeShareable ( new FMenuInPopup ( InPrePushResults . WrappedContent . ToSharedRef ( ) ) ) ;
PendingNewMenu = Menu ;
// Register to get callback when it's dismissed - to fixup stack
Menu - > GetOnMenuDismissed ( ) . AddRaw ( this , & FMenuStack : : OnMenuDestroyed ) ;
// Add it to a slot on the menus panel widget
HostWindowPopupPanel - > PushMenu ( Menu , InPrePushResults . AnimFinalLocation ) ;
if ( InPrePushResults . bFocusImmediately )
{
FSlateApplication : : Get ( ) . SetKeyboardFocus ( InPrePushResults . WrappedContent , EFocusCause : : SetDirectly ) ;
}
return Menu ;
}
void FMenuStack : : PostPush ( TSharedPtr < IMenu > InParentMenu , TSharedRef < FMenuBase > InMenu )
{
// Determine at which index we insert this new menu in the stack
int32 InsertIndex = 0 ;
if ( InParentMenu . IsValid ( ) )
{
int32 ParentIndex = Stack . IndexOfByKey ( InParentMenu ) ;
check ( ParentIndex ! = INDEX_NONE ) ;
InsertIndex = ParentIndex + 1 ;
}
// Insert before dismissing others to stop the stack accidentally emptying briefly mid-push and reseting some state
Stack . Insert ( InMenu , InsertIndex ) ;
CachedContentMap . Add ( InMenu - > GetContent ( ) , InMenu ) ;
// Dismiss menus after the insert point
if ( Stack . Num ( ) > InsertIndex + 1 )
{
DismissFrom ( Stack [ InsertIndex + 1 ] ) ;
// tidy the stack data now (it will happen via callbacks from the dismissed menus but that might be delayed)
for ( int32 StackIndex = Stack . Num ( ) - 1 ; StackIndex > InsertIndex ; - - StackIndex )
{
CachedContentMap . Remove ( Stack [ StackIndex ] - > GetContent ( ) ) ;
Stack . RemoveAt ( StackIndex ) ;
}
2014-03-14 14:13:41 -04:00
}
// When a new menu is pushed, if we are not already in responsive mode for Slate UI, enter it now
// to ensure the menu is responsive in low FPS situations
2015-06-05 20:19:33 -04:00
if ( ! ThrottleHandle . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
ThrottleHandle = FSlateThrottleManager : : Get ( ) . EnterResponsiveMode ( ) ;
}
}
2015-06-05 20:19:33 -04:00
EPopupMethod FMenuStack : : QueryPopupMethod ( const FWidgetPath & PathToQuery )
{
for ( int32 WidgetIndex = PathToQuery . Widgets . Num ( ) - 1 ; WidgetIndex > = 0 ; - - WidgetIndex )
{
TOptional < EPopupMethod > PopupMethod = PathToQuery . Widgets [ WidgetIndex ] . Widget - > OnQueryPopupMethod ( ) ;
if ( PopupMethod . IsSet ( ) )
{
return PopupMethod . GetValue ( ) ;
}
}
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2015-06-05 20:19:33 -04:00
return EPopupMethod : : CreateNewWindow ;
}
void FMenuStack : : Dismiss ( int32 FirstStackIndexToRemove )
{
// deprecated
DismissInternal ( FirstStackIndexToRemove ) ;
}
void FMenuStack : : DismissFrom ( const TSharedPtr < IMenu > & InFromMenu )
{
int32 Index = Stack . IndexOfByKey ( InFromMenu ) ;
if ( Index ! = INDEX_NONE )
{
DismissInternal ( Index ) ;
}
}
void FMenuStack : : DismissAll ( )
{
const int32 TopLevel = 0 ;
DismissInternal ( TopLevel ) ;
}
void FMenuStack : : DismissInternal ( int32 FirstStackIndexToRemove )
2014-03-14 14:13:41 -04:00
{
// Dismiss the stack in reverse order so we destroy children before parents (causes focusing issues if done the other way around)
2015-06-05 20:19:33 -04:00
for ( int32 StackIndex = Stack . Num ( ) - 1 ; StackIndex > = FirstStackIndexToRemove ; - - StackIndex )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
Stack [ StackIndex ] - > Dismiss ( ) ;
}
}
void FMenuStack : : SetHostWindow ( TSharedPtr < SWindow > InWindow )
{
if ( HostWindow ! = InWindow )
{
// If the host window is changing, remove the popup panel from the previous host
if ( HostWindow . IsValid ( ) & & HostWindowPopupPanel . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
HostWindow - > RemoveOverlaySlot ( HostWindowPopupPanel . ToSharedRef ( ) ) ;
HostWindowPopupPanel . Reset ( ) ;
}
HostWindow = InWindow ;
// If the host window is changing, add a popup panel to the new host
if ( HostWindow . IsValid ( ) )
{
// setup a popup layer on the new window
HostWindow - > AddOverlaySlot ( )
[
SAssignNew ( HostWindowPopupPanel , SMenuPanel )
] ;
2014-03-14 14:13:41 -04:00
}
}
2015-06-05 20:19:33 -04:00
}
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
void FMenuStack : : OnMenuDestroyed ( TSharedRef < IMenu > InMenu )
{
int32 Index = Stack . IndexOfByKey ( InMenu ) ;
if ( Index ! = INDEX_NONE )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
// Dismiss menus below this one
for ( int32 StackIndex = Stack . Num ( ) - 1 ; StackIndex > Index ; - - StackIndex )
{
Stack [ StackIndex ] - > Dismiss ( ) ; // this will cause OnMenuDestroyed() to re-enter
}
// Clean up the stack and content map arrays
for ( int32 StackIndex = Stack . Num ( ) - 1 ; StackIndex > = Index ; - - StackIndex )
{
CachedContentMap . Remove ( Stack [ StackIndex ] - > GetContent ( ) ) ;
Stack . RemoveAt ( StackIndex ) ;
}
2014-03-14 14:13:41 -04:00
// Leave responsive mode once the last menu closes
2015-06-05 20:19:33 -04:00
if ( Stack . Num ( ) = = 0 )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
if ( ThrottleHandle . IsValid ( ) )
{
FSlateThrottleManager : : Get ( ) . LeaveResponsiveMode ( ThrottleHandle ) ;
}
SetHostWindow ( TSharedPtr < SWindow > ( ) ) ;
2014-03-14 14:13:41 -04:00
}
}
}
2015-06-05 20:19:33 -04:00
void FMenuStack : : OnMenuContentLostFocus ( const FWidgetPath & InFocussedPath )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
// Window activation messages will make menus collapse when in CreateNewWindow mode
// In UseCurrentWindow mode we must look for focus moving from menus
2015-06-08 18:12:31 -04:00
if ( ActiveMethod . Get ( EPopupMethod : : CreateNewWindow ) = = EPopupMethod : : UseCurrentWindow & & HasMenus ( ) & & ! PendingNewMenu . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
// If focus is switching determine which of our menus it is in, if any
TSharedPtr < IMenu > FocussedMenu = FindMenuInWidgetPath ( InFocussedPath ) ;
if ( FocussedMenu . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
// dismiss menus below FocussedMenu
int32 FocussedIndex = Stack . IndexOfByKey ( FocussedMenu ) ;
check ( FocussedIndex ! = INDEX_NONE ) ;
2014-03-14 14:13:41 -04:00
2015-06-05 20:19:33 -04:00
if ( Stack . Num ( ) > FocussedIndex + 1 )
{
DismissFrom ( Stack [ FocussedIndex + 1 ] ) ;
}
2014-03-14 14:13:41 -04:00
}
else
{
2015-06-05 20:19:33 -04:00
// Focus has moved outside all menus - collapse the stack
DismissAll ( ) ;
}
}
}
TSharedRef < SWidget > FMenuStack : : WrapContent ( TSharedRef < SWidget > InContent , FOptionalSize OptionalMinWidth , FOptionalSize OptionalMinHeight )
{
// Wrap menu content in a box that limits its maximum height
// and in a SMenuContentWrapper that handles key presses and focus changes.
return SNew ( SMenuContentWrapper )
. OnKeyDown_Static ( & OnMenuKeyDown )
. OnMenuLostFocus_Raw ( this , & FMenuStack : : OnMenuContentLostFocus )
. MenuContent ( )
[
SNew ( SBox )
. MinDesiredWidth ( OptionalMinWidth )
. MaxDesiredHeight ( OptionalMinHeight )
[
InContent
]
] ;
}
TSharedPtr < IMenu > FMenuStack : : FindMenuInWidgetPath ( const FWidgetPath & PathToQuery ) const
{
for ( int32 PathIndex = PathToQuery . Widgets . Num ( ) - 1 ; PathIndex > = 0 ; - - PathIndex )
{
TSharedPtr < const SWidget > Widget = PathToQuery . Widgets [ PathIndex ] . Widget ;
const TSharedPtr < FMenuBase > * FoundMenu = CachedContentMap . Find ( Widget ) ;
if ( FoundMenu ! = nullptr )
{
return * FoundMenu ;
}
}
return TSharedPtr < IMenu > ( ) ;
}
void FMenuStack : : RemoveWindow ( TSharedRef < SWindow > WindowToRemove )
{
// deprecated
OnWindowDestroyed ( WindowToRemove ) ;
}
void FMenuStack : : OnWindowDestroyed ( TSharedRef < SWindow > InWindow )
{
if ( HostWindow = = InWindow )
{
// If the host window is destroyed, collapse the whole stack and reset all state
Stack . Empty ( ) ;
CachedContentMap . Empty ( ) ;
SetHostWindow ( TSharedPtr < SWindow > ( ) ) ;
}
else
{
// A window was requested to be destroyed, so make sure it's not in the menu stack to avoid it
// becoming a parent to a freshly-created window!
TSharedPtr < IMenu > Menu = FindMenuFromWindow ( InWindow ) ;
if ( Menu . IsValid ( ) )
{
OnMenuDestroyed ( Menu . ToSharedRef ( ) ) ;
}
}
}
void FMenuStack : : OnWindowActivated ( TSharedRef < SWindow > ActivatedWindow )
{
if ( ActivatedWindow ! = PendingNewWindow & & HasMenus ( ) )
{
TWeakPtr < IMenu > ActivatedMenu = FindMenuFromWindow ( ActivatedWindow ) ;
if ( ActivatedMenu . IsValid ( ) )
{
// Dismiss menus below ActivatedMenu
int32 ActivatedIndex = Stack . IndexOfByKey ( ActivatedMenu ) ;
check ( ActivatedIndex ! = INDEX_NONE ) ;
if ( Stack . Num ( ) > ActivatedIndex + 1 )
{
DismissFrom ( Stack [ ActivatedIndex + 1 ] ) ;
}
}
else
{
// Activated a window that isn't a menu - collapse the stack
DismissAll ( ) ;
2014-03-14 14:13:41 -04:00
}
}
}
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2014-03-14 14:13:41 -04:00
int32 FMenuStack : : FindLocationInStack ( TSharedPtr < SWindow > WindowToFind ) const
{
2015-06-05 20:19:33 -04:00
// deprecated
if ( WindowToFind . IsValid ( ) )
2014-03-14 14:13:41 -04:00
{
2015-06-05 20:19:33 -04:00
TWeakPtr < IMenu > Menu = FindMenuFromWindow ( WindowToFind . ToSharedRef ( ) ) ;
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2015-06-05 20:19:33 -04:00
return Stack . IndexOfByKey ( Menu ) ;
2014-03-14 14:13:41 -04:00
}
// The window was not found
return INDEX_NONE ;
}
2015-06-05 20:19:33 -04:00
TSharedPtr < IMenu > FMenuStack : : FindMenuFromWindow ( TSharedRef < SWindow > InWindow ) const
{
const TSharedPtr < FMenuBase > * FoundMenu = Stack . FindByPredicate ( [ InWindow ] ( TSharedPtr < FMenuBase > Menu ) { return Menu - > GetOwnedWindow ( ) = = InWindow ; } ) ;
if ( FoundMenu ! = nullptr )
{
return * FoundMenu ;
}
return TSharedPtr < IMenu > ( ) ;
}
FSlateRect FMenuStack : : GetToolTipForceFieldRect ( TSharedRef < IMenu > InMenu , const FWidgetPath & PathContainingMenu ) const
{
FSlateRect ForceFieldRect ( 0 , 0 , 0 , 0 ) ;
int32 StackLevel = Stack . IndexOfByKey ( InMenu ) ;
if ( StackLevel ! = INDEX_NONE )
{
for ( int32 StackLevelIndex = StackLevel + 1 ; StackLevelIndex < Stack . Num ( ) ; + + StackLevelIndex )
{
TSharedPtr < SWidget > MenuContent = Stack [ StackLevelIndex ] - > GetContent ( ) ;
if ( MenuContent . IsValid ( ) )
{
FWidgetPath WidgetPath = PathContainingMenu . GetPathDownTo ( MenuContent . ToSharedRef ( ) ) ;
if ( ! WidgetPath . IsValid ( ) )
{
FSlateApplication : : Get ( ) . GeneratePathToWidgetChecked ( MenuContent . ToSharedRef ( ) , WidgetPath ) ;
}
if ( WidgetPath . IsValid ( ) )
{
const FGeometry & ContentGeometry = WidgetPath . Widgets . Last ( ) . Geometry ;
ForceFieldRect = ForceFieldRect . Expand ( ContentGeometry . GetClippingRect ( ) ) ;
}
}
}
}
return ForceFieldRect ;
}
bool FMenuStack : : HasMenus ( ) const
{
return Stack . Num ( ) > 0 ;
}
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2014-03-14 14:13:41 -04:00
bool FMenuStack : : HasOpenSubMenus ( const TSharedRef < SWindow > & Window ) const
{
2015-06-05 20:19:33 -04:00
// deprecated
TWeakPtr < IMenu > Menu = FindMenuFromWindow ( Window ) ;
if ( Menu . IsValid ( ) )
{
return Menu ! = Stack . Last ( ) ;
}
return false ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
bool FMenuStack : : HasOpenSubMenus ( TSharedPtr < IMenu > InMenu ) const
{
int32 StackIndex = Stack . IndexOfByKey ( InMenu ) ;
return StackIndex ! = INDEX_NONE & & StackIndex < Stack . Num ( ) - 1 ;
}
Slate: Refactored core Slate implementation into SlateCore module in preparation for UMG.
Other Updates:
- The WidgetReflector is now in its own module as well. It will be converted to a plug-in later.
- The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed.
- Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed.
- Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.)
Upgrade Notes:
- The Slate Remote Server is currently disabled - will be re-enabled shortly!
- If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file.
- If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore'
- The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed
- IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget()
Troubleshooting:
- After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project
- If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore'
- If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine
[CL 2057118 by Max Preussner in Main branch]
2014-04-26 15:07:24 -04:00
2014-03-14 14:13:41 -04:00
int32 FMenuStack : : GetNumStackLevels ( ) const
{
return Stack . Num ( ) ;
}
2015-06-05 20:19:33 -04:00
TSharedPtr < SWindow > FMenuStack : : GetHostWindow ( ) const
{
return HostWindow ;
}
2014-03-14 14:13:41 -04:00
FMenuWindowList & FMenuStack : : GetWindowsAtStackLevel ( const int32 StackLevelIndex )
{
2015-06-05 20:19:33 -04:00
// deprecated
// can't support this so return an empty list
ensure ( false ) ;
static FMenuWindowList EmptyList ;
return EmptyList ;
2014-03-14 14:13:41 -04:00
}
2015-06-05 20:19:33 -04:00
# undef LOCTEXT_NAMESPACE