Forked from BaeMinCheon/RichTextBlockSomeWidgetDecorator.h
Created
February 9, 2025 21:06
-
-
Save Adlerkampf/06997b2e34514ee1492668214fa23c7e to your computer and use it in GitHub Desktop.
Custom RichTextBlockDecorator example code #1
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
// https://baemincheon.github.io/2022/07/28/how-the-rich-text-block-works-in-unrealengine/ | |
#pragma once | |
#include "CoreMinimal.h" | |
#include "UObject/ObjectMacros.h" | |
#include "UObject/Object.h" | |
#include "Fonts/SlateFontInfo.h" | |
#include "Styling/SlateTypes.h" | |
#include "Framework/Text/TextLayout.h" | |
#include "Framework/Text/ISlateRun.h" | |
#include "Framework/Text/ITextDecorator.h" | |
#include "Components/RichTextBlockDecorator.h" | |
#include "Engine/DataTable.h" | |
#include "RichTextBlockSomeWidgetDecorator.generated.h" | |
class ISlateStyle; | |
USTRUCT(Blueprintable, BlueprintType) | |
struct FRichSomeWidgetRow : public FTableRowBase | |
{ | |
GENERATED_BODY() | |
public: | |
UPROPERTY(EditAnywhere, Category = Appearance) | |
FSlateBrush Brush; | |
UPROPERTY(EditAnywhere, Category = Appearance) | |
FText Text; | |
}; | |
UCLASS(Abstract, Blueprintable) | |
class URichTextBlockSomeWidgetDecorator : public URichTextBlockDecorator | |
{ | |
GENERATED_BODY() | |
public: | |
URichTextBlockSomeWidgetDecorator(const FObjectInitializer& ObjectInitializer); | |
virtual TSharedPtr<ITextDecorator> CreateDecorator(URichTextBlock* InOwner) override; | |
virtual const FRichSomeWidgetRow* FindSomeWidgetRow(FName TagOrId, bool bWarnIfMissing); | |
protected: | |
FRichSomeWidgetRow* FindRow(FName TagOrId, bool bWarnIfMissing); | |
UPROPERTY(EditAnywhere, Category=Appearance, meta = (RequiredAssetDataTags = "RowStructure=RichSomeWidgetRow")) | |
TObjectPtr<class UDataTable> ImageSet; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment