KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UImageButton.h
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Blueprint/UserWidget.h"
7#include "UImageButton.generated.h"
8
9DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnImageButtonClickedEvent);
10
17UCLASS()
18class ONEPIECE_API UImageButton : public UUserWidget
19{
20 GENERATED_BODY()
21
22public:
28 UFUNCTION(BlueprintCallable)
29 void SetButtonEnabled(bool bInEnabled);
30
31protected:
32 virtual void NativePreConstruct() override;
33 virtual void NativeConstruct() override;
34 virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
35
36private:
40 void ApplyStyle();
41
42 UFUNCTION()
43 void HandleHovered();
44
45 UFUNCTION()
46 void HandleUnhovered();
47
48 UFUNCTION()
49 void HandlePressed();
50
51 UFUNCTION()
52 void HandleReleased();
53
54 UFUNCTION()
55 void HandleClicked();
56
57public:
59 UPROPERTY(BlueprintAssignable, Category = "Event")
60 FOnImageButtonClickedEvent OnButtonClickedEvent;
61
62 // ========== 텍스트 스타일 ==========
63
64 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
65 FText LabelText = FText::FromString("Button");
66
67 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
68 int32 FontSize = 48;
69
70 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
71 int32 FontOutlineSize = 0;
72
73 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
74 FLinearColor NormalTextColor = FLinearColor::White;
75
76 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
77 FLinearColor HoverTextColor = FLinearColor(0.8f, 0.9f, 1.f);
78
79 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Text", meta=(ExposeOnSpawn=true))
80 FLinearColor PressTextColor = FLinearColor(0.6f, 0.7f, 1.f);
81
82 // ========== 버튼 배경 색상 ==========
83
84 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Background", meta=(ExposeOnSpawn=true))
85 FLinearColor NormalButtonColor = FLinearColor(0.1f, 0.1f, 0.1f);
86
87 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Background", meta=(ExposeOnSpawn=true))
88 FLinearColor HoverButtonColor = FLinearColor(0.2f, 0.2f, 0.2f);
89
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Background", meta=(ExposeOnSpawn=true))
91 FLinearColor PressButtonColor = FLinearColor(0.05f, 0.05f, 0.05f);
92
93 // ========== Border 이미지 ==========
94
96 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Border", meta=(ExposeOnSpawn=true))
97 UTexture2D* BorderImage = nullptr;
98
100 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Border", meta=(ExposeOnSpawn=true))
101 TEnumAsByte<ESlateBrushDrawType::Type> BorderDrawAs = ESlateBrushDrawType::Image;
102
104 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Border", meta=(ExposeOnSpawn=true))
105 FMargin BorderMargin = FMargin(0.0f);
106
107 // ========== 크기 설정 ==========
108
110 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Size", meta=(ExposeOnSpawn=true))
111 bool bUseFixedSize = false;
112
114 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Size", meta=(ExposeOnSpawn=true, EditCondition="bUseFixedSize"))
115 float FixedWidth = 200.0f;
116
118 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style|Size", meta=(ExposeOnSpawn=true, EditCondition="bUseFixedSize"))
119 float FixedHeight = 100.0f;
120
121private:
122 UPROPERTY(meta = (BindWidget))
123 class USizeBox* SizeBox_Root;
124
125 UPROPERTY(meta = (BindWidget))
126 class UButton* Button_Main;
127
128 UPROPERTY(meta = (BindWidget))
129 class UBorder* Border_BG;
130
131 UPROPERTY(meta = (BindWidget))
132 class UTextBlock* Text_Label;
133
134private:
135 // 현재 값
136 FVector2D CurrentScale = FVector2D(1.f, 1.f);
137 float CurrentBrightness = 1.0f;
138
139 // 목표값
140 FVector2D TargetScale = FVector2D(1.f, 1.f);
141 float TargetBrightness = 1.f;
142
143 // 애니메이션 속도
144 float LerpSpeed = 20.f;
145
146 bool bEnabled = true;
147
148 // Border 이미지용 캐시된 Brush (GetBrush()가 없으므로 캐싱 필요)
149 FSlateBrush CachedBorderBrush;
150 bool bBorderBrushInitialized = false;
151};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnImageButtonClickedEvent)
UImageButton