initial commit; cv 0.0.3
This commit is contained in:
131
Api/SizeBox.hpp
Normal file
131
Api/SizeBox.hpp
Normal file
@@ -0,0 +1,131 @@
|
||||
#pragma once
|
||||
|
||||
#include "PanelWidget.hpp"
|
||||
|
||||
namespace PalUIExtension::Api
|
||||
{
|
||||
// ------------------------------------------------------------------
|
||||
// USizeBox : public UContentWidget : public UPanelWidget.
|
||||
//
|
||||
// UContentWidget is not in this tree's header dump, so there is no
|
||||
// Api::ContentWidget rung to inherit from. This derives from
|
||||
// PanelWidget directly, skipping it. That is safe, not a shortcut:
|
||||
// Invoke() dispatches through Target->GetFunctionByNameInChain() on
|
||||
// the LIVE object's actual engine class chain (USizeBox ->
|
||||
// UContentWidget -> UPanelWidget -> UWidget -> ...), never through
|
||||
// this wrapper's C++ inheritance. Our wrapper hierarchy only
|
||||
// determines which typed accessors are in scope at the call site; it
|
||||
// has no effect on what ProcessEvent can reach. UContentWidget itself
|
||||
// adds no BlueprintCallable surface beyond what UPanelWidget already
|
||||
// gives you (its one member, GetContentSlot(), is a plain C++ helper
|
||||
// on the engine side, not a UFUNCTION), so nothing is actually lost
|
||||
// by skipping the rung -- there would be nothing to put in it.
|
||||
//
|
||||
// Every AddChild / GetChildAt / GetAllChildren / GetChildObjects call
|
||||
// from PanelWidget works unchanged. SizeBox only adds the
|
||||
// override/clear surface below.
|
||||
// ------------------------------------------------------------------
|
||||
class SizeBox : public PanelWidget
|
||||
{
|
||||
public:
|
||||
static auto ClassPath() -> const TCHAR* { return STR("/Script/UMG.SizeBox"); }
|
||||
static auto DebugTag() -> const TCHAR* { return STR("SizeBox"); }
|
||||
|
||||
SizeBox() = default;
|
||||
explicit SizeBox(UObject* Obj)
|
||||
: PanelWidget(Obj, ClassOf<SizeBox>(), DebugTag()) {}
|
||||
|
||||
// ---- setters (write through the UFUNCTION so SynchronizeProperties runs)
|
||||
|
||||
auto SetWidthOverride(float InWidthOverride) -> bool
|
||||
{
|
||||
struct P { float InWidthOverride; } p{ InWidthOverride };
|
||||
return Call(STR("SetWidthOverride"), p);
|
||||
}
|
||||
auto SetHeightOverride(float InHeightOverride) -> bool
|
||||
{
|
||||
struct P { float InHeightOverride; } p{ InHeightOverride };
|
||||
return Call(STR("SetHeightOverride"), p);
|
||||
}
|
||||
auto SetMinDesiredWidth(float InMinDesiredWidth) -> bool
|
||||
{
|
||||
struct P { float InMinDesiredWidth; } p{ InMinDesiredWidth };
|
||||
return Call(STR("SetMinDesiredWidth"), p);
|
||||
}
|
||||
auto SetMinDesiredHeight(float InMinDesiredHeight) -> bool
|
||||
{
|
||||
struct P { float InMinDesiredHeight; } p{ InMinDesiredHeight };
|
||||
return Call(STR("SetMinDesiredHeight"), p);
|
||||
}
|
||||
auto SetMaxDesiredWidth(float InMaxDesiredWidth) -> bool
|
||||
{
|
||||
struct P { float InMaxDesiredWidth; } p{ InMaxDesiredWidth };
|
||||
return Call(STR("SetMaxDesiredWidth"), p);
|
||||
}
|
||||
auto SetMaxDesiredHeight(float InMaxDesiredHeight) -> bool
|
||||
{
|
||||
struct P { float InMaxDesiredHeight; } p{ InMaxDesiredHeight };
|
||||
return Call(STR("SetMaxDesiredHeight"), p);
|
||||
}
|
||||
auto SetMinAspectRatio(float InMinAspectRatio) -> bool
|
||||
{
|
||||
struct P { float InMinAspectRatio; } p{ InMinAspectRatio };
|
||||
return Call(STR("SetMinAspectRatio"), p);
|
||||
}
|
||||
auto SetMaxAspectRatio(float InMaxAspectRatio) -> bool
|
||||
{
|
||||
struct P { float InMaxAspectRatio; } p{ InMaxAspectRatio };
|
||||
return Call(STR("SetMaxAspectRatio"), p);
|
||||
}
|
||||
|
||||
// ---- clear (each Set* above also flips its bOverride_ flag on;
|
||||
// these are the only way to flip it back off -- there is no
|
||||
// "SetWidthOverride with override=false" overload on the engine
|
||||
// side, Clear* is a distinct UFUNCTION)
|
||||
|
||||
auto ClearWidthOverride() -> bool { return CallVoid(STR("ClearWidthOverride")); }
|
||||
auto ClearHeightOverride() -> bool { return CallVoid(STR("ClearHeightOverride")); }
|
||||
auto ClearMinDesiredWidth() -> bool { return CallVoid(STR("ClearMinDesiredWidth")); }
|
||||
auto ClearMinDesiredHeight() -> bool { return CallVoid(STR("ClearMinDesiredHeight")); }
|
||||
auto ClearMaxDesiredWidth() -> bool { return CallVoid(STR("ClearMaxDesiredWidth")); }
|
||||
auto ClearMaxDesiredHeight() -> bool { return CallVoid(STR("ClearMaxDesiredHeight")); }
|
||||
auto ClearMinAspectRatio() -> bool { return CallVoid(STR("ClearMinAspectRatio")); }
|
||||
auto ClearMaxAspectRatio() -> bool { return CallVoid(STR("ClearMaxAspectRatio")); }
|
||||
|
||||
// ---- property reads: the float values ------------------------
|
||||
|
||||
auto GetWidthOverride() const -> std::optional<float> { return PropertyValue<float>(STR("WidthOverride")); }
|
||||
auto GetHeightOverride() const -> std::optional<float> { return PropertyValue<float>(STR("HeightOverride")); }
|
||||
auto GetMinDesiredWidth() const -> std::optional<float> { return PropertyValue<float>(STR("MinDesiredWidth")); }
|
||||
auto GetMinDesiredHeight() const -> std::optional<float> { return PropertyValue<float>(STR("MinDesiredHeight")); }
|
||||
auto GetMaxDesiredWidth() const -> std::optional<float> { return PropertyValue<float>(STR("MaxDesiredWidth")); }
|
||||
auto GetMaxDesiredHeight() const -> std::optional<float> { return PropertyValue<float>(STR("MaxDesiredHeight")); }
|
||||
auto GetMinAspectRatio() const -> std::optional<float> { return PropertyValue<float>(STR("MinAspectRatio")); }
|
||||
auto GetMaxAspectRatio() const -> std::optional<float> { return PropertyValue<float>(STR("MaxAspectRatio")); }
|
||||
|
||||
// ---- property reads: the override flags -----------------------
|
||||
//
|
||||
// These are `uint8 bOverride_X : 1;` bitfields, EIGHT of them
|
||||
// declared back to back on the header. That is exactly the shape
|
||||
// where PropertyValue<uint8>/PropertyPtr<uint8> goes quietly
|
||||
// wrong: the compiler is free to pack all eight into one shared
|
||||
// byte, and a plain offset+size read would hand back that whole
|
||||
// byte -- every flag OR'd together -- for a call asking about
|
||||
// just one of them, with no warning, because the property exists
|
||||
// and 1 byte does equal sizeof(uint8).
|
||||
//
|
||||
// PropertyBoolValue (UnrealWrapper.hpp) exists specifically for
|
||||
// this: it reads FBoolProperty's own ByteOffset/FieldMask and
|
||||
// tests the correct single bit rather than the storage byte. Use
|
||||
// it for every bOverride_* flag; do not reach for PropertyValue
|
||||
// here even though it would compile.
|
||||
auto IsWidthOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_WidthOverride")); }
|
||||
auto IsHeightOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_HeightOverride")); }
|
||||
auto IsMinDesiredWidthOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MinDesiredWidth")); }
|
||||
auto IsMinDesiredHeightOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MinDesiredHeight")); }
|
||||
auto IsMaxDesiredWidthOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MaxDesiredWidth")); }
|
||||
auto IsMaxDesiredHeightOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MaxDesiredHeight")); }
|
||||
auto IsMinAspectRatioOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MinAspectRatio")); }
|
||||
auto IsMaxAspectRatioOverridden() const -> std::optional<bool> { return PropertyBoolValue(STR("bOverride_MaxAspectRatio")); }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user