60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "SCompoundWidget.h"
|
|
#include "SlateInvalidationRoot.h"
|
|
#include "SLeafWidget.h"
|
|
#include "Render/UpdatableTexture.h"
|
|
#include "Misc/CallRateLimiter.h"
|
|
|
|
class SUpdatableImage;
|
|
class FUpdatableTexture;
|
|
class FSlateUpdatableTexture;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
class ARONA_API SUpdatableImage : public SLeafWidget
|
|
{
|
|
friend class FUpdatableTexture;
|
|
public:
|
|
SUpdatableImage();
|
|
SLATE_BEGIN_ARGS(SUpdatableImage):
|
|
_UpdateInterval(0.1f),
|
|
_FixedWidth(),
|
|
_FixedHeight()
|
|
{}
|
|
|
|
SLATE_EVENT(FUpdatableImageDataEvent, OnPostResize)
|
|
SLATE_ARGUMENT(float, UpdateInterval)
|
|
SLATE_ARGUMENT(TOptional<int32>, FixedWidth)
|
|
SLATE_ARGUMENT(TOptional<int32>, FixedHeight)
|
|
SLATE_ARGUMENT(TOptional<int32>, MaxWidth)
|
|
SLATE_ARGUMENT(TOptional<int32>, MaxHeight)
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
/** Constructs this widget with InArgs */
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
void NeedRedraw();
|
|
|
|
void Resize(FIntPoint NewSize, bool Immediate = false);
|
|
|
|
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
|
|
virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override { return FVector2D(LastSize); }
|
|
|
|
TOptional<int32> FixedWidth;
|
|
TOptional<int32> FixedHeight;
|
|
TOptional<int32> MaxWidth;
|
|
TOptional<int32> MaxHeight;
|
|
private:
|
|
void AsyncUpdate() const;
|
|
|
|
mutable FVector2f LastSize;
|
|
TSharedPtr<FUpdatableTexture> Texture;
|
|
mutable bool ForceRedraw = false;
|
|
};
|