Skip to content
SiteEmail

UCohtmlWidget

More…

#include <CohtmlWidget.h>

Inherits from UWidget

Name
typedef TArray< TWeakObjectPtr< UObject > >WeakCohUIHoldersArray
Name
virtual~UCohtmlWidget()
virtual voidReleaseSlateResources(bool bReleaseChildren) override
virtual TSharedRef< SWidget >RebuildWidget() override
virtual voidSynchronizeProperties() override
virtual TSharedPtr< SCohtmlWidget >CreateSCohtmlWidget()
voidTick(float DeltaTime)
TSharedPtr< SCohtmlWidget >GetCoherentWidget()
FORCEINLINE boolNeedToPaint() const
cohtml::IInputProxy *GetFocusedInput()
voidSetSoundAttenuation(const FSoundAttenuationSettings & Settings)
voidSetInputPropagationBehaviour(ECohtmlInputPropagationBehaviour::Type Propagation)
ECohtmlInputPropagationBehaviour::TypeGetInputPropagationBehaviour() const
boolIsReadyToCreateView() const
boolIsReadyForBindings() const
boolHasRequestedView() const
voidShowPaintRects(bool bShow)
voidLoad(const FString & Path)
voidReload()
voidDebugSaveNextFrame()
voidBeginDebugFrameSave()
voidEndDebugFrameSave()
UTextureRenderTarget2D *GetRenderTexture() const
UCohtmlJSEvent *CreateJSEvent()
voidTriggerJSEvent(const FString & name, UCohtmlJSEvent * eventData) const
voidRegisterForEvent(UPARAM(DisplayName=“UI Event Name”) FString UIEventName, UPARAM(DisplayName=“Event”) FCohtmlJSEventBPCallback Delegate)
voidRegisterForCustomEvent(UPARAM(DisplayName=“UI Event Name”) const FString & UIEventName, UPARAM(DisplayName=“Custom Event node Owner”) UObject * CustomEventOwner, UPARAM(DisplayName=“Custom Event node Name”) const FString & CustomEventNodeName)
voidCreateDataModelFromObject(const FString & Name, UObject * Model)
voidRemoveDataModelFromObject(UObject * Model)
voidCreateDataModelFromStruct(const FString & Name, const TFieldPath< FStructProperty > Struct)
voidUpdateWholeDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const
voidRemoveDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const
voidUpdateWholeDataModelFromObject(UObject * Model) const
voidSynchronizeModels() const
voidPreloadTextureSync(const FString & AssetPath)
voidPreloadTextureAsync(const FString & AssetPath)
voidAddPreloadedTexture(UTexture2D * Texture)
boolRemovePreloadedTextureFromPath(const FString & AssetPath)
boolRemovePreloadedTexture(UTexture2D * Texture)
voidRemoveAllPreloadedTextures()
DECLARE_FUNCTION(execCreateDataModelFromStruct )
DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct )
DECLARE_FUNCTION(execRemoveDataModelFromStruct )
cohtml::View *GetView() const
virtual voidBeginDestroy() override
virtual boolIsReadyForFinishDestroy() override
virtual voidFinishDestroy() override
uint32GetUserIndex()
uint32GetOwningPlayerID()
voidSetInputFocusToUI()
voidRestoreInputFocusFromUI(bool bForceFocusToGame =false)
voidUpdateLastSavedViewSettings(cohtml::ViewSettings & NewSettings)
FCohtmlCaretRectGetCaretRect() const
voidSetCaretRect(int x, int y, unsigned width, unsigned height)
cohtml::ECohtmlPageLoadStateGetCurrentPageState() const
TSharedPtr< TCohtmlViewListener< UCohtmlWidget > >GetViewListener()
WeakCohUIHoldersArray::TIteratorGetCohUIHoldersIterator(UWorld * World)
Name
boolbResetSWidget
TObjectPtr< AActor >Owner
FCohtmlWidgetTickFunctionWidgetTick
FCohtmlReadyForBindingsReadyForBindings
FCohtmlScriptingReadyScriptingReady
FCohtmlBindingsReleasedBindingsReleased
FCohtmlScriptContextCreatedScriptContextCreated
FCohtmlDOMBuiltDOMBuilt
FCohtmlFinishLoadFinishLoad
FCohtmlLoadFailedLoadFailed
FCohtmlOnNavigateToOnNavigateTo
boolbEnableComplexCSSSupport
TEnumAsByte< enum TextureFilter >Filter
boolbReceiveInput
TEnumAsByte< ECohtmlInputPropagationBehaviour::Type >InputPropagationBehaviour
ECohtmlMultiTouchEventsHandlingMultiTouchEventsHandling
boolbExecuteCommandProcessingWithLayout
boolbUseSurfacePartitioning
boolbRunAdvanceConcurrently
TEnumAsByte< ECohtmlTickGroup >TickGroup
TArray< TObjectPtr< UTexture2D > >PreloadedTextures
TArray< CohtmlDelegateFunctorWrapper >JSEventCallbackWrappers
FStringURL
Name
TSharedPtr< SCohtmlWidget >CoherentWidget
Name
classTCohtmlViewListener< UCohtmlWidget >
class UCohtmlWidget;

