1.3.1.2
Gameface
cohtml::IViewListener Class Reference

Interface that allows to listen for various events in the View. More...

Classes

struct  IClipboardData
 The class should be used by the implementer to set the data recovered from the clipboard. Use this class only in the context of a ViewListener::OnClipboardTextGet call. More...
 

Public Member Functions

virtual ~IViewListener ()
 
virtual bool OnNavigateTo (const char *url)
 Called when a navigation is about to occur. The user is able to interrupt the navigation or let it continue normally. More...
 
virtual void OnScriptContextCreated ()
 Called immediately after the script context has been created for the page. This happens before starting to build the DOM. Execute any scripts that will influence DOM creation here. More...
 
virtual void OnDOMBuilt ()
 Called when the page's DOM is fully constructed, but the referenced resources may not finish loading. More...
 
virtual void OnLoadFailed (const char *url, const char *error)
 Called when a navigation change request failed. More...
 
virtual void OnFinishLoad (const char *url)
 Called when a page, including the resources it refers to, is completely loaded and initialized. More...
 
virtual void OnReadyForBindings ()
 Called when the view is ready to accept JavaScript bindings. More...
 
virtual void OnBindingsReleased ()
 Called when the JavaScript bindings are released Use this call to release any resources hold by the JavaScript bindings for the view. More...
 
virtual ScreenInfo OnScreenInfoRequested ()
 Called when JavaScript requested screen metrics Returns current screen metrics. More...
 
virtual EventAction::Actions OnNodeTouched (const INodeProxy *node, const TouchEventData *event, void *userData, const InputEventPhase::PhaseType phase)
 Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event. More...
 
virtual EventAction::Actions OnNodeMouseEvent (const INodeProxy *node, const MouseEventData *event, void *userData, const InputEventPhase::PhaseType phase)
 Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event. More...
 
virtual EventAction::Actions OnNodeKeyEvent (const INodeProxy *node, const KeyEventData *event, void *userData, const InputEventPhase::PhaseType phase)
 Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event. More...
 
virtual void OnAudioStreamCreated (int id, int bitDepth, int channels, float samplingRate)
 Called by the UI when a media element initializes an audio stream. More...
 
virtual void OnAudioStreamClosed (int id)
 Called when an audio stream is destroyed. More...
 
virtual void OnAudioStreamPlay (int id)
 Called by the UI when a media element starts playing an audio stream. More...
 
virtual void OnAudioStreamPause (int id)
 Called by the UI when a playing media element pauses. More...
 
virtual void OnAudioDataReceived (int id, int samples, float **pcm, int channels)
 Called by the UI when there is decoded PCM data available for playing. More...
 
virtual void OnAudioStreamEnded (int id)
 Called when an audio stream ends and will no longer receive data. More...
 
virtual void OnAudioStreamVolumeChanged (int id, float volume)
 Called when an audio stream volume has changed. More...
 
virtual void OnTextInputTypeChanged (TextInputControlType::ControlType type)
 Called when the current text input control changes (i.e. the user click an edit-box). Use this method to decide when to allow for IME input. More...
 
virtual void OnCaretRectChanged (int x, int y, unsigned width, unsigned height)
 Called when the caret changes during IME composition. You can use this method to correctly position a custom IME control & candidate list. More...
 
virtual void OnIMEShouldCancelComposition ()
 Called when the user must cancel the IME composition due to an event in the View itself (i.e. the user has focused a non-editable element while a composition was on-going) More...
 
virtual void OnCursorChanged (CursorTypes::Cursors cursor, const char *url, const float *xHotspot, const float *yHotspot)
 Called when the cursor under the pointer changes. The user should modify the visible cursor from the OS to reflect the change. More...
 
virtual void OnClipboardTextSet (const char *text, unsigned lengthBytes)
 Called when the user has initaiated an operation of putting data in the Clipboard (copy or cut). The implementer must communicate with the OS API and set the passed data in the Clipboard. More...
 
virtual void OnClipboardTextGet (IClipboardData *setDataObject)
 Called when the user has initiated an operation that recovers data from the clipboard (paste). The implementer should get the text from the clipboard with the OS API and call the passed callback to set the data. More...
 

Detailed Description

Interface that allows to listen for various events in the View.

Constructor & Destructor Documentation

◆ ~IViewListener()

virtual cohtml::IViewListener::~IViewListener ( )
virtual

Member Function Documentation

◆ OnAudioDataReceived()

virtual void cohtml::IViewListener::OnAudioDataReceived ( int  id,
int  samples,
float **  pcm,
int  channels 
)
inlinevirtual

Called by the UI when there is decoded PCM data available for playing.

Parameters
idthe unique ID of the stream
samplesthe number of available samples
pcmthe decoded PCM data. Represented as a 2D array with |channels| x |samples| floating point elements in the range [-1, 1].
channelsthe number of channels

◆ OnAudioStreamClosed()

virtual void cohtml::IViewListener::OnAudioStreamClosed ( int  id)
inlinevirtual

Called when an audio stream is destroyed.

Parameters
idthe unique id of audio stream that was closed

◆ OnAudioStreamCreated()

virtual void cohtml::IViewListener::OnAudioStreamCreated ( int  id,
int  bitDepth,
int  channels,
float  samplingRate 
)
inlinevirtual

Called by the UI when a media element initializes an audio stream.

Parameters
idthe unique ID of the stream
bitDepththe number of bits per audio sample
channelsthe number of channels in the stream
samplingRatethe sampling rate of the stream in Hz

◆ OnAudioStreamEnded()

virtual void cohtml::IViewListener::OnAudioStreamEnded ( int  id)
inlinevirtual

Called when an audio stream ends and will no longer receive data.

Parameters
idthe unique ID of the stream

◆ OnAudioStreamPause()

virtual void cohtml::IViewListener::OnAudioStreamPause ( int  id)
inlinevirtual

Called by the UI when a playing media element pauses.

Parameters
idthe unique ID of the stream

◆ OnAudioStreamPlay()

virtual void cohtml::IViewListener::OnAudioStreamPlay ( int  id)
inlinevirtual

Called by the UI when a media element starts playing an audio stream.

Parameters
idthe unique ID of the stream

◆ OnAudioStreamVolumeChanged()

virtual void cohtml::IViewListener::OnAudioStreamVolumeChanged ( int  id,
float  volume 
)
inlinevirtual

Called when an audio stream volume has changed.

Parameters
idthe unique ID of the stream
volumethe new value of the volume

◆ OnBindingsReleased()

virtual void cohtml::IViewListener::OnBindingsReleased ( )
inlinevirtual

Called when the JavaScript bindings are released Use this call to release any resources hold by the JavaScript bindings for the view.

◆ OnCaretRectChanged()

virtual void cohtml::IViewListener::OnCaretRectChanged ( int  x,
int  y,
unsigned  width,
unsigned  height 
)
inlinevirtual

Called when the caret changes during IME composition. You can use this method to correctly position a custom IME control & candidate list.

Parameters
xthe x position of the selection caret
ythe y position of the selection caret
widththe width of the selection caret
heightthe height of the selection caret

◆ OnClipboardTextGet()

virtual void cohtml::IViewListener::OnClipboardTextGet ( IClipboardData setDataObject)
inlinevirtual

Called when the user has initiated an operation that recovers data from the clipboard (paste). The implementer should get the text from the clipboard with the OS API and call the passed callback to set the data.

Parameters
setDataObjectSet function that must be called with the data recovered from the clipboard
Note
The setDataObject is only valid in the call-stack of this method!

◆ OnClipboardTextSet()

virtual void cohtml::IViewListener::OnClipboardTextSet ( const char *  text,
unsigned  lengthBytes 
)
inlinevirtual

Called when the user has initaiated an operation of putting data in the Clipboard (copy or cut). The implementer must communicate with the OS API and set the passed data in the Clipboard.

Parameters
textThe text bytes (UTF-8) that the user is trying to copy in the clipboard
lengthBytesThe length in bytes of the text passed

◆ OnCursorChanged()

virtual void cohtml::IViewListener::OnCursorChanged ( CursorTypes::Cursors  cursor,
const char *  url,
const float *  xHotspot,
const float *  yHotspot 
)
inlinevirtual

Called when the cursor under the pointer changes. The user should modify the visible cursor from the OS to reflect the change.

Parameters
cursorSpecifies the Cursor type to show. If the type is URL, then the url param will be set.
urlThe URL of the cursor to show. The value is not nullptr only if the cursor type is URL.
xHotspotThe optional X coordinate of the cursor hotspot set from CSS. Can be nullptr if it is not specified in CSS.
yHotspotThe optional Y coordinate of the cursor hotspot set from CSS. Can be nullptr if it is not specified in CSS.

◆ OnDOMBuilt()

virtual void cohtml::IViewListener::OnDOMBuilt ( )
inlinevirtual

Called when the page's DOM is fully constructed, but the referenced resources may not finish loading.

◆ OnFinishLoad()

virtual void cohtml::IViewListener::OnFinishLoad ( const char *  url)
inlinevirtual

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

Parameters
urlThe URL which loaded successfully

◆ OnIMEShouldCancelComposition()

virtual void cohtml::IViewListener::OnIMEShouldCancelComposition ( )
inlinevirtual

Called when the user must cancel the IME composition due to an event in the View itself (i.e. the user has focused a non-editable element while a composition was on-going)

◆ OnLoadFailed()

virtual void cohtml::IViewListener::OnLoadFailed ( const char *  url,
const char *  error 
)
inlinevirtual

Called when a navigation change request failed.

Parameters
urlThe URL which failed to load
errorThe error message

◆ OnNavigateTo()

virtual bool cohtml::IViewListener::OnNavigateTo ( const char *  url)
inlinevirtual

Called when a navigation is about to occur. The user is able to interrupt the navigation or let it continue normally.

Parameters
urlThe URL which the view will load

◆ OnNodeKeyEvent()

virtual EventAction::Actions cohtml::IViewListener::OnNodeKeyEvent ( const INodeProxy node,
const KeyEventData event,
void *  userData,
const InputEventPhase::PhaseType  phase 
)
inlinevirtual

Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event.

◆ OnNodeMouseEvent()

virtual EventAction::Actions cohtml::IViewListener::OnNodeMouseEvent ( const INodeProxy node,
const MouseEventData event,
void *  userData,
const InputEventPhase::PhaseType  phase 
)
inlinevirtual

Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event.

◆ OnNodeTouched()

virtual EventAction::Actions cohtml::IViewListener::OnNodeTouched ( const INodeProxy node,
const TouchEventData event,
void *  userData,
const InputEventPhase::PhaseType  phase 
)
inlinevirtual

Called before an event is passed to a DOM node for evaluation. The user is able to interrupt the handling and bubbling of events or let them continue normally. Phase is the current PhaseType of the event.

◆ OnReadyForBindings()

virtual void cohtml::IViewListener::OnReadyForBindings ( )
inlinevirtual

Called when the view is ready to accept JavaScript bindings.

◆ OnScreenInfoRequested()

virtual ScreenInfo cohtml::IViewListener::OnScreenInfoRequested ( )
inlinevirtual

Called when JavaScript requested screen metrics Returns current screen metrics.

◆ OnScriptContextCreated()

virtual void cohtml::IViewListener::OnScriptContextCreated ( )
inlinevirtual

Called immediately after the script context has been created for the page. This happens before starting to build the DOM. Execute any scripts that will influence DOM creation here.

◆ OnTextInputTypeChanged()

virtual void cohtml::IViewListener::OnTextInputTypeChanged ( TextInputControlType::ControlType  type)
inlinevirtual

Called when the current text input control changes (i.e. the user click an edit-box). Use this method to decide when to allow for IME input.

Parameters
typethe type of the currently focused text input control by the user