KLingo Project Documentation
1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UPopup_MsgBox.cpp
이 파일의 문서화 페이지로 가기
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
4
#include "
UPopup_MsgBox.h
"
5
6
#include "
UImageButton.h
"
7
#include "
UTextureButton.h
"
8
#include "
UPopupManager.h
"
9
#include "Components/Spacer.h"
10
#include "Components/TextBlock.h"
11
12
void
UPopup_MsgBox::NativeConstruct
()
13
{
14
Super::NativeConstruct();
15
}
16
17
void
UPopup_MsgBox::SetTitle
(
const
FString& InTitle) {
Txt_Title
->SetText(FText::FromString(InTitle)); }
18
void
UPopup_MsgBox::SetDesc
(
const
FString& InDescription) {
Txt_Desc
->SetText(FText::FromString(InDescription)); }
19
20
void
UPopup_MsgBox::InitButton
(
EMsgBoxType
InType)
21
{
22
// 중복 바인딩 방지: 기존 바인딩 제거 후 재바인딩
23
if
(
Btn_Close
)
24
{
25
Btn_Close
->
OnButtonClickedEvent
.RemoveDynamic(
this
, &
UPopup_MsgBox::OnClickCancel
);
26
Btn_Close
->
OnButtonClickedEvent
.AddDynamic(
this
, &
UPopup_MsgBox::OnClickCancel
);
27
}
28
if
(
Btn_Ok
)
29
{
30
Btn_Ok
->
OnButtonClickedEvent
.RemoveDynamic(
this
, &
UPopup_MsgBox::OnClickOk
);
31
Btn_Ok
->
OnButtonClickedEvent
.AddDynamic(
this
, &
UPopup_MsgBox::OnClickOk
);
32
}
33
if
(
Btn_Cancel
)
34
{
35
Btn_Cancel
->
OnButtonClickedEvent
.RemoveDynamic(
this
, &
UPopup_MsgBox::OnClickCancel
);
36
Btn_Cancel
->
OnButtonClickedEvent
.AddDynamic(
this
, &
UPopup_MsgBox::OnClickCancel
);
37
}
38
39
switch
(InType)
40
{
41
case
EMsgBoxType::OK
:
42
Btn_Ok
->SetVisibility(ESlateVisibility::Visible);
43
Btn_Cancel
->SetVisibility(ESlateVisibility::Collapsed);
44
Spacing_OkCancel
->SetVisibility(ESlateVisibility::Collapsed);
45
break
;
46
47
case
EMsgBoxType::OK_CANCEL
:
48
Btn_Ok
->SetVisibility(ESlateVisibility::Visible);
49
Btn_Cancel
->SetVisibility(ESlateVisibility::Visible);
50
Spacing_OkCancel
->SetVisibility(ESlateVisibility::Visible);
51
break
;
52
}
53
}
54
55
void
UPopup_MsgBox::OnClickOk
()
56
{
57
// PopupManager를 통해 팝업 닫기 (마우스 커서 처리 포함)
58
if
(
UPopupManager
* PopupMgr = UPopupManager::Get(GetWorld()))
59
{
60
PopupMgr->HideCurrentPopup();
61
}
62
63
if
(
OnOkDelegate
.IsBound())
64
OnOkDelegate
.Execute();
65
}
66
67
void
UPopup_MsgBox::OnClickCancel
()
68
{
69
// PopupManager를 통해 팝업 닫기 (마우스 커서 처리 포함)
70
if
(
UPopupManager
* PopupMgr = UPopupManager::Get(GetWorld()))
71
{
72
PopupMgr->HideCurrentPopup();
73
}
74
75
if
(
OnCancelDelegate
.IsBound())
76
OnCancelDelegate
.Execute();
77
}
78
79
80
void
UPopup_MsgBox::InitPopup
(
81
const
FString& InTitle,
82
const
FString& InDescription,
83
EMsgBoxType
InType,
84
const
FOnMsgBoxOkDelegate& InOkDelegate)
85
{
86
this->
SetTitle
(InTitle);
87
this->
SetDesc
(InDescription);
88
this->
InitButton
(InType);
89
90
OnOkDelegate
= InOkDelegate;
91
OnCancelDelegate
.Unbind();
92
}
93
94
void
UPopup_MsgBox::InitPopup
(
95
const
FString& InTitle,
96
const
FString& InDescription,
97
EMsgBoxType
InType,
98
const
FOnMsgBoxOkDelegate& InOkDelegate,
99
const
FOnMsgBoxCancelDelegate& InCancelDelegate )
100
{
101
this->
SetTitle
(InTitle);
102
this->
SetDesc
(InDescription);
103
this->
InitButton
(InType);
104
105
OnOkDelegate
= InOkDelegate;
106
OnCancelDelegate
= InCancelDelegate;
107
}
EMsgBoxType
EMsgBoxType
Definition
EPopupType.h:49
EMsgBoxType::OK_CANCEL
@ OK_CANCEL
EMsgBoxType::OK
@ OK
UImageButton.h
UPopupManager.h
UPopup_MsgBox.h
UTextureButton.h
UImageButton::OnButtonClickedEvent
FOnImageButtonClickedEvent OnButtonClickedEvent
버튼 클릭 시 발생하는 이벤트
Definition
UImageButton.h:60
UPopupManager
팝업 관리자
Definition
UPopupManager.h:31
UPopup_MsgBox::InitPopup
void InitPopup(const FString &InTitle, const FString &InDescription, EMsgBoxType InType, const FOnMsgBoxOkDelegate &InOkDelegate, const FOnMsgBoxCancelDelegate &InCancelDelegate)
Definition
UPopup_MsgBox.cpp:94
UPopup_MsgBox::NativeConstruct
virtual void NativeConstruct() override
Definition
UPopup_MsgBox.cpp:12
UPopup_MsgBox::OnOkDelegate
FOnMsgBoxOkDelegate OnOkDelegate
Definition
UPopup_MsgBox.h:63
UPopup_MsgBox::Btn_Ok
class UImageButton * Btn_Ok
Definition
UPopup_MsgBox.h:54
UPopup_MsgBox::Txt_Desc
class UTextBlock * Txt_Desc
Definition
UPopup_MsgBox.h:48
UPopup_MsgBox::InitButton
void InitButton(EMsgBoxType InType)
Definition
UPopup_MsgBox.cpp:20
UPopup_MsgBox::Btn_Close
class UTextureButton * Btn_Close
Definition
UPopup_MsgBox.h:51
UPopup_MsgBox::OnCancelDelegate
FOnMsgBoxCancelDelegate OnCancelDelegate
Definition
UPopup_MsgBox.h:64
UPopup_MsgBox::Spacing_OkCancel
class USpacer * Spacing_OkCancel
Definition
UPopup_MsgBox.h:57
UPopup_MsgBox::OnClickCancel
void OnClickCancel()
Definition
UPopup_MsgBox.cpp:67
UPopup_MsgBox::SetTitle
void SetTitle(const FString &InTitle)
Definition
UPopup_MsgBox.cpp:17
UPopup_MsgBox::Txt_Title
class UTextBlock * Txt_Title
Definition
UPopup_MsgBox.h:45
UPopup_MsgBox::OnClickOk
void OnClickOk()
Definition
UPopup_MsgBox.cpp:55
UPopup_MsgBox::SetDesc
void SetDesc(const FString &InDescription)
Definition
UPopup_MsgBox.cpp:18
UPopup_MsgBox::Btn_Cancel
class UImageButton * Btn_Cancel
Definition
UPopup_MsgBox.h:60
UTextureButton::OnButtonClickedEvent
FOnTextureButtonClickedEvent OnButtonClickedEvent
버튼 클릭 이벤트
Definition
UTextureButton.h:79
Source
Onepiece
MessageBox
Private
UPopup_MsgBox.cpp
생성시간 : 금 1월 9 2026 00:25:57, 프로젝트명 : KLingo Project Documentation, 생성자 :
1.9.8