cohtml.Net.IViewListener
Interface that allows to listen for various events in the View.
Inherits from SystemIDisposable
Inherited by cohtml.ViewListener
Public Classes
Name | |
---|---|
class | 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. |
Public Functions
Name | |
---|---|
virtual void | Dispose() |
IViewListener() | |
virtual bool | OnNavigateTo(string url) Called when a navigation is about to occur. The user is able to interrupt the navigation or let it continue normally. |
virtual InterceptRequestStatus | OnResourceRequestIntercepted(string url) Only used when View.InterceptResourceRequests is explicitly set to true. Called before sending a request to load a resource from the specified url. |
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. |
virtual void | OnDOMBuilt() Called when the page’s DOM is fully constructed, but the referenced resources may not finish loading. |
virtual void | OnLoadFailed(string url, string error) Called when a navigation change request failed. |
virtual void | OnFinishLoad(string url) Called when a page, including the resources it refers to, is completely loaded and initialized. |
virtual void | OnReadyForBindings() Called when the view is ready to accept JavaScript bindings. |
virtual void | OnBindingsReleased() Called when the JavaScript bindings are released. All registered event, call handlers and models have been automatically unregistered. Use this as a notification to release any resources that were used by the JavaScript bindings for the view, i.e. destroy registered models, etc. |
virtual ScreenInfo | OnScreenInfoRequested() Called when JavaScript requested screen metrics Returns current screen metrics. |
virtual Actions | OnNodeTouched(INodeProxy node, TouchEventData arg1, global.System.IntPtr userData, 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. Aside from events caused by calling ‘View.TouchEvent’ the callback can be called from JS. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr). |
virtual Actions | OnNodeMouseEvent(INodeProxy node, MouseEventData arg1, global.System.IntPtr userData, 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. Aside from events caused by calling ‘View.MouseEvent’ the callback can be called from JS or when the page is scrolled. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr). |
virtual Actions | OnNodeKeyEvent(INodeProxy node, KeyEventData arg1, global.System.IntPtr userData, 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. Aside from events caused by calling ‘View.KeyEvent’ the callback can be called from JS. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr). |
virtual void | OnAudioStreamCreated(int id, int bitDepth, int channels, float samplingRate) Called by the UI when a media element initializes an audio stream. |
virtual void | OnAudioStreamClosed(int id) Called when an audio stream is destroyed. |
virtual void | OnAudioStreamPlay(int id) Called by the UI when a media element starts playing an audio stream. |
virtual void | OnAudioStreamPause(int id) Called by the UI when a playing media element pauses. |
virtual void | OnAudioDataReceived(int id, int samples, System.IntPtr pcm, int channels) Called by the UI when there is decoded PCM data available for playing. |
virtual void | OnAudioStreamEnded(int id) Called when an audio stream ends and will no longer receive data. |
virtual void | OnAudioStreamVolumeChanged(int id, float volume) Called when an audio stream volume has changed. |
virtual void | OnTextInputTypeChanged(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. |
virtual void | OnCaretRectChanged(int x, int y, uint width, uint height) Called when the caret changes during IME composition. You can use this method to correctly position a custom IME control & candidate list. |
virtual void | OnCursorChanged(Cursors cursor, string url, System.IntPtr xHotspot, System.IntPtr yHotspot) Called when the cursor under the pointer changes. The user should modify the visible cursor from the OS to reflect the change. |
virtual void | OnClipboardTextSet(string text, uint lengthBytes) Called when the user has initiated 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. |
virtual void | OnClipboardTextGet(IViewListener.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. |
virtual IClientSideSocket | OnCreateWebSocket(ISocketListener listener, string url, System.IntPtr protocols, uint protocolsCount) Called when the view tries to establish a web socket connection. When JS tries to create a new web sockets it will create a new cohtml.ISocketListener in the cohtml.View. OnCreateWebSocket will be called after that and it must respond with a cohtml.IClientSideSocket object which represent the socket implementation for the current platform. |
delegate bool | SwigDelegateIViewListener_0(string url, global.System.IntPtr swigId) |
delegate int | SwigDelegateIViewListener_1(string url, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_2(global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_3(global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_4(string url, string error, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_5(string url, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_6(global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_7(global.System.IntPtr swigId) |
delegate global.System.IntPtr | SwigDelegateIViewListener_8(global.System.IntPtr swigId) |
delegate int | SwigDelegateIViewListener_9(global.System.IntPtr node, global.System.IntPtr arg1, global.System.IntPtr userData, int phase, global.System.IntPtr swigId) |
delegate int | SwigDelegateIViewListener_10(global.System.IntPtr node, global.System.IntPtr arg1, global.System.IntPtr userData, int phase, global.System.IntPtr swigId) |
delegate int | SwigDelegateIViewListener_11(global.System.IntPtr node, global.System.IntPtr arg1, global.System.IntPtr userData, int phase, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_12(int id, int bitDepth, int channels, float samplingRate, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_13(int id, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_14(int id, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_15(int id, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_16(int id, int samples, System.IntPtr pcm, int channels, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_17(int id, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_18(int id, float volume, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_19(int type, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_20(int x, int y, uint width, uint height, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_21(int cursor, string url, System.IntPtr xHotspot, System.IntPtr yHotspot, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_22(string text, uint lengthBytes, global.System.IntPtr swigId) |
delegate void | SwigDelegateIViewListener_23(global.System.IntPtr setDataObject, global.System.IntPtr swigId) |
delegate global.System.IntPtr | SwigDelegateIViewListener_24(global.System.IntPtr listener, string url, System.IntPtr protocols, uint protocolsCount, global.System.IntPtr swigId) |
Protected Attributes
Name | |
---|---|
bool | swigCMemOwn |
Public Functions Documentation
function Dispose
virtual void Dispose()
function IViewListener
IViewListener()
function OnNavigateTo
virtual bool OnNavigateTo(
string url
)
Called when a navigation is about to occur. The user is able to interrupt the navigation or let it continue normally.
Parameters:
- url The URL which the view will load
Reimplemented by: cohtml.ViewListener.OnNavigateTo
function OnResourceRequestIntercepted
virtual InterceptRequestStatus OnResourceRequestIntercepted(
string url
)
Only used when View.InterceptResourceRequests is explicitly set to true. Called before sending a request to load a resource from the specified url.
Parameters:
- url The URL requested by the view
Return: Returns InterceptRequestStatus.Restrict if the request should be intercepted or InterceptRequestStatus.Allow otherwise
function OnScriptContextCreated
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.
Reimplemented by: cohtml.ViewListener.OnScriptContextCreated
function OnDOMBuilt
virtual void OnDOMBuilt()
Called when the page’s DOM is fully constructed, but the referenced resources may not finish loading.
Reimplemented by: cohtml.ViewListener.OnDOMBuilt
function OnLoadFailed
virtual void OnLoadFailed(
string url,
string error
)
Called when a navigation change request failed.
Parameters:
- url The URL which failed to load
- error The error message
Reimplemented by: cohtml.ViewListener.OnLoadFailed
function OnFinishLoad
virtual void OnFinishLoad(
string url
)
Called when a page, including the resources it refers to, is completely loaded and initialized.
Parameters:
- url The URL which loaded successfully
Reimplemented by: cohtml.ViewListener.OnFinishLoad
function OnReadyForBindings
virtual void OnReadyForBindings()
Called when the view is ready to accept JavaScript bindings.
Reimplemented by: cohtml.ViewListener.OnReadyForBindings
function OnBindingsReleased
virtual void OnBindingsReleased()
Called when the JavaScript bindings are released. All registered event, call handlers and models have been automatically unregistered. Use this as a notification to release any resources that were used by the JavaScript bindings for the view, i.e. destroy registered models, etc.
Reimplemented by: cohtml.ViewListener.OnBindingsReleased
function OnScreenInfoRequested
virtual ScreenInfo OnScreenInfoRequested()
Called when JavaScript requested screen metrics Returns current screen metrics.
function OnNodeTouched
virtual Actions OnNodeTouched(
INodeProxy node,
TouchEventData arg1,
global.System.IntPtr userData,
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. Aside from events caused by calling ‘View.TouchEvent’ the callback can be called from JS. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr).
function OnNodeMouseEvent
virtual Actions OnNodeMouseEvent(
INodeProxy node,
MouseEventData arg1,
global.System.IntPtr userData,
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. Aside from events caused by calling ‘View.MouseEvent’ the callback can be called from JS or when the page is scrolled. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr).
function OnNodeKeyEvent
virtual Actions OnNodeKeyEvent(
INodeProxy node,
KeyEventData arg1,
global.System.IntPtr userData,
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. Aside from events caused by calling ‘View.KeyEvent’ the callback can be called from JS. When the callback is not called from C++ the events are synthetic and won’t have userData(it will be nullptr).
function OnAudioStreamCreated
virtual void OnAudioStreamCreated(
int id,
int bitDepth,
int channels,
float samplingRate
)
Called by the UI when a media element initializes an audio stream.
Parameters:
- id the unique ID of the stream
- bitDepth the number of bits per audio sample
- channels the number of channels in the stream
- samplingRate the sampling rate of the stream in Hz
Reimplemented by: cohtml.ViewListener.OnAudioStreamCreated
function OnAudioStreamClosed
virtual void OnAudioStreamClosed(
int id
)
Called when an audio stream is destroyed.
Parameters:
- id the unique id of audio stream that was closed
Reimplemented by: cohtml.ViewListener.OnAudioStreamClosed
function OnAudioStreamPlay
virtual void OnAudioStreamPlay(
int id
)
Called by the UI when a media element starts playing an audio stream.
Parameters:
- id the unique ID of the stream
Reimplemented by: cohtml.ViewListener.OnAudioStreamPlay
function OnAudioStreamPause
virtual void OnAudioStreamPause(
int id
)
Called by the UI when a playing media element pauses.
Parameters:
- id the unique ID of the stream
Reimplemented by: cohtml.ViewListener.OnAudioStreamPause
function OnAudioDataReceived
virtual void OnAudioDataReceived(
int id,
int samples,
System.IntPtr pcm,
int channels
)
Called by the UI when there is decoded PCM data available for playing.
Parameters:
- id the unique ID of the stream
- samples the number of available samples
- pcm the decoded PCM data. Represented as a 2D array with |channels| x |samples| floating point elements in the range [-1, 1].
- channels the number of channels
function OnAudioStreamEnded
virtual void OnAudioStreamEnded(
int id
)
Called when an audio stream ends and will no longer receive data.
Parameters:
- id the unique ID of the stream
Reimplemented by: cohtml.ViewListener.OnAudioStreamEnded
function OnAudioStreamVolumeChanged
virtual void OnAudioStreamVolumeChanged(
int id,
float volume
)
Called when an audio stream volume has changed.
Parameters:
- id the unique ID of the stream
- volume the new value of the volume
Reimplemented by: cohtml.ViewListener.OnAudioStreamVolumeChanged
function OnTextInputTypeChanged
virtual void OnTextInputTypeChanged(
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.
Parameters:
- type the type of the currently focused text input control by the user
function OnCaretRectChanged
virtual void OnCaretRectChanged(
int x,
int y,
uint width,
uint height
)
Called when the caret changes during IME composition. You can use this method to correctly position a custom IME control & candidate list.
Parameters:
- x the x position of the selection caret
- y the y position of the selection caret
- width the width of the selection caret
- height the height of the selection caret
function OnCursorChanged
virtual void OnCursorChanged(
Cursors cursor,
string url,
System.IntPtr xHotspot,
System.IntPtr yHotspot
)
Called when the cursor under the pointer changes. The user should modify the visible cursor from the OS to reflect the change.
Parameters:
- cursor Specifies the Cursor type to show. If the type is URL, then the url param will be set.
- url The URL of the cursor to show. The value is not nullptr only if the cursor type is URL.
- xHotspot The optional X coordinate of the cursor hotspot set from CSS. Can be nullptr if it is not specified in CSS.
- yHotspot The optional Y coordinate of the cursor hotspot set from CSS. Can be nullptr if it is not specified in CSS.
function OnClipboardTextSet
virtual void OnClipboardTextSet(
string text,
uint lengthBytes
)
Called when the user has initiated 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:
- text The text bytes (UTF-8) that the user is trying to copy in the clipboard
- lengthBytes The length in bytes of the text passed
Reimplemented by: cohtml.ViewListener.OnClipboardTextSet
function OnClipboardTextGet
virtual void OnClipboardTextGet(
IViewListener.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.
Parameters:
- setDataObject Set 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!
function OnCreateWebSocket
virtual IClientSideSocket OnCreateWebSocket(
ISocketListener listener,
string url,
System.IntPtr protocols,
uint protocolsCount
)
Called when the view tries to establish a web socket connection. When JS tries to create a new web sockets it will create a new cohtml.ISocketListener in the cohtml.View. OnCreateWebSocket will be called after that and it must respond with a cohtml.IClientSideSocket object which represent the socket implementation for the current platform.
Parameters:
- listener is cohtml side of the connection, user side must use it to communicate with the View.
- url The URL to which to connect; this should be the URL to which the WebSocket server will respond.
- protocols Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). if you don’t specify a protocol string, an empty string is assumed.
- protocolsCount the number of protocols passed
function SwigDelegateIViewListener_0
delegate bool SwigDelegateIViewListener_0(
string url,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_1
delegate int SwigDelegateIViewListener_1(
string url,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_2
delegate void SwigDelegateIViewListener_2(
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_3
delegate void SwigDelegateIViewListener_3(
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_4
delegate void SwigDelegateIViewListener_4(
string url,
string error,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_5
delegate void SwigDelegateIViewListener_5(
string url,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_6
delegate void SwigDelegateIViewListener_6(
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_7
delegate void SwigDelegateIViewListener_7(
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_8
delegate global.System.IntPtr SwigDelegateIViewListener_8(
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_9
delegate int SwigDelegateIViewListener_9(
global.System.IntPtr node,
global.System.IntPtr arg1,
global.System.IntPtr userData,
int phase,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_10
delegate int SwigDelegateIViewListener_10(
global.System.IntPtr node,
global.System.IntPtr arg1,
global.System.IntPtr userData,
int phase,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_11
delegate int SwigDelegateIViewListener_11(
global.System.IntPtr node,
global.System.IntPtr arg1,
global.System.IntPtr userData,
int phase,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_12
delegate void SwigDelegateIViewListener_12(
int id,
int bitDepth,
int channels,
float samplingRate,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_13
delegate void SwigDelegateIViewListener_13(
int id,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_14
delegate void SwigDelegateIViewListener_14(
int id,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_15
delegate void SwigDelegateIViewListener_15(
int id,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_16
delegate void SwigDelegateIViewListener_16(
int id,
int samples,
System.IntPtr pcm,
int channels,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_17
delegate void SwigDelegateIViewListener_17(
int id,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_18
delegate void SwigDelegateIViewListener_18(
int id,
float volume,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_19
delegate void SwigDelegateIViewListener_19(
int type,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_20
delegate void SwigDelegateIViewListener_20(
int x,
int y,
uint width,
uint height,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_21
delegate void SwigDelegateIViewListener_21(
int cursor,
string url,
System.IntPtr xHotspot,
System.IntPtr yHotspot,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_22
delegate void SwigDelegateIViewListener_22(
string text,
uint lengthBytes,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_23
delegate void SwigDelegateIViewListener_23(
global.System.IntPtr setDataObject,
global.System.IntPtr swigId
)
function SwigDelegateIViewListener_24
delegate global.System.IntPtr SwigDelegateIViewListener_24(
global.System.IntPtr listener,
string url,
System.IntPtr protocols,
uint protocolsCount,
global.System.IntPtr swigId
)
Protected Attributes Documentation
variable swigCMemOwn
bool swigCMemOwn;