A HTML5 control powered by Gameface.

typedef TArray<TWeakObjectPtr<UObject> > UCohtmlWidget::WeakCohUIHoldersArray;
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()
inline FORCEINLINE bool NeedToPaint() const
cohtml::IInputProxy * GetFocusedInput()
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.

void SetInputPropagationBehaviour(
ECohtmlInputPropagationBehaviour::Type Propagation
)

Sets the type of input that the widget will propagate to the game

ECohtmlInputPropagationBehaviour::Type GetInputPropagationBehaviour() const

Gets the type of input that the widget will propagate to the game

bool IsReadyToCreateView() const

Tells if the View is ready to be created

bool IsReadyForBindings() const

Tells if the View is ready for binding operations

bool HasRequestedView() const

Tells if a View has been scheduled for creation

void ShowPaintRects(
bool bShow
)

Tells the view to show/hide debug paint rectangles

void Load(
const FString & Path
)

Requests a new URL to be loaded in the View

void Reload()

Requests the View to reload the current URL

void DebugSaveNextFrame()

Saves next render frame to disk

void BeginDebugFrameSave()

Starts saving render frames to disk

void EndDebugFrameSave()

Stops saving render frames to disk

UTextureRenderTarget2D * GetRenderTexture() const

Gives access to the UI Texture

UCohtmlJSEvent * CreateJSEvent()

Creates a UI event data that can be used when triggering event in scripting

void TriggerJSEvent(
const FString & name,
UCohtmlJSEvent * eventData
) const
void RegisterForEvent(
UPARAM(DisplayName="UI Event Name") FString UIEventName,
UPARAM(DisplayName="Event") FCohtmlJSEventBPCallback Delegate
)

You can use this to bind a Blueprint event to an arbitrary scripting event. The Blueprint event must have no parameters. DEPRECATED: This will be removed in future releases in favor of the new RegisterForEvent which works with any Custom Event nodes.

void RegisterForCustomEvent(
UPARAM(DisplayName="UI Event Name") const FString & UIEventName,
UPARAM(DisplayName="Custom Event node Owner") UObject * CustomEventOwner,
UPARAM(DisplayName="Custom Event node Name") const FString & CustomEventNodeName
)

You can use this to tie a Blueprint Custom Event node to an arbitrary View scripting event.

  • Your Blueprint Custom Event node can have any number of parameters as long as they are primitive types, FString, FText, or FName.
  • You don’t have to connect the Blueprint Custom Event node itself to anything, the View itself will execute it.
void CreateDataModelFromObject(
const FString & Name,
UObject * Model
)

Creates a global variable (data model) in scripting from an UObject

void RemoveDataModelFromObject(
UObject * Model
)

Removes a global variable (data model) in scripting from a UObject

void CreateDataModelFromStruct(
const FString & Name,
const TFieldPath< FStructProperty > Struct
)

Creates a global variable (data model) in scripting from a UStruct

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).

void RemoveDataModelFromStruct(
const TFieldPath< FStructProperty > Struct
) const

Removes a global variable (data model) in scripting from a UStruct

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).

void SynchronizeModels() const

Synchronize all models marked for update.

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.

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.

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.

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.

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.

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.

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
uint32 GetUserIndex()
uint32 GetOwningPlayerID()
void SetInputFocusToUI()
void RestoreInputFocusFromUI(
bool bForceFocusToGame =false
)
void UpdateLastSavedViewSettings(
cohtml::ViewSettings & NewSettings
)
FCohtmlCaretRect GetCaretRect() const
void SetCaretRect(
int x,
int y,
unsigned width,
unsigned height
)
cohtml::ECohtmlPageLoadState GetCurrentPageState() const
inline TSharedPtr< TCohtmlViewListener< UCohtmlWidget > > GetViewListener()
static WeakCohUIHoldersArray::TIterator GetCohUIHoldersIterator(
UWorld * World
)
bool bResetSWidget;

If you intend to keep the UWidget alive between level transitions and you want to keep the View alive you should set this to false.

TObjectPtr< AActor > Owner;

Gets or sets the Actor containing any LiveViewComponents.

FCohtmlWidgetTickFunction WidgetTick;

Main tick function for the Widget

FCohtmlReadyForBindings ReadyForBindings;

Fired when the View is ready for binding events. Any event bound prior to this will be ignored

FCohtmlScriptingReady ScriptingReady;

Fired when the View’s document is fully loaded and the “ready for bindings” event has completed

FCohtmlBindingsReleased BindingsReleased;

Fired when the View has released its bindings

FCohtmlScriptContextCreated ScriptContextCreated;

Called immediately after the View’s script context has been created for the page. This happens before starting to build the DOM.

FCohtmlDOMBuilt DOMBuilt;

Called when the View’s DOM for the pages is fully constructed, but the referenced resources may not finish loading.

FCohtmlFinishLoad FinishLoad;

Called when a View’s navigation change request failed.

FCohtmlLoadFailed LoadFailed;

Called when the View’s page, including the resources it refers to, is completely loaded and initialized.

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.

bool bEnableComplexCSSSupport;

Whether to enable support for complex CSS selectors (e.g. div > p, div ~ p)

TEnumAsByte< enum TextureFilter > Filter;
bool bReceiveInput;

Indicates whether input is forwarded to this view

TEnumAsByte< ECohtmlInputPropagationBehaviour::Type > InputPropagationBehaviour;

Indicates the type of input this view forwards to the game

ECohtmlMultiTouchEventsHandling MultiTouchEventsHandling;

Indicates whether Touch events (Touch Down, Touch Move and Touch Up) should be gathered and handled by the UI together at the end of the Input frame or separately - one by one. Please note that Multi Touch events handling will have a side effect on the input propagation as we can no longer check whether the UI handles every single touch or not, because events are processed later in bulk.

variable bExecuteCommandProcessingWithLayout

Section titled “variable bExecuteCommandProcessingWithLayout”
bool bExecuteCommandProcessingWithLayout;

Tells the View to process all collected front-end commands right after the layout execution on the same thread. Note: This option is mandatory when using the Custom Effects and/or the Compositor API features. Note: When this setting is enabled, the rendering library will be used on two different threads: the Game Thread and the Render Thread. Normally the library will detect that but if you have a use case where Game Thread and Rendering tasks are to be executed on the same thread, you’ll have to enable the multithreaded awareness manually by setting LibraryParams::AllowMultithreadedCommandProcessing in the Coherent Rendering plugin to true.

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.

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.

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.

TArray< TObjectPtr< 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.

TArray< CohtmlDelegateFunctorWrapper > JSEventCallbackWrappers;
FString URL;

The URL to load when the View is created

TSharedPtr< SCohtmlWidget > CoherentWidget;

friend TCohtmlViewListener< UCohtmlWidget >

Section titled “friend TCohtmlViewListener< UCohtmlWidget >”
friend class TCohtmlViewListener< UCohtmlWidget >;