Coherent UI for Unity3D  2.5.3
A modern user interface library for games
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Coherent.UI.View Class Reference

Class that encapsulates a UI More...

+ Inheritance diagram for Coherent.UI.View:

Public Member Functions

BoundEventHandle BindCall (string name, System.Delegate handler)
 Expose C++ handler to be called from UI. More...
 
BoundEventHandle RegisterForEvent (string name, System.Delegate handler)
 Expose C++ handler to be called when a specific event occurs. More...
 
void UnregisterFromEvent (BoundEventHandle handle)
 Remove a registered C++ handler. More...
 
void UnbindCall (BoundEventHandle handle)
 Remove a bound C++ handler. More...
 
void UnbindObject (object target)
 Remove all handlers bound to a specific object. More...
 
virtual ViewContext GetContext ()
 Get the view context. More...
 
virtual ViewType GetViewType ()
 Get the type of the view. More...
 
virtual void Destroy ()
 Destroys this view. After a call to Destroy calling any other method except the destructor results in undefined behavior More...
 
virtual void SetFocus ()
 Sets this view on focus. More...
 
virtual void KillFocus ()
 Removes the focus from this view. More...
 
virtual void MouseEvent (MouseEventData arg0)
 Sends a mouse event to the UI renderer. More...
 
virtual void KeyEvent (KeyEventData arg0)
 Sends a key event to the UI renderer. More...
 
virtual void TouchEvent (TouchEventData events, uint count)
 Sends a touch event to the UI renderer. More...
 
virtual void MouseActivate ()
 Sends a mouse event to the UI renderer. More...
 
virtual int GetWidth ()
 Gets the width of the More...
 
virtual int GetHeight ()
 Gets the height of the More...
 
virtual void Resize (uint width, uint height)
 Send a resize event to the UI renderer. Resize will result in multiple calls to CreateBuffers and DestroyBuffers in the listener More...
 
virtual void IssueMouseOnUIQuery (float normX, float normY)
 Issues a query on the Calling IsMouseOnView while a query is in-flight is an error and will be logged - the result returned by IsMouseOnView in that case is undefined. More...
 
virtual ViewErrorType HasMouseQueryFinished ()
 Returns the status of the mouse query. More...
 
virtual void FetchMouseOnUIQuery ()
 Ends a mouse-on-UI query. Waits for the result. Should be called as far apart from IssueMouseOnUIQuery in order to maximize the chances that the query has finished at the time of this call and no waiting will be performed More...
 
virtual bool IsMouseOnView ()
 Checks if the mouse is currently on the logical view (a part of the view that has elements on it) or not (click-through). Uses the coordinates last set in IssueMouseOnUIQuery. Calling the method while a query is in-flight (between a call to IssueMouseOnUIQuery and FetchMouseOnUIQuery) results in a warning and the return result is undefined More...
 
virtual void SetClickThroughAlphaThreshold (float threshold)
 The alpha value of the pixels is used to determine if the mouse is on an element or on the background (click-through). All pixels below or equal to the alpha threshold (default = 0) are marked as not-belonging to the More...
 
virtual float GetClickThroughAlphaThreshold ()
 Get the currently set alpha threshold for click-through queries. More...
 
virtual bool UsesSharedMemory ()
 Tells if this view uses shared memory for image transport. More...
 
virtual bool IsTransparent ()
 Tells if this view is transparent or not. More...
 
virtual bool SupportsClickThrough ()
 Tells if this view supports click-through queries or not. More...
 
virtual void Redraw ()
 Request a redraw of the current view. More...
 
virtual void DownloadUrl (string path)
 Initiates a download request on the specified path. More...
 
virtual void Load (string path)
 Loads a new path in the More...
 
virtual void Reload (bool ignoreCache)
 Reloads the last requested or navigated-to path. More...
 
virtual string GetCurentViewPath ()
 Get the last requested or navigated-to path. More...
 
virtual string GetLastRequestedPath ()
 Get the last requested path to load for the More...
 
virtual string GetLastLoadedPath ()
 Get the last successfully loaded path for the More...
 
virtual string GetLastFailedPath ()
 Get the last failed path for the More...
 
virtual void ExecuteScript (string script)
 Execute arbitrary JavaScript code. More...
 
virtual void TriggerEvent (string eventName)
 Triggers a UI event. More...
 
virtual void ReplyToJavaScriptMessage (bool success, string userInput)
 Sends a reply to a javascript message triggered for the view. More...
 
virtual void AuthCredentialsResponse (string username, string password, bool success)
 Sends credentials for a pending authentication request for the view. More...
 
virtual void SetScriptError (ScriptCallErrorType error, string message)
 Sets an error for the currently executing handler. More...
 
virtual void InterceptURLRequests (bool intercept)
 Controls intercepting URL requests. For each request More...
 
virtual void IMEActivate (bool active)
 Sets if the More...
 
virtual bool IMEIsActive ()
 Tells if IME events are currently active for this view. More...
 
virtual bool IMESetComposition (string composition, uint cursorPos, uint targetStart, uint targetEnd)
 Updates the internal state of the IME composition in the More...
 
virtual bool IMEConfirmComposition (string composition)
 Confirms the current IME composition. More...
 
virtual bool IMECancelComposition ()
 Cancels the current IME composition. More...
 
virtual ImageData CreateImageData (string name, int width, int height, IntPtr data, bool flipY)
 Create an More...
 
virtual int GetAudioData (int streamId, IntPtr buffer, int bufferSize, int timeoutMs)
 Obtains audio data for the specified stream in the current view and copies it into the client-provided buffer. More...
 
virtual void SetZoomLevel (double zoomLevel)
 Sets the page zoom level. Specifying 0.0 will reset to the default zoom level. The zoom factor operates on protocol and host level, meaning that all views with the same protocol and host as the current URL will be scaled as well. More...
 
virtual void SetMasterVolume (double volume)
 Sets the master volume for all audio and video streams. More...
 

Detailed Description

Class that encapsulates a UI

Member Function Documentation

virtual void Coherent.UI.View.AuthCredentialsResponse ( string  username,
string  password,
bool  success 
)
inlinevirtual

Sends credentials for a pending authentication request for the view.

Parameters
usernamethe username
passwordthe password
successdefines whether the response is valid, i.e. if the request should be answered or canceled
BoundEventHandle Coherent.UI.View.BindCall ( string  name,
System.Delegate  handler 
)
inline

Expose C++ handler to be called from UI.

Parameters
namename for the handler in the UI
handlerhandler to be executed
Returns
bound handle so the handler can be unbound later
virtual ImageData Coherent.UI.View.CreateImageData ( string  name,
int  width,
int  height,
IntPtr  data,
bool  flipY 
)
inlinevirtual

Create an

Parameters
namethe name of the image data object
widththe width of the image
heightthe height of the image
datainitial data to fill the image data with
flipYflips vertically the content of the source image
Returns
the image data object created in the DOM of this View
virtual void Coherent.UI.View.Destroy ( )
inlinevirtual

Destroys this view. After a call to Destroy calling any other method except the destructor results in undefined behavior

virtual void Coherent.UI.View.DownloadUrl ( string  path)
inlinevirtual

Initiates a download request on the specified path.

virtual void Coherent.UI.View.ExecuteScript ( string  script)
inlinevirtual

Execute arbitrary JavaScript code.

Parameters
scriptcode to be evaluated in the context of the main frame of the view
virtual void Coherent.UI.View.FetchMouseOnUIQuery ( )
inlinevirtual

Ends a mouse-on-UI query. Waits for the result. Should be called as far apart from IssueMouseOnUIQuery in order to maximize the chances that the query has finished at the time of this call and no waiting will be performed

virtual int Coherent.UI.View.GetAudioData ( int  streamId,
IntPtr  buffer,
int  bufferSize,
int  timeoutMs 
)
inlinevirtual

Obtains audio data for the specified stream in the current view and copies it into the client-provided buffer.

Parameters
streamIdthe stream for which to get PCM data
bufferthe client buffer into which the data is copied
bufferSizethe size of the client buffer
timeoutMsthe timeout in milliseconds to wait for audio data. Use 0 to wait indefinitely.
Returns
the actual number of bytes read. A negative number is returned if the stream is exhausted or does not exist.
virtual float Coherent.UI.View.GetClickThroughAlphaThreshold ( )
inlinevirtual

Get the currently set alpha threshold for click-through queries.

