Stream Chat Unreal SDK
Loading...
Searching...
No Matches
ContextMenuButtonWidget.h
1// Copyright 2022 Stream.IO, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Channel/Message.h"
6#include "Components/Button.h"
7#include "Components/Image.h"
8#include "Components/TextBlock.h"
9#include "ContextMenuAction.h"
10#include "CoreMinimal.h"
11#include "StreamWidget.h"
12
13#include "ContextMenuButtonWidget.generated.h"
14
15DECLARE_MULTICAST_DELEGATE(FContextMenuButtonClicked);
16
17UENUM()
18enum class EContextMenuButtonPosition : uint8
19{
20 Top,
21 Mid,
22 Bottom
23};
24
28UCLASS()
29class STREAMCHATUI_API UContextMenuButtonWidget final : public UStreamWidget
30{
31 GENERATED_BODY()
32
33public:
34 UContextMenuButtonWidget();
35 UFUNCTION(BlueprintCallable, Category = "Stream Chat")
36 void Setup(const FMessage& InMessage, EContextMenuButtonPosition InPosition, UContextMenuAction* InAction);
37
38protected:
39 UPROPERTY(meta = (BindWidget))
40 UButton* Button;
41 UPROPERTY(meta = (BindWidget))
42 UImage* IconImage;
43 UPROPERTY(meta = (BindWidget))
44 UImage* TopBorderImage;
45 UPROPERTY(meta = (BindWidget))
46 UTextBlock* TextBlock;
47
48 UPROPERTY(EditAnywhere, Category = Button)
49 UTexture2D* TopButtonTexture;
50 UPROPERTY(EditAnywhere, Category = Button)
51 UTexture2D* MidButtonTexture;
52 UPROPERTY(EditAnywhere, Category = Button)
53 UTexture2D* BottomButtonTexture;
54
55 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
56 FMessage Message;
57 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
58 EContextMenuButtonPosition Position;
59
60private:
61 virtual void OnSetup() override;
62 virtual void NativePreConstruct() override;
63 virtual void NativeConstruct() override;
64 virtual void NativeDestruct() override;
65
66 UFUNCTION()
67 void OnButtonClicked();
68
69 UTexture2D* GetButtonTexture() const;
70 FMargin GetButtonMargin() const;
71 const FLinearColor& GetIconColor() const;
72 const FLinearColor& GetTextColor() const;
73
74 UPROPERTY(EditAnywhere, Instanced, Category = Setup)
75 UContextMenuAction* Action;
76};
Represents a Stream Chat message.
Definition: Message.h:66