92 lines
3.9 KiB
C++
92 lines
3.9 KiB
C++
#pragma once
|
|
|
|
#include "PanelSlot.hpp"
|
|
|
|
namespace PalUIExtension::Api
|
|
{
|
|
class CanvasPanelSlot : public PanelSlot
|
|
{
|
|
public:
|
|
static auto ClassPath() -> const TCHAR* { return STR("/Script/UMG.CanvasPanelSlot"); }
|
|
static auto DebugTag() -> const TCHAR* { return STR("CanvasSlot"); }
|
|
|
|
CanvasPanelSlot() = default;
|
|
explicit CanvasPanelSlot(UObject* Obj)
|
|
: PanelSlot(Obj, ClassOf<CanvasPanelSlot>(), DebugTag()) {}
|
|
|
|
// ---- setters (write through the UFUNCTION so SynchronizeProperties runs)
|
|
|
|
auto SetZOrder(int32 InZOrder) -> bool
|
|
{
|
|
struct P { int32 InZOrder; } p{ InZOrder };
|
|
return Call(STR("SetZOrder"), p);
|
|
}
|
|
auto SetSize(FVector2D_ InSize) -> bool
|
|
{
|
|
struct P { FVector2D_ InSize; } p{ InSize };
|
|
return Call(STR("SetSize"), p);
|
|
}
|
|
auto SetPosition(FVector2D_ InPosition) -> bool
|
|
{
|
|
struct P { FVector2D_ InPosition; } p{ InPosition };
|
|
return Call(STR("SetPosition"), p);
|
|
}
|
|
auto SetOffsets(FMargin_ InOffset) -> bool
|
|
{
|
|
struct P { FMargin_ InOffset; } p{ InOffset };
|
|
return Call(STR("SetOffsets"), p);
|
|
}
|
|
auto SetMinimum(FVector2D_ InMinimumAnchors) -> bool
|
|
{
|
|
struct P { FVector2D_ InMinimumAnchors; } p{ InMinimumAnchors };
|
|
return Call(STR("SetMinimum"), p);
|
|
}
|
|
auto SetMaximum(FVector2D_ InMaximumAnchors) -> bool
|
|
{
|
|
struct P { FVector2D_ InMaximumAnchors; } p{ InMaximumAnchors };
|
|
return Call(STR("SetMaximum"), p);
|
|
}
|
|
auto SetAnchors(FAnchors_ InAnchors) -> bool
|
|
{
|
|
struct P { FAnchors_ InAnchors; } p{ InAnchors };
|
|
return Call(STR("SetAnchors"), p);
|
|
}
|
|
auto SetAlignment(FVector2D_ InAlignment) -> bool
|
|
{
|
|
struct P { FVector2D_ InAlignment; } p{ InAlignment };
|
|
return Call(STR("SetAlignment"), p);
|
|
}
|
|
auto SetAutoSize(bool InbAutoSize) -> bool
|
|
{
|
|
struct P { bool InbAutoSize; } p{ InbAutoSize };
|
|
return Call(STR("SetAutoSize"), p);
|
|
}
|
|
// Engine signature is (const FAnchorData&); Blueprint const-ref params
|
|
// are still laid out by value in the ProcessEvent frame.
|
|
// FAnchorData_ field order is the guess flagged in UmgTypes.hpp --
|
|
// prefer the granular setters until you have dumped the struct.
|
|
auto SetLayout(const FAnchorData_& InLayoutData) -> bool
|
|
{
|
|
struct P { FAnchorData_ InLayoutData; } p{ InLayoutData };
|
|
return Call(STR("SetLayout"), p);
|
|
}
|
|
|
|
// ---- getters --------------------------------------------------------
|
|
//
|
|
// ZOrder, bAutoSize and LayoutData are plain UPROPERTYs, so these
|
|
// three read the memory directly instead of building a ProcessEvent
|
|
// frame. The rest have no backing property of their own (they are
|
|
// views into LayoutData) and go through the UFUNCTION.
|
|
|
|
auto GetZOrder() const -> std::optional<int32> { return PropertyValue<int32>(STR("ZOrder")); }
|
|
auto GetAutoSize() const -> std::optional<bool> { return PropertyValue<bool>(STR("bAutoSize")); }
|
|
auto GetLayout() const -> std::optional<FAnchorData_> { return PropertyValue<FAnchorData_>(STR("LayoutData")); }
|
|
|
|
auto GetSize() -> std::optional<FVector2D_> { return CallForReturn<FVector2D_>(STR("GetSize")); }
|
|
auto GetPosition() -> std::optional<FVector2D_> { return CallForReturn<FVector2D_>(STR("GetPosition")); }
|
|
auto GetAlignment() -> std::optional<FVector2D_> { return CallForReturn<FVector2D_>(STR("GetAlignment")); }
|
|
auto GetOffsets() -> std::optional<FMargin_> { return CallForReturn<FMargin_>(STR("GetOffsets")); }
|
|
auto GetAnchors() -> std::optional<FAnchors_> { return CallForReturn<FAnchors_>(STR("GetAnchors")); }
|
|
};
|
|
}
|