Unreal OpenAI API 1.0.0
AttachedFilesContainerWidget.h
1// OpenAI, Copyright LifeEXE. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/HorizontalBox.h"
7#include "AttachedFilesContainerWidget.generated.h"
8
10class UHorizontalBox;
11
12DECLARE_MULTICAST_DELEGATE(FOnFileRemoved);
13
14UCLASS()
15class OPENAIEDITOR_API UAttachedFilesContainerWidget : public UHorizontalBox
16{
17 GENERATED_BODY()
18
19public:
20 void AddImage(const FString& ImagePath);
21 void Clear();
22 bool HasFiles() const;
23 TArray<FString> FilePaths() const { return SelectedFiles; }
24 FOnFileRemoved& OnFileRemoved() { return FileRemoved; }
25
26 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI")
27 TSubclassOf<UAttachedImageWidget> AttachedImageWidgetWidgetClass;
28
29protected:
30 virtual TSharedRef<SWidget> RebuildWidget() override;
31
32private:
33 UPROPERTY()
34 TArray<TObjectPtr<UAttachedImageWidget>> AttachedImageWidgets;
35
36 UPROPERTY()
37 TObjectPtr<UHorizontalBox> ImageHorizontalBox;
38
39 TArray<FString> SelectedFiles;
40 FOnFileRemoved FileRemoved;
41
42 void OnRemoved(const FString& ImagePath, const TObjectPtr<UAttachedImageWidget>& Widget);
43};
Definition: AttachedFilesContainerWidget.h:16
Definition: AttachedImageWidget.h:16