Program Listing for File ZagalaSpecFeatureEditorContext.h#

↰ Return to documentation for file (ZagalaSpecEditor/Public/Toolkit/ZagalaSpecFeatureEditorContext.h)

// Copyright (c) 2026, Zagala Game Solutions. All rights reserved.

#pragma once

#include "CoreMinimal.h"
#include "Containers/Ticker.h"
#include "Document/ZagalaSpecDocumentRow.h"
#include "Toolkit/ZagalaSpecFeatureEditorSelection.h"

class FNotifyHook;
class FZagalaSpecScenarioCheckerRegistry;

class ZAGALASPECEDITOR_API FZagalaSpecFeatureEditorContext : public TSharedFromThis<FZagalaSpecFeatureEditorContext>
{
public:
    explicit FZagalaSpecFeatureEditorContext(UObject* InFeature, FNotifyHook* InNotifyHook = nullptr);

    ~FZagalaSpecFeatureEditorContext();

    FSimpleMulticastDelegate OnRowsChanged;

    TWeakObjectPtr<UObject> GetFeature() const;

    FNotifyHook* GetNotifyHook() const;

    void ClearNotifyHook();

    FZagalaSpecFeatureEditorSelection& GetSelection();

    TSharedRef<FZagalaSpecScenarioCheckerRegistry> GetScenarioCheckers() const;

    const TArray<FZagalaSpecDocumentRowPtr>& GetRows() const;

    void RebuildRows();

    void RequestRebuild();

    void HandleObjectReplaced(UObject* NewObject);

private:
    void HandleSettingsChanged(UObject* Settings, FPropertyChangedEvent& PropertyChangedEvent);

    bool TickRebuild(float DeltaTime);

    TWeakObjectPtr<UObject> Feature;

    FNotifyHook* NotifyHook;

    FZagalaSpecFeatureEditorSelection Selection;

    TSharedRef<FZagalaSpecScenarioCheckerRegistry> ScenarioCheckers;

    TArray<FZagalaSpecDocumentRowPtr> Rows;

    FTSTicker::FDelegateHandle PendingRebuildHandle;

    FDelegateHandle SettingsChangedHandle;
};