UCohtmlWidget
#include <CohtmlWidget.h>
Inherits from UWidget
Public Functions
Name | |
---|---|
virtual | ~UCohtmlWidget() |
virtual void | ReleaseSlateResources(bool bReleaseChildren) override |
virtual TSharedRef< SWidget > | RebuildWidget() override |
virtual void | SynchronizeProperties() override |
virtual TSharedPtr< SCohtmlWidget > | CreateSCohtmlWidget() |
void | Tick(float DeltaTime) |
TSharedPtr< SCohtmlWidget > | GetCoherentWidget() |
FORCEINLINE bool | NeedToPaint() const |
void | SetSoundAttenuation(const FSoundAttenuationSettings & Settings) |
void | SetInputPropagationBehaviour(ECohtmlInputPropagationBehaviour::Type Propagation) |
ECohtmlInputPropagationBehaviour::Type | GetInputPropagationBehaviour() const |
bool | IsReadyToCreateView() const |
bool | IsReadyForBindings() const |
bool | HasRequestedView() const |
void | ShowPaintRects(bool show) |
void | Load(const FString & path) |
void | Reload() |
UTextureRenderTarget2D * | GetRenderTexture() const |
UCohtmlJSEvent * | CreateJSEvent() |
void | TriggerJSEvent(const FString & name, UCohtmlJSEvent * eventData) const |
void | CreateDataModelFromObject(const FString & Name, UObject * Model) |
void | RemoveDataModelFromObject(UObject * Model) |
void | CreateDataModelFromStruct(const FString & Name, const TFieldPath< FStructProperty > Struct) |
void | UpdateWholeDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const |
void | RemoveDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const |
void | UpdateWholeDataModelFromObject(UObject * Model) const |
void | SynchronizeModels() const |
void | PreloadTextureSync(const FString & AssetPath) |
void | PreloadTextureAsync(const FString & AssetPath) |
void | AddPreloadedTexture(UTexture2D * Texture) |
bool | RemovePreloadedTextureFromPath(const FString & AssetPath) |
bool | RemovePreloadedTexture(UTexture2D * Texture) |
void | RemoveAllPreloadedTextures() |
DECLARE_FUNCTION(execCreateDataModelFromStruct ) | |
DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct ) | |
DECLARE_FUNCTION(execRemoveDataModelFromStruct ) | |
cohtml::View * | GetView() const |
virtual void | BeginDestroy() override |
virtual bool | IsReadyForFinishDestroy() override |
virtual void | FinishDestroy() override |
int32 | GetUserIndex() |
void | SetInputFocusToUI() |
void | RestoreInputFocusFromUI(bool bForceFocusToGame =false) |
FCohtmlCaretRect | GetCaretRect() const |
void | SetCaretRect(int x, int y, unsigned width, unsigned height) |
cohtml::ECohtmlPageLoadState | GetCurrentPageState() const |
UMultithreadAwareCompositorWrapper * | GetWidgetCompositor() |
Public Attributes
Name | |
---|---|
AActor * | Owner |
FCohtmlWidgetTickFunction | WidgetTick |
FCohtmlReadyForBindings | ReadyForBindings |
FCohtmlBindingsReleased | BindingsReleased |
FCohtmlScriptingReady | ScriptingReady |
FCohtmlScriptContextCreated | ScriptContextCreated |
FCohtmlDOMBuilt | DOMBuilt |
FCohtmlFinishLoad | FinishLoad |
FCohtmlLoadFailed | LoadFailed |
FCohtmlOnNavigateTo | OnNavigateTo |
bool | bEnableComplexCSSSupport |
TEnumAsByte< enum TextureFilter > | Filter |
bool | bReceiveInput |
TEnumAsByte< ECohtmlInputPropagationBehaviour::Type > | InputPropagationBehaviour |
bool | bUseSurfacePartitioning |
bool | bRunAdvanceConcurrently |
TEnumAsByte< ECohtmlTickGroup > | TickGroup |
TArray< UTexture2D * > | PreloadedTextures |
FString | URL |
Protected Attributes
Name | |
---|---|
TSharedPtr< SCohtmlWidget > | CoherentWidget |
Friends
Name | |
---|---|
class | TCohtmlViewListener< UCohtmlWidget > |
Detailed Description
class UCohtmlWidget;
A HTML5 control powered by Gameface.
Public Functions Documentation
function ~UCohtmlWidget
virtual ~UCohtmlWidget()
function ReleaseSlateResources
virtual void ReleaseSlateResources(
bool bReleaseChildren
) override
function RebuildWidget
virtual TSharedRef< SWidget > RebuildWidget() override
function SynchronizeProperties
virtual void SynchronizeProperties() override
function CreateSCohtmlWidget
virtual TSharedPtr< SCohtmlWidget > CreateSCohtmlWidget()
function Tick
void Tick(
float DeltaTime
)
function GetCoherentWidget
TSharedPtr< SCohtmlWidget > GetCoherentWidget()
function NeedToPaint
inline FORCEINLINE bool NeedToPaint() const
function SetSoundAttenuation
void SetSoundAttenuation(
const FSoundAttenuationSettings & Settings
)
Sets the AttenuationSettings for the Sound Components Note: Sound is 2D by default. It can be changed to 3D if appropriate AttenuationSettings is set. For more details look at Unreal’s documentation for AttenuationSettings.
function SetInputPropagationBehaviour
void SetInputPropagationBehaviour(
ECohtmlInputPropagationBehaviour::Type Propagation
)
Sets the type of input that the widget will propagate to the game
function GetInputPropagationBehaviour
ECohtmlInputPropagationBehaviour::Type GetInputPropagationBehaviour() const
Gets the type of input that the widget will propagate to the game
function IsReadyToCreateView
bool IsReadyToCreateView() const
Tells if the View is ready to be created
function IsReadyForBindings
bool IsReadyForBindings() const
Tells if the View is ready for binding operations
function HasRequestedView
bool HasRequestedView() const
Tells if a View has been scheduled for creation
function ShowPaintRects
void ShowPaintRects(
bool show
)
Tells the view to show/hide debug paint rectangles
function Load
void Load(
const FString & path
)
Requests a new URL to be loaded in the View
function Reload
void Reload()
Requests the View to reload the current URL
function GetRenderTexture
UTextureRenderTarget2D * GetRenderTexture() const
Gives access to the UI Texture
function CreateJSEvent
UCohtmlJSEvent * CreateJSEvent()
Creates an event that will be executed in JavaScript
function TriggerJSEvent
void TriggerJSEvent(
const FString & name,
UCohtmlJSEvent * eventData
) const
Triggers an event in JavaScript
function CreateDataModelFromObject
void CreateDataModelFromObject(
const FString & Name,
UObject * Model
)
Creates a global variable (data model) in JavaScript from an UObject
function RemoveDataModelFromObject
void RemoveDataModelFromObject(
UObject * Model
)
Removes a global variable (data model) in JavaScript from a UObject
function CreateDataModelFromStruct
void CreateDataModelFromStruct(
const FString & Name,
const TFieldPath< FStructProperty > Struct
)
Creates a global variable (data model) in JavaScript from a UStruct
function UpdateWholeDataModelFromStruct
void UpdateWholeDataModelFromStruct(
const TFieldPath< FStructProperty > Struct
) const
Marks a Struct model for update. The UI using this data model will be updated during the next call to SynchronizeModels. For optimum performance, call SynchronizeModels as rarely as possible (e.g. once per frame).
function RemoveDataModelFromStruct
void RemoveDataModelFromStruct(
const TFieldPath< FStructProperty > Struct
) const
Removes a global variable (data model) in JavaScript from a UStruct
function UpdateWholeDataModelFromObject
void UpdateWholeDataModelFromObject(
UObject * Model
) const
Marks an Object model for update. The UI using this data model will be updated during the next call to SynchronizeModels. For optimum performance, call SynchronizeModels as rarely as possible (e.g. once per frame).
function SynchronizeModels
void SynchronizeModels() const
Synchronize all models marked for update.
function PreloadTextureSync
void PreloadTextureSync(
const FString & AssetPath
)
Loads a Texture Synchronously (BLOCKING the main thread) from asset Path. Once loaded, the Texture will be added to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.
function PreloadTextureAsync
void PreloadTextureAsync(
const FString & AssetPath
)
Loads a Texture Asynchronously from asset Path. Once loaded, the Texture will be added to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.
function AddPreloadedTexture
void AddPreloadedTexture(
UTexture2D * Texture
)
Adds an already loaded Texture to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.
function RemovePreloadedTextureFromPath
bool RemovePreloadedTextureFromPath(
const FString & AssetPath
)
Removes a Texture from the PreloadedTextures collection. This can be used when you no longer need a specific texture inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: The removal of elements is an operation with linear complexity, consider using RemoveAllPreloadedTextures instead. Note: Upon destruction of the CohtmlWidget, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.
function RemovePreloadedTexture
bool RemovePreloadedTexture(
UTexture2D * Texture
)
Removes all Textures from the PreloadedTextures collection. This can be used when you no longer need any of the textures inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: The removal of elements is an operation with linear complexity, consider using RemoveAllPreloadedTextures instead. Note: Upon destruction of the CohtmlWidget, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.
function RemoveAllPreloadedTextures
void RemoveAllPreloadedTextures()
Removes all Textures from the PreloadedTextures collection. This can be used when you no longer need any of the textures inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: Upon destruction of the CohtmlWidget, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.
function DECLARE_FUNCTION
DECLARE_FUNCTION(
execCreateDataModelFromStruct
)
function DECLARE_FUNCTION
DECLARE_FUNCTION(
execUpdateWholeDataModelFromStruct
)
function DECLARE_FUNCTION
DECLARE_FUNCTION(
execRemoveDataModelFromStruct
)
function GetView
cohtml::View * GetView() const
function BeginDestroy
virtual void BeginDestroy() override
function IsReadyForFinishDestroy
virtual bool IsReadyForFinishDestroy() override
function FinishDestroy
virtual void FinishDestroy() override
function GetUserIndex
int32 GetUserIndex()
function SetInputFocusToUI
void SetInputFocusToUI()
function RestoreInputFocusFromUI
void RestoreInputFocusFromUI(
bool bForceFocusToGame =false
)
function GetCaretRect
FCohtmlCaretRect GetCaretRect() const
function SetCaretRect
void SetCaretRect(
int x,
int y,
unsigned width,
unsigned height
)
function GetCurrentPageState
cohtml::ECohtmlPageLoadState GetCurrentPageState() const
function GetWidgetCompositor
inline UMultithreadAwareCompositorWrapper * GetWidgetCompositor()
Public Attributes Documentation
variable Owner
AActor * Owner;
Gets or sets the Actor containing any LiveViewComponents.
variable WidgetTick
FCohtmlWidgetTickFunction WidgetTick;
Main tick function for the Widget
variable ReadyForBindings
FCohtmlReadyForBindings ReadyForBindings;
When fired, the View is ready for binding events. Any event bound prior to this will be ignored
variable BindingsReleased
FCohtmlBindingsReleased BindingsReleased;
When fired, the View has released its bindings.
variable ScriptingReady
FCohtmlScriptingReady ScriptingReady;
Called when the View is ready to accept events
variable ScriptContextCreated
FCohtmlScriptContextCreated ScriptContextCreated;
Called immediately after the View’s script context has been created for the page. This happens before starting to build the DOM.
variable DOMBuilt
FCohtmlDOMBuilt DOMBuilt;
Called when the View’s DOM for the pages is fully constructed, but the referenced resources may not finish loading.
variable FinishLoad
FCohtmlFinishLoad FinishLoad;
Called when a View’s navigation change request failed.
variable LoadFailed
FCohtmlLoadFailed LoadFailed;
Called when the View’s page, including the resources it refers to, is completely loaded and initialized.
variable OnNavigateTo
FCohtmlOnNavigateTo OnNavigateTo;
Called whenever the View is about to navigate to a different URL. You can return false to stop the navigation to the URL.
variable bEnableComplexCSSSupport
bool bEnableComplexCSSSupport;
Whether to enable support for complex CSS selectors (e.g. div > p, div ~ p)
variable Filter
TEnumAsByte< enum TextureFilter > Filter;
variable bReceiveInput
bool bReceiveInput;
Indicates whether input is forwarded to this view
variable InputPropagationBehaviour
TEnumAsByte< ECohtmlInputPropagationBehaviour::Type > InputPropagationBehaviour;
Indicates the type of input this view forwards to the game
variable bUseSurfacePartitioning
bool bUseSurfacePartitioning;
Enables the Surface Partitioning mode, which does not create a texture for your view, but instead draws separate parts of the HTML in separate small textures. Useful when you have a view with a high resolution that is mostly empty, apart from some content in the corners of the screen that you can draw separately, omitting the big screen texture that you would have otherwise.
variable bRunAdvanceConcurrently
bool bRunAdvanceConcurrently;
When enabled, forces cohtml::View::Advance to be scheduled on background tasks, reducing the load on the game thread. This imposes restrictions on what View operations can be performed on the Game Thread. Please see the documentation for more details.
variable TickGroup
TEnumAsByte< ECohtmlTickGroup > TickGroup;
Sets the tick group in which this component will be ticked and Advance the View. If set to “No tick”, this component will not tick on its own. You are expected to call its Tick function manually from your own code. Useful if you want to control the exact time at which to Advance the View.
variable PreloadedTextures
TArray< UTexture2D * > PreloadedTextures;
PreloadedTextures collection, keeping the Textures loaded and ready for use. Ideally, the Textures are to be loaded ahead of time and kept in this collection for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.
variable URL
FString URL;
The URL to load when the View is created
Protected Attributes Documentation
variable CoherentWidget
TSharedPtr< SCohtmlWidget > CoherentWidget;
Friends
friend TCohtmlViewListener< UCohtmlWidget >
friend class TCohtmlViewListener< UCohtmlWidget >;