Returns
the currently set alpha threshold
virtual ViewContext Coherent.UI.View.GetContext ( )
inlinevirtual

Get the view context.

Returns
pointer to the view context used for creating this view
virtual string Coherent.UI.View.GetCurentViewPath ( )
inlinevirtual

Get the last requested or navigated-to path.

Returns
the path as null-terminated string
virtual int Coherent.UI.View.GetHeight ( )
inlinevirtual

Gets the height of the

Returns
the height of the View
virtual string Coherent.UI.View.GetLastFailedPath ( )
inlinevirtual

Get the last failed path for the

Returns
the path as null-terminated string
virtual string Coherent.UI.View.GetLastLoadedPath ( )
inlinevirtual

Get the last successfully loaded path for the

Returns
the path as null-terminated string
virtual string Coherent.UI.View.GetLastRequestedPath ( )
inlinevirtual

Get the last requested path to load for the

Returns
the path as null-terminated string
virtual ViewType Coherent.UI.View.GetViewType ( )
inlinevirtual

Get the type of the view.

Returns
the type of the view

Reimplemented in Coherent.UI.BrowserView.

virtual int Coherent.UI.View.GetWidth ( )
inlinevirtual

Gets the width of the

Returns
the width of the View
virtual ViewErrorType Coherent.UI.View.HasMouseQueryFinished ( )
inlinevirtual

Returns the status of the mouse query.

Returns
the result will be Success if the query has finished, QueryNotReady otherwise. If no query has been issued InvalidCall will be returned.
virtual void Coherent.UI.View.IMEActivate ( bool  active)
inlinevirtual

Sets if the

Parameters
activewhether to activate IME handling for this view
virtual bool Coherent.UI.View.IMECancelComposition ( )
inlinevirtual

Cancels the current IME composition.

Returns
the outcome of the operation (will fail if IME is inactive for this view)
virtual bool Coherent.UI.View.IMEConfirmComposition ( string  composition)
inlinevirtual

Confirms the current IME composition.

Parameters
compositionthe string to confirm
Returns
the outcome of the operation (will fail if IME is inactive for this view)
virtual bool Coherent.UI.View.IMEIsActive ( )
inlinevirtual

Tells if IME events are currently active for this view.

Returns
if the view has IME active
virtual bool Coherent.UI.View.IMESetComposition ( string  composition,
uint  cursorPos,
uint  targetStart,
uint  targetEnd 
)
inlinevirtual

Updates the internal state of the IME composition in the

Parameters
compositionthe composition string so far
thecursor position in the composition
targetStartthe index at the start of the selection
targetEndthe index at the end of the selection
Returns
the outcome of the operation (will fail if IME is inactive for this view)
virtual void Coherent.UI.View.InterceptURLRequests ( bool  intercept)
inlinevirtual

Controls intercepting URL requests. For each request

Parameters
interceptwhether to intercept all URL requests
virtual bool Coherent.UI.View.IsMouseOnView ( )
inlinevirtual

Checks if the mouse is currently on the logical view (a part of the view that has elements on it) or not (click-through). Uses the coordinates last set in IssueMouseOnUIQuery. Calling the method while a query is in-flight (between a call to IssueMouseOnUIQuery and FetchMouseOnUIQuery) results in a warning and the return result is undefined

Returns
true if the mouse is on the view
virtual void Coherent.UI.View.IssueMouseOnUIQuery ( float  normX,
float  normY 
)
inlinevirtual

Issues a query on the Calling IsMouseOnView while a query is in-flight is an error and will be logged - the result returned by IsMouseOnView in that case is undefined.

Put as much processing as possible between IssueMouseOnUIQuery and the corresponding FetchMouseOnUIQuery, this allows leveraging the cost of the query and to reduce it to ~0. The best way to do this is call IssueMouseOnUIQuery early in the frame, perform all game rendering and the call FetchMouseOnUIQuery followed by IsMouseOnView to update the needed data.

Parameters
normXthe x coordinate of the mouse in the normalized space of the view [0..1]
normYthe y coordinate of the mouse in the normalized space of the view [0..1]
virtual bool Coherent.UI.View.IsTransparent ( )
inlinevirtual

Tells if this view is transparent or not.

Returns
true if the view is transparent
virtual void Coherent.UI.View.KeyEvent ( KeyEventData  arg0)
inlinevirtual

Sends a key event to the UI renderer.

Parameters
eventthe key event
virtual void Coherent.UI.View.KillFocus ( )
inlinevirtual

Removes the focus from this view.

virtual void Coherent.UI.View.Load ( string  path)
inlinevirtual

Loads a new path in the

Parameters
paththe path to load
virtual void Coherent.UI.View.MouseActivate ( )
inlinevirtual

Sends a mouse event to the UI renderer.

virtual void Coherent.UI.View.MouseEvent ( MouseEventData  arg0)
inlinevirtual

Sends a mouse event to the UI renderer.

Parameters
eventthe mouse event
virtual void Coherent.UI.View.Redraw ( )
inlinevirtual

Request a redraw of the current view.

BoundEventHandle Coherent.UI.View.RegisterForEvent ( string  name,
System.Delegate  handler 
)
inline

Expose C++ handler to be called when a specific event occurs.

Parameters
namename of the event
handlerhandler to be executed
Returns
bound handle so the handler can be unregistered
virtual void Coherent.UI.View.Reload ( bool  ignoreCache)
inlinevirtual

Reloads the last requested or navigated-to path.

Parameters
ignoreCachewhether to ignore the cache for the reload
virtual void Coherent.UI.View.ReplyToJavaScriptMessage ( bool  success,
string  userInput 
)
inlinevirtual

Sends a reply to a javascript message triggered for the view.

Parameters
successdefines whether the user replies positively to the message (i.e. clicks the OK button)
userInputthe user reply message (only used in prompt messages)
virtual void Coherent.UI.View.Resize ( uint  width,
uint  height 
)
inlinevirtual

Send a resize event to the UI renderer. Resize will result in multiple calls to CreateBuffers and DestroyBuffers in the listener

Parameters
widththe new width of the View
heightthe new height of the View
virtual void Coherent.UI.View.SetClickThroughAlphaThreshold ( float  threshold)
inlinevirtual

The alpha value of the pixels is used to determine if the mouse is on an element or on the background (click-through). All pixels below or equal to the alpha threshold (default = 0) are marked as not-belonging to the

Parameters
thresholdsets the new alpha threshold
virtual void Coherent.UI.View.SetFocus ( )
inlinevirtual

Sets this view on focus.

virtual void Coherent.UI.View.SetMasterVolume ( double  volume)
inlinevirtual

Sets the master volume for all audio and video streams.

Parameters
volumecoefficient between 0.0 and 1.0
virtual void Coherent.UI.View.SetScriptError ( ScriptCallErrorType  error,
string  message 
)
inlinevirtual

Sets an error for the currently executing handler.

Parameters
errorthe type of the error
messagethe error message
virtual void Coherent.UI.View.SetZoomLevel ( double  zoomLevel)
inlinevirtual

Sets the page zoom level. Specifying 0.0 will reset to the default zoom level. The zoom factor operates on protocol and host level, meaning that all views with the same protocol and host as the current URL will be scaled as well.

virtual bool Coherent.UI.View.SupportsClickThrough ( )
inlinevirtual

Tells if this view supports click-through queries or not.

Returns
true if click-through is supported
virtual void Coherent.UI.View.TouchEvent ( TouchEventData  events,
uint  count 
)
inlinevirtual

Sends a touch event to the UI renderer.

Parameters
eventsarray of touch events
countthe count of the passed touch events in the array
virtual void Coherent.UI.View.TriggerEvent ( string  eventName)
inlinevirtual

Triggers a UI event.

void Coherent.UI.View.UnbindCall ( BoundEventHandle  handle)
inline

Remove a bound C++ handler.

Parameters
handlethe handle of the handler to be unbound
void Coherent.UI.View.UnbindObject ( object  target)
inline

Remove all handlers bound to a specific object.

Parameters
objectthe object whose handlers will be removed
void Coherent.UI.View.UnregisterFromEvent ( BoundEventHandle  handle)
inline

Remove a registered C++ handler.

Parameters
handlethe handle of the event handler to be unregistered
virtual bool Coherent.UI.View.UsesSharedMemory ( )
inlinevirtual

Tells if this view uses shared memory for image transport.

Returns
true if the view uses shared memory, false if shared textures