This class manages downloading an image and swapping it out a standin once it's done. 更多...
#include <WebImage.h>
类 FWebImage 继承关系图:Public 成员函数 | |
| TAttribute< const FSlateBrush * > | Attr () const |
| Use .Attr() to pass this brush into a slate attribute | |
| FORCEINLINE bool | BeginDownload (const FString &InUrl, const FOnImageDownloaded &DownloadCallback) |
| Begin downloading an image. | |
| bool | BeginDownload (const FString &InUrl, const TOptional< FString > &StandInETag=TOptional< FString >(), const FOnImageDownloaded &DownloadCallback=FOnImageDownloaded()) |
| Begin downloading an image. 更多... | |
| void | CancelDownload () |
| Cancel any download in progress | |
| DECLARE_DELEGATE_OneParam (FOnImageDownloaded, bool) | |
| Fired when the image finishes downloading or is canceled. 更多... | |
| FORCEINLINE bool | DidDownloadFail () const |
| Has the download finished AND did it fail | |
| FORCEINLINE bool | DidDownloadSucceed () const |
| Has the download finished AND was it successful | |
| FORCEINLINE const FSlateBrush * | GetBrush () const |
| Get the current brush displayed (will automatically change when download completes) | |
| FORCEINLINE const FSlateBrush * | GetDownloadedBrush () const |
| Only returns the downloaded brush. 更多... | |
| FORCEINLINE const TOptional< FString > & | GetETag () const |
| What is the ETag of the downloaded resource | |
| FORCEINLINE const FString & | GetUrl () const |
| What URL was requested | |
| FORCEINLINE bool | IsDownloadPending () const |
| Is there a pending HTTP request | |
| FORCEINLINE FWebImage & | SetStandInBrush (TAttribute< const FSlateBrush * > StandInBrushIn) |
| Set the brush that is currently being returned (this will be overridden when any async download completes) | |
Public 成员函数 继承自 TSharedFromThis< FWebImage > | |
| TSharedRef< FWebImage, Mode > | AsShared () |
| Provides access to a shared reference to this object. 更多... | |
| TSharedRef< FWebImage const, Mode > | AsShared () const |
| Provides access to a shared reference to this object (const.) Note that is only valid to call this after a shared reference (or shared pointer) to the object has already been created. 更多... | |
| FORCEINLINE bool | DoesSharedInstanceExist () const |
| Checks whether our referenced instance is valid (ie, whether it's safe to call AsShared). 更多... | |
| FORCEINLINE void | UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, Mode > const *InSharedPtr, OtherType *InObject) const |
| INTERNAL USE ONLY – Do not call this method. 更多... | |
| FORCEINLINE void | UpdateWeakReferenceInternal (TSharedRef< SharedRefType, Mode > const *InSharedRef, OtherType *InObject) const |
| INTERNAL USE ONLY – Do not call this method. 更多... | |
额外继承的成员函数 | |
Protected 成员函数 继承自 TSharedFromThis< FWebImage > | |
| FORCEINLINE TSharedFromThis & | operator= (TSharedFromThis const &) |
| Hidden stub assignment operator | |
| TSharedFromThis () | |
| Hidden stub constructor | |
| TSharedFromThis (TSharedFromThis const &) | |
| Hidden stub copy constructor | |
| ~TSharedFromThis () | |
| Hidden destructor | |
静态 Protected 成员函数 继承自 TSharedFromThis< FWebImage > | |
| static FORCEINLINE TSharedRef< OtherType const, Mode > | SharedThis (const OtherType *ThisPtr) |
| Provides access to a shared reference to an object, given the object's 'this' pointer. 更多... | |
| static FORCEINLINE TSharedRef< OtherType, Mode > | SharedThis (OtherType *ThisPtr) |
| Provides access to a shared reference to an object, given the object's 'this' pointer. 更多... | |
This class manages downloading an image and swapping it out a standin once it's done.
Example (not cached): FWebImage Image; Image.SetStandInBrush(FStyle::Get()->GetBrush("Foo")); Image.BeginDownload(Url, OptionalCallback);
SNew(SImage) .Image(Image.Attr())
You may want to get your FWebImage from a FWebImageCache so we're not re-downloading the same URL all the time.
Example (cached): FWebImageCache ImageCache; // usually global ImageCache.SetStandInBrush(FStyle::Get()->GetBrush("Foo"));
SNew(SImage) .Image(ImageCache.Download(Url)->Attr())
| bool FWebImage::BeginDownload | ( | const FString & | InUrl, |
| const TOptional< FString > & | StandInETag = TOptional< FString >(), |
||
| const FOnImageDownloaded & | DownloadCallback = FOnImageDownloaded() |
||
| ) |
Begin downloading an image.
This will automatically set the current brush to the downloaded image when it completes (if successful)
| FWebImage::DECLARE_DELEGATE_OneParam | ( | FOnImageDownloaded | , |
| bool | |||
| ) |
Fired when the image finishes downloading or is canceled.
| Success | True if the downloaded image will now be returned by GetBrush() |
|
inline |
Only returns the downloaded brush.
May be null if the download hasn't finished or was unsuccessful