initial commit; cv 0.0.3
This commit is contained in:
34
Api/Overlay.hpp
Normal file
34
Api/Overlay.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include "PanelWidget.hpp"
|
||||
#include "OverlaySlot.hpp"
|
||||
|
||||
namespace PalUIExtension::Api
|
||||
{
|
||||
// UOverlay : public UPanelWidget directly (confirmed by the header --
|
||||
// no ContentWidget rung to skip here, unlike SizeBox). Every generic
|
||||
// panel operation -- AddChild, GetChildAt, GetAllChildren,
|
||||
// GetChildObjects -- is already on PanelWidget and works unchanged;
|
||||
// AddChildToOverlay below is the one thing Overlay adds beyond that,
|
||||
// and it exists only because the engine returns the concrete
|
||||
// UOverlaySlot* type instead of the generic UPanelSlot* AddChild()
|
||||
// returns, so you get typed access to Padding/Alignment without an
|
||||
// extra cast.
|
||||
class Overlay : public PanelWidget
|
||||
{
|
||||
public:
|
||||
static auto ClassPath() -> const TCHAR* { return STR("/Script/UMG.Overlay"); }
|
||||
static auto DebugTag() -> const TCHAR* { return STR("Overlay"); }
|
||||
|
||||
Overlay() = default;
|
||||
explicit Overlay(UObject* Obj)
|
||||
: PanelWidget(Obj, ClassOf<Overlay>(), DebugTag()) {}
|
||||
|
||||
auto AddChildToOverlay(UObject* Content) -> OverlaySlot
|
||||
{
|
||||
struct P { UObject* Content; UObject* ReturnValue; } p{ Content, nullptr };
|
||||
auto Result = CallForReturn(STR("AddChildToOverlay"), p, &P::ReturnValue);
|
||||
return (Result && *Result) ? OverlaySlot{ *Result } : OverlaySlot{};
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user