KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UTabButton.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#include "UTabButton.h"
4#include "UTabButtonGroup.h"
5#include "Components/Button.h"
6#include "Components/TextBlock.h"
7#include "Components/Image.h"
8
10{
11 Super::NativeConstruct();
12
13 if (Button_Tab)
14 {
15 Button_Tab->OnClicked.RemoveDynamic(this, &UTabButton::OnClicked);
16 Button_Tab->OnClicked.AddDynamic(this, &UTabButton::OnClicked);
17 }
18}
19
20void UTabButton::InitData(const int32 InTabIndex, UTabButtonGroup* InOwnerGroup)
21{
22 TabIndex = InTabIndex;
23 OwnerTabGroup = InOwnerGroup;
24}
25
26void UTabButton::SetSelected(const bool bIsSelected) const
27{
28 if (!OwnerTabGroup.IsValid())
29 return;
30
31 // Image_ActivateState의 Visibility 및 색상 설정
33 {
34 Image_ActivateState->SetVisibility(bIsSelected ? ESlateVisibility::HitTestInvisible : ESlateVisibility::Collapsed);
35 Image_ActivateState->SetColorAndOpacity(OwnerTabGroup->GetActivateColor(bIsSelected));
36 }
37
38 // Text 색상 변경
40 Txt_ButtonLabel->SetColorAndOpacity(OwnerTabGroup->GetTextColor(bIsSelected));
41}
42
43void UTabButton::SetLabel(const FText& InText) const
44{
45 Txt_ButtonLabel->SetText(InText);
46}
47
데이터를 기반으로 탭 버튼들을 동적으로 생성하고 관리하는 탭 그룹 위젯.
void SetSelected(const bool bIsSelected) const
이 버튼의 선택 상태를 갱신합니다.
void InitData(const int32 InTabIndex, class UTabButtonGroup *InOwnerGroup)
버튼을 초기화하는 함수. 부모 그룹에 의해 호출됩니다.
TObjectPtr< class UTextBlock > Txt_ButtonLabel
탭의 텍스트 라벨. 블루프린트에서 'Txt_ButtonLabel' 이름으로 생성해야 합니다.
Definition UTabButton.h:54
void SetLabel(const FText &InText) const
버튼의 텍스트 라벨을 설정합니다.
int32 TabIndex
이 탭 버튼의 그룹 내 인덱스
Definition UTabButton.h:65
TObjectPtr< class UImage > Image_ActivateState
탭이 선택되었을 때 활성화될 이미지 (예: 하이라이트 이미지). 블루프린트에서 'Image_ActivateState' 이름으로 생성해야 합니다.
Definition UTabButton.h:58
TWeakObjectPtr< class UTabButtonGroup > OwnerTabGroup
이 탭 버튼을 소유한 부모 그룹
Definition UTabButton.h:62
FOnTabButtonClicked OnTabButtonClicked
탭 버튼이 클릭되었을 때 발생하는 이벤트
Definition UTabButton.h:40
virtual void NativeConstruct() override
Definition UTabButton.cpp:9
void OnClicked()
버튼 클릭 시 호출될 내부 함수
TObjectPtr< class UButton > Button_Tab
클릭을 감지할 루트 버튼. 블루프린트에서 'Button_Tab' 이름으로 생성해야 합니다.
Definition UTabButton.h:50