RapyutaSimulationPlugins
RRUserWidget.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 #include "Blueprint/UserWidget.h"
18 
19 #include "Components/PanelWidget.h"
20 
21 #include "Components/TextBlock.h"
22 
23 #include "Components/WidgetComponent.h"
24 
25 #include "IUMGModule.h"
26 
27 #include "Slate/SObjectWidget.h"
28 
29 #include "UMG.h"
30 
31 #include "UMGStyle.h"
32 
33 
34 
35 #include "RRUserWidget.generated.h"
36 
37 
38 
52 class RAPYUTASIMULATIONPLUGINS_API URRUserWidget : public UUserWidget
53 
54 {
55 
56 
57 
58 public:
59 
60 
65  UPanelWidget* MainPanelWidget = nullptr;
66 
67 
68 
70 
72 
73 
78  TObjectPtr<UWidgetComponent> OwnerWidgetComponent = nullptr;
79 
80 
81 
82 
87  UTextBlock* TextBlock = nullptr;
88 
89 
90 
91 public:
92 
93  virtual bool HasValidContents()
94 
95  {
96 
97  return MainPanelWidget && WidgetTree && TextBlock;
98 
99  }
100 
101 
102 
103  template<typename TChildWidget>
104 
105  TChildWidget* AddChildWidget(const TCHAR* InChildWidgetNameAffix)
106 
107  {
108 
109  TChildWidget* childWidget = WidgetTree->ConstructWidget<TChildWidget>(TChildWidget::StaticClass(), InChildWidgetNameAffix);
110 
111  verify(childWidget);
112 
113  verify(MainPanelWidget);
114 
115  MainPanelWidget->AddChild(childWidget);
116 
117  return childWidget;
118 
119  }
120 
121 
122 
123 
128  void SetActivated(bool bIsActivated);
129 
130 
131 
132 
137  void SetLabelText(const FString& InText);
138 
139 
140 
141 protected:
142 
144 
145  virtual TSharedRef<SWidget> RebuildWidget() override;
146 
147  virtual bool NativeSupportsKeyboardFocus() const override
148 
149  {
150 
151  return true;
152 
153  }
154 
155  virtual void SetupContents();
156 
157 };
158 
URRUserWidget::AddChildWidget
TChildWidget * AddChildWidget(const TCHAR *InChildWidgetNameAffix)
Definition: RRUserWidget.h:105
URRUserWidget
Base user widget, inheriting from UUserWidget
Definition: RRUserWidget.h:52
URRUserWidget::HasValidContents
virtual bool HasValidContents()
Definition: RRUserWidget.h:93
URRUserWidget::NativeSupportsKeyboardFocus
virtual bool NativeSupportsKeyboardFocus() const override
Definition: RRUserWidget.h:147