Files
PalUIExtension/Api/PanelSlot.hpp

51 lines
1.9 KiB
C++
Raw Permalink Normal View History

2026-09-07 19:33:58 -04:00
#pragma once
#include "UmgTypes.hpp"
#include "UnrealWrapper.hpp"
namespace PalUIExtension::Api
{
// ------------------------------------------------------------------
// UPanelSlot.
//
// Worth saying plainly: this class exposes ZERO UFUNCTIONs. Its entire
// surface is two Instanced UPROPERTYs, Parent and Content. So this
// wrapper cannot use ProcessEvent at all -- it exists only to give
// CanvasPanelSlot a place to inherit property access from, and to give
// you something typed to hold when AddChild() hands back a UPanelSlot*
// whose concrete type you do not know yet.
//
// If you were expecting a base class full of shared calls to inherit,
// that expectation does not survive contact with the engine here. The
// real shared behaviour lives in UnrealWrapper, not in UPanelSlot.
// ------------------------------------------------------------------
class PanelSlot : public UnrealWrapper
{
public:
static auto ClassPath() -> const TCHAR* { return STR("/Script/UMG.PanelSlot"); }
static auto DebugTag() -> const TCHAR* { return STR("PanelSlot"); }
PanelSlot() = default;
explicit PanelSlot(UObject* Obj) : PanelSlot(Obj, ClassOf<PanelSlot>(), DebugTag()) {}
// Raw UObject* rather than wrappers: Parent is a UPanelWidget and
// Content is a UWidget, and wrapping either here would mean
// including headers that (transitively) include this one.
auto GetParentObject() const -> UObject*
{
auto Ptr = PropertyPtr<UObject*>(STR("Parent"));
return Ptr ? *Ptr : nullptr;
}
auto GetContentObject() const -> UObject*
{
auto Ptr = PropertyPtr<UObject*>(STR("Content"));
return Ptr ? *Ptr : nullptr;
}
protected:
PanelSlot(UObject* Obj, UClass* Expected, const TCHAR* Tag)
: UnrealWrapper(Obj, Expected, Tag) {}
};
}