RealtimeStyleTransferRuntime/Plugins/GameSettings/Source/Private/Widgets/Responsive/SGameResponsivePanel.h

84 lines
1.8 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Widgets/SWidget.h"
#include "Widgets/SBoxPanel.h"
#include "Components/PanelWidget.h"
#include "Widgets/Layout/SGridPanel.h"
class UGameResponsivePanelSlot;
class SGameResponsivePanel : public SCompoundWidget
{
public:
typedef SGridPanel::FSlot FSlot;
public:
SLATE_BEGIN_ARGS(SGameResponsivePanel)
{
_Visibility = EVisibility::SelfHitTestInvisible;
}
SLATE_END_ARGS()
public:
SGameResponsivePanel();
/**
* Construct this widget
*
* @param InArgs The declaration data for this widget
*/
void Construct(const FArguments& InArgs);
/**
* Adds a content slot.
*
* @return The added slot.
*/
FSlot& AddSlot();
/**
* Removes a particular content slot.
*
* @param SlotWidget The widget in the slot to remove.
*/
int32 RemoveSlot(const TSharedRef<SWidget>& SlotWidget);
/**
* Removes all slots from the panel.
*/
void ClearChildren();
void EnableVerticalStacking(const bool bCanVerticallyWrap);
protected:
// Begin SWidget overrides.
virtual bool CustomPrepass(float LayoutScaleMultiplier) override;
virtual FVector2D ComputeDesiredSize(float) const override;
virtual float GetRelativeLayoutScale(int32 ChildIndex, float LayoutScaleMultiplier) const override;
virtual void OnArrangeChildren(const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren) const;
// End SWidget overrides.
bool ShouldWrap() const;
void RefreshResponsiveness();
void RefreshLayout();
protected:
TSharedRef<SGridPanel> InnerGrid;
TArray<SGridPanel::FSlot*> InnerSlots;
FVector2D PhysialScreenSize = FVector2D(0, 0);
float Scale = 1;
uint8 bCanWrapVertically : 1;
};