-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
Source/SlateExample/Slate/ExampleComplex/ExampleComplexWidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "ExampleComplexWidget.h" | ||
#include "SExampleComplexWidget.h" | ||
|
||
void UExampleComplexWidget::ReleaseSlateResources(bool bReleaseChildren) | ||
{ | ||
Super::ReleaseSlateResources(bReleaseChildren); | ||
|
||
MyExampleComplexWidget.Reset(); | ||
} | ||
|
||
void UExampleComplexWidget::SynchronizeProperties() | ||
{ | ||
Super::SynchronizeProperties(); | ||
} | ||
|
||
TSharedRef<SWidget> UExampleComplexWidget::RebuildWidget() | ||
{ | ||
MyExampleComplexWidget = SNew(SExampleComplexWidget); | ||
|
||
return MyExampleComplexWidget.ToSharedRef(); | ||
} |
22 changes: 22 additions & 0 deletions
22
Source/SlateExample/Slate/ExampleComplex/ExampleComplexWidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Components/Widget.h" | ||
#include "ExampleComplexWidget.generated.h" | ||
|
||
UCLASS() | ||
class UExampleComplexWidget : public UWidget | ||
{ | ||
private: | ||
GENERATED_BODY() | ||
public: | ||
virtual void ReleaseSlateResources(bool bReleaseChildren) override; | ||
virtual void SynchronizeProperties() override; | ||
|
||
protected: | ||
//~ Begin UWidget Interface | ||
virtual TSharedRef<SWidget> RebuildWidget() override; | ||
//~ End UWidget Interface | ||
|
||
TSharedPtr<class SExampleComplexWidget> MyExampleComplexWidget; | ||
}; |
46 changes: 46 additions & 0 deletions
46
Source/SlateExample/Slate/ExampleComplex/SExampleComplexWidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "SExampleComplexWidget.h" | ||
#include "SlateOptMacros.h" | ||
#include "Widgets/Images/SImage.h" | ||
|
||
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION | ||
|
||
void SExampleComplexWidget::Construct(const FArguments& InArgs) | ||
{ | ||
TSharedPtr<SHorizontalBox> Box = SNew(SHorizontalBox); | ||
ChildSlot | ||
[ | ||
Box.ToSharedRef() | ||
]; | ||
|
||
auto& FirstSlot = Box->AddSlot() | ||
.AutoWidth() | ||
.Padding(5); | ||
|
||
FirstSlot[ SNew(SImage) ]; | ||
|
||
/* | ||
ChildSlot | ||
[ | ||
SNew(SHorizontalBox) | ||
+ SHorizontalBox::Slot() | ||
.AutoWidth() | ||
.Padding(5) | ||
[ | ||
SNew(SImage) | ||
] | ||
+ SHorizontalBox::Slot() | ||
.FillWidth(1.0f) | ||
.Padding(10) | ||
[ | ||
SNew(SBox) | ||
.MinDesiredWidth(200) | ||
[ | ||
SNew(SButton) | ||
.Text(NSLOCTEXT("Ex","Click","Click me")) | ||
] | ||
] | ||
]; | ||
*/ | ||
} | ||
|
||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION |
18 changes: 18 additions & 0 deletions
18
Source/SlateExample/Slate/ExampleComplex/SExampleComplexWidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Widgets/SCompoundWidget.h" | ||
|
||
class SExampleComplexWidget : public SCompoundWidget | ||
{ | ||
public: | ||
SLATE_BEGIN_ARGS(SExampleComplexWidget) | ||
{} // | ||
SLATE_END_ARGS() | ||
|
||
void Construct(const FArguments& InArgs); | ||
protected: | ||
FSlateFontInfo Font; | ||
|
||
TSharedPtr<STextBlock> TextBlock; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters