2.8.6
Coherent GT
A modern user interface library for games
Coherent::UIGT::ViewListener Class Reference

The class provides a way to listen to the events generated by a View Override it to implement logic that depends on the View event. More...

#include <Coherent/Coherent/UIGT/ViewListener.h>

Public Member Functions

virtual void OnViewCreated (Coherent::UIGT::View *view)
 Called when the View is created. More...
 
virtual void OnViewDestroyed ()
 Called as soon as the View is destroyed.
 
virtual void OnFinishLoad (const char *path, bool isMainFrame)
 Called when the View has finished loading the last requested page. More...
 
virtual void OnFailLoad (const char *path, const char *error, bool isMainFrame)
 Called when the View fails loading the last requested page. More...
 
virtual void OnStartLoading (const char *path, bool isMainFrame)
 Called when the View starts loading a new page. More...
 
virtual void OnNavigateTo (const char *path, bool isMainFrame)
 Called when the View navigates to a new page. More...
 
virtual void OnReadyForBindings ()
 Called when the View is ready to accept JavaScript bindings.
 
virtual void OnBindingsReleased ()
 Called when the bindings have been released.
 
virtual void OnCallback (const char *eventName, const Coherent::UIGT::EventArguments &arguments)
 Called by the UI when there is no registered handler for this 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 OnTextInputTypeChanged (TextInputControlType 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)
 
virtual void OnCursorChanged (CursorType cursor)
 Called when the mouse cursor should be changed (i.e. the user hovered over an element with cursor CSS property) More...
 
virtual void OnPerformanceAudit (const char *result)
 Called when a performance audit requested by a call to AuditPerformance has completed. More...
 
virtual void OnCertificateError (Coherent::UIGT::CertificateResponse *response, const char *url, const char *error, bool isMainFrame)
 Called when a SSL connection encounters a certificate error. The response object can be used to allow or deny the connection. If the client doesn't override this method, the default response denies the request. More...
 
virtual void OnBindingModelCreated (const char *modelName, Coherent::UIGT::ModelHandle &handle)
 Called when a binding model has been created and obtaining property handles is available. More...
 

Detailed Description

The class provides a way to listen to the events generated by a View Override it to implement logic that depends on the View event.

Member Function Documentation

◆ OnAudioDataReceived()

virtual void Coherent::UIGT::ViewListener::OnAudioDataReceived ( int  id,
int  samples,
float **  pcm,
int  channels 
)
virtual

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
Warning
The PCM data must be copied when this method is invoked. After the call the data will no longer be valid.

◆ OnAudioStreamClosed()

virtual void Coherent::UIGT::ViewListener::OnAudioStreamClosed ( int  id)
virtual

Called when an audio stream is destroyed.

Parameters
idthe unique id of audio stream that was closed

◆ OnAudioStreamCreated()

virtual void Coherent::UIGT::ViewListener::OnAudioStreamCreated ( int  id,
int  bitDepth,
int  channels,
float  samplingRate 
)
virtual

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 Coherent::UIGT::ViewListener::OnAudioStreamEnded ( int  id)
virtual

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

Parameters
idthe unique ID of the stream

◆ OnAudioStreamPause()

virtual void Coherent::UIGT::ViewListener::OnAudioStreamPause ( int  id)
virtual

Called by the UI when a playing media element pauses.

Parameters
idthe unique ID of the stream

◆ OnAudioStreamPlay()

virtual void Coherent::UIGT::ViewListener::OnAudioStreamPlay ( int  id)
virtual

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

Parameters
idthe unique ID of the stream

◆ OnBindingModelCreated()

virtual void Coherent::UIGT::ViewListener::OnBindingModelCreated ( const char *  modelName,
Coherent::UIGT::ModelHandle &  handle 
)
virtual

Called when a binding model has been created and obtaining property handles is available.

Parameters
modelNamethe name for the model that has been created
handlea handle to the model that can be used for obtaining property handles

◆ OnCallback()

virtual void Coherent::UIGT::ViewListener::OnCallback ( const char *  eventName,
const Coherent::UIGT::EventArguments &  arguments 
)
virtual

Called by the UI when there is no registered handler for this event.

Parameters
eventNamename of the event
argumentsarguments of the event invocation

◆ OnCaretRectChanged()

virtual void Coherent::UIGT::ViewListener::OnCaretRectChanged ( int  x,
int  y,
unsigned  width,
unsigned  height 
)
virtual

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

◆ OnCertificateError()

virtual void Coherent::UIGT::ViewListener::OnCertificateError ( Coherent::UIGT::CertificateResponse *  response,
const char *  url,
const char *  error,
bool  isMainFrame 
)
virtual

Called when a SSL connection encounters a certificate error. The response object can be used to allow or deny the connection. If the client doesn't override this method, the default response denies the request.

Parameters
responsethe response object which the client should use to either allow or deny the SSL connection.
urlthe URL which triggered the certificate error
errordescriptive message of the error encountered
isMainFrameis this frame the main frame of the page

◆ OnCursorChanged()

virtual void Coherent::UIGT::ViewListener::OnCursorChanged ( CursorType  cursor)
virtual

Called when the mouse cursor should be changed (i.e. the user hovered over an element with cursor CSS property)

Parameters
cursorthe type of the cursor that should be drawn

◆ OnFailLoad()

virtual void Coherent::UIGT::ViewListener::OnFailLoad ( const char *  path,
const char *  error,
bool  isMainFrame 
)
virtual

Called when the View fails loading the last requested page.

Parameters
paththe url of the failed page
errordescription of the error
isMainFrameis this frame the main frame of the page

◆ OnFinishLoad()

virtual void Coherent::UIGT::ViewListener::OnFinishLoad ( const char *  path,
bool  isMainFrame 
)
virtual

Called when the View has finished loading the last requested page.

Parameters
paththe url of the loaded page
isMainFrameis this frame the main frame of the page

◆ OnNavigateTo()

virtual void Coherent::UIGT::ViewListener::OnNavigateTo ( const char *  path,
bool  isMainFrame 
)
virtual

Called when the View navigates to a new page.

Parameters
paththe url of the page where the View is moving
isMainFrameis this frame the main frame of the page

◆ OnPerformanceAudit()

virtual void Coherent::UIGT::ViewListener::OnPerformanceAudit ( const char *  result)
virtual

Called when a performance audit requested by a call to AuditPerformance has completed.

Parameters
resulta text representation of the gathered data

◆ OnStartLoading()

virtual void Coherent::UIGT::ViewListener::OnStartLoading ( const char *  path,
bool  isMainFrame 
)
virtual

Called when the View starts loading a new page.

Parameters
paththe url of the page that is starting to load
isMainFrameis this frame the main frame of the page

◆ OnTextInputTypeChanged()

virtual void Coherent::UIGT::ViewListener::OnTextInputTypeChanged ( TextInputControlType  type)
virtual

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

◆ OnViewCreated()

virtual void Coherent::UIGT::ViewListener::OnViewCreated ( Coherent::UIGT::View view)
virtual

Called when the View is created.

Parameters
viewthe view that was just created