A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
SDialogueNodeOverlayWidget.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
3
4#include "Widgets/SOverlay.h"
5#include "Widgets/Layout/SBox.h"
6#include "Widgets/Layout/SBorder.h"
7
8#include "DialogueStyle.h"
9
11// SDialogueNodeOverlayWidget
12void SDialogueNodeOverlayWidget::Construct(const FArguments& InArgs)
13{
14 OnHoverStateChangedEvent = InArgs._OnHoverStateChanged;
15 OnGetBackgroundColorEvent = InArgs._OnGetBackgroundColor;
16 OverlayBody = InArgs._OverlayBody.Get();
17
18 const FSlateBrush* CircleBrush = FDialogueStyle::Get()->GetBrush(FDialogueStyle::PROPERTY_GraphNodeCircleBox);
19 ChildSlot
20 [
21 SNew(SOverlay)
22 +SOverlay::Slot()
23 .HAlign(HAlign_Fill)
24 .VAlign(VAlign_Fill)
25 [
26 // Add a dummy box here to make sure the widget doesnt get smaller than the brush
27 SNew(SBox)
28 .WidthOverride(CircleBrush->ImageSize.X)
29 .HeightOverride(CircleBrush->ImageSize.Y)
30 ]
31
32 +SOverlay::Slot()
33 .HAlign(HAlign_Fill)
34 .VAlign(VAlign_Fill)
35 [
36 SNew(SBorder)
37 .BorderImage(CircleBrush)
38 .BorderBackgroundColor(this, &Self::GetBackgroundColor)
39 .Padding(FMargin(4.0f))
40 .VAlign(VAlign_Center)
41 .HAlign(HAlign_Center)
42 [
43 OverlayBody.ToSharedRef()
44 ]
45 ]
46 ];
47}
static const FName PROPERTY_GraphNodeCircleBox
static TSharedPtr< ISlateStyle > Get()
FOnGetBackgroundColor OnGetBackgroundColorEvent
void Construct(const FArguments &InArgs)
FOnHoverStateChanged OnHoverStateChangedEvent