The View represents a UI page with its DOM, styles and JavaScript context. Think of the View as a whole UI or UI element. The View for instance could be the whole HUD of a game. More...
Public Member Functions | |
virtual void | Destroy ()=0 |
Destorys the View. Should be called before the destruction of the System and Library. | |
virtual void | LoadURL (const char *url)=0 |
Loads a page in the View. More... | |
virtual void | Reload ()=0 |
Reloads the current page in the view. | |
virtual void | UnloadDocument ()=0 |
Unloads the HTML document. This will remove the entire DOM tree, so nothing will rendered but the view object will still be usable and another document might be loaded using View::LoadURL. | |
virtual unsigned | Advance (TimePoint timeMilliseconds)=0 |
Advances the internal timer of the View and runs all animations. If changes have happened in the page, this call will also trigger a new layout and render on the other threads. More... | |
virtual unsigned | GetId () const =0 |
Retuens the unique ID of the View. | |
virtual TaskFamilyId | GetTaskFamilyId () const =0 |
Returns the Task Family Id that can be used to schedule Layout work in an auxilliary thread. | |
virtual void | Resize (unsigned width, unsigned height)=0 |
Resizes the View contents. More... | |
virtual unsigned | GetWidth () const =0 |
Gets the View width. | |
virtual unsigned | GetHeight () const =0 |
Gets the View height. | |
virtual void | ContinuousRepaint (bool enable)=0 |
Debugging flag. This will cause the View to re-draw itself each frame. More... | |
virtual void | ShowPaintRectangles (bool show)=0 |
Debugging flag. This will cause the View show which parts of the texture are re-drawn each frame. More... | |
virtual void | ShowElementAABBs (bool show)=0 |
Debugging flag. This will cause the View to draw the bounding-boxes of all elements. More... | |
virtual DebugDump * | DebugDumpDOMTree (unsigned flags)=0 |
Debugging helper. Collects a comprehensive DOM structure dump. | |
virtual void | TouchEvent (const cohtml::TouchEventData *events, unsigned count, bool *handled, void *userData)=0 |
Sends a touch input event to the View. More... | |
virtual void | GestureEvent (const cohtml::GestureEventData &event, bool *handled, void *userData)=0 |
Sends a gesture input event to the View. More... | |
virtual void | MouseEvent (const cohtml::MouseEventData &event, bool *handled, void *userData)=0 |
Sends a mouse input event to the View. More... | |
virtual void | KeyEvent (const cohtml::KeyEventData &event, bool *handled, void *userData)=0 |
Sends a keyboard input event to the View. More... | |
virtual bool | IMESetComposition (const char *composition, unsigned targetStart, unsigned targetEnd)=0 |
Updates the internal state of the IME composition in the View. More... | |
virtual bool | IMEConfirmComposition (const char *composition)=0 |
Confirms the current IME composition. More... | |
virtual bool | IMECancelComposition ()=0 |
Cancels the current IME composition. More... | |
virtual void | SetUserAgent (const char *userAgent)=0 |
Sets the User Agent string. More... | |
virtual void | BeginCaptureDebugFrame (void *userData, FrameCaptureCallback callback)=0 |
Will begin serializing every rendered frame to a memory blob which will be passed in the callback. The saved frames can be inspected for debug purposes. More... | |
virtual void | EndCaptureDebugFrame ()=0 |
Ends serializing rendered frames. | |
virtual void | CaptureSingleDebugFrame (void *userData, FrameCaptureCallback callback)=0 |
Will serialize next rendered frame to a memory blob which will be passed in the callback. The saved frames can be inspected for debug purposes. More... | |
virtual BoundEventHandle | RegisterForEvent (const char *name, IEventHandler *handler)=0 |
Expose C++ handler to be called when a specific event occurs. More... | |
virtual void | UnregisterFromEvent (BoundEventHandle handle)=0 |
Remove a registered C++ handler. More... | |
virtual BoundEventHandle | BindCall (const char *name, IEventHandler *handler)=0 |
Expose C++ handler to be called from UI. More... | |
virtual void | UnbindCall (BoundEventHandle handle)=0 |
Remove a bound C++ handler. More... | |
virtual void | UnbindObject (const void *object)=0 |
Remove all handlers bound to a specific object. More... | |
template<typename T > | |
void | ExposeAsGlobal (const char *name, T *object) |
Expose object as global variable. More... | |
virtual void | DestroyExposedObject (void *object)=0 |
Remove exposed object from JavaScript. More... | |
virtual bool | IsReadyForBindings () const =0 |
Checks whether the CoherentHummingbird.js bindings are initialized and ready to use. More... | |
virtual void | ExecuteScript (const char *script)=0 |
Execute arbitrary JavaScript code. This should be called only with a valid script context created. More... | |
virtual void | AddInitialScript (const char *script)=0 |
Schedules execution of JavaScript code on every page load. Can be called at any time. The scripts will be executed on the next page load in the same order they were added. More... | |
virtual void | ResetInitialScripts ()=0 |
Resets the list of initial scripts executed on every page load. | |
Triggering events | |
These overloads trigger an event in JavaScript with the supplied arguments | |
virtual void | TriggerEvent (const char *name)=0 |
Triggers a UI event. | |
template<typename T1 > | |
void | TriggerEvent (const char *name, const T1 &argument1) |
Triggers a UI event. | |
template<typename T1 , typename T2 > | |
void | TriggerEvent (const char *name, const T1 &argument1, const T2 &argument2) |
Triggers a UI event. | |
template<typename T1 , typename T2 , typename T3 > | |
void | TriggerEvent (const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3) |
Triggers a UI event. | |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
void | TriggerEvent (const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4) |
Triggers a UI event. | |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > | |
void | TriggerEvent (const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4, const T5 &argument5) |
Triggers a UI event. | |
Data-binding | |
typedef void(* | CoherentInternalBindGenericFunc) (cohtml::Binder *, void *) |
template<typename T > | |
void | CreateModel (const char *name, T *model) |
Creates a model for binding. More... | |
virtual void | UpdateWholeModel (void *model)=0 |
Marks a model as dirty. Properties will be synchronized using the View::SynchronizeModels call. More... | |
virtual void | SynchronizeModels ()=0 |
Applies the changes accumulated by View::UpdateWholeModel and View::UpdateModelProperty to the corresponding JavaScript objects. | |
virtual void | RegisterModel (const char *name, void *model, CoherentInternalBindGenericFunc func)=0 |
Registers a model with a given name. More... | |
virtual void | UnregisterModel (void *model)=0 |
Unregisters a model. More... | |
The View represents a UI page with its DOM, styles and JavaScript context. Think of the View as a whole UI or UI element. The View for instance could be the whole HUD of a game.
|
pure virtual |
Schedules execution of JavaScript code on every page load. Can be called at any time. The scripts will be executed on the next page load in the same order they were added.
script | code to be evaluated in the context of the main frame of the view |
|
pure virtual |
Advances the internal timer of the View and runs all animations. If changes have happened in the page, this call will also trigger a new layout and render on the other threads.
timeMilliseconds | the time in milliseconds since arbitrary point in time. The time must be monotonically increasing |
|
pure virtual |
Will begin serializing every rendered frame to a memory blob which will be passed in the callback. The saved frames can be inspected for debug purposes.
userData | opaque pointer which will be passed in the callback |
callback | Pointer to function which will be called with the serialized data. The callback will be called on the Main thread. |
|
pure virtual |
Expose C++ handler to be called from UI.
name | name for the handler in the UI |
handler | handler to be executed |
|
pure virtual |
Will serialize next rendered frame to a memory blob which will be passed in the callback. The saved frames can be inspected for debug purposes.
userData | opaque pointer which will be passed in the callback |
callback | Pointer to function which will be called with the serialized data. The callback will be called on the Main thread. |
|
pure virtual |
Debugging flag. This will cause the View to re-draw itself each frame.
enable | whether to enable the continuous repaint mode |
|
inline |
Creates a model for binding.
name | the name for the model |
model | pointer to the object used as model (must be even aligned) |
|
pure virtual |
Remove exposed object from JavaScript.
object | the C++ object that to be removed from JavaScript |
|
pure virtual |
Execute arbitrary JavaScript code. This should be called only with a valid script context created.
script | code to be evaluated in the context of the main frame of the view |
|
inline |
Expose object as global variable.
name | name of the global variable |
object | the instance for the global variable |
|
pure virtual |
Sends a gesture input event to the View.
event | a gesture event |
handled | a boolean that indicates whether the event was handled by the UI. Can be nullptr. |
userData | an opaque pointer passed to the ViewListener::OnNodeGestureEvent method. Can be nullptr. |
|
pure virtual |
Cancels the current IME composition.
|
pure virtual |
Confirms the current IME composition.
composition | the string to confirm |
|
pure virtual |
Updates the internal state of the IME composition in the View.
composition | the composition string so far |
targetStart | the index at the start of the selection |
targetEnd | the index at the end of the selection |
|
pure virtual |
Checks whether the CoherentHummingbird.js bindings are initialized and ready to use.
|
pure virtual |
Sends a keyboard input event to the View.
event | a keyboard event |
handled | a boolean that indicates whether the event was handled by the UI. Can be nullptr. |
userData | an opaque pointer passed to the ViewListener::OnNodeMouseEvent method. Can be nullptr. |
|
pure virtual |
Loads a page in the View.
url | A URL for the page to be loaded. Must be a valid URL. Spaces aren't allowed. |
|
pure virtual |
Sends a mouse input event to the View.
event | a mouse event |
handled | a boolean that indicates whether the event was handled by the UI. Can be nullptr. |
userData | an opaque pointer passed to the ViewListener::OnNodeMouseEvent method. Can be nullptr. |
|
pure virtual |
Expose C++ handler to be called when a specific event occurs.
name | name of the event |
handler | handler to be executed |
|
pure virtual |
Registers a model with a given name.
name | the name of the model |
model | the model pointer (must be even aligned) |
func | overload of CoherentBindInternal for the custom type |
|
pure virtual |
Resizes the View contents.
|
pure virtual |
Sets the User Agent string.
userAgent | the user agent string |
|
pure virtual |
Debugging flag. This will cause the View to draw the bounding-boxes of all elements.
show | whether to show the bounding-boxes of elements |
|
pure virtual |
Debugging flag. This will cause the View show which parts of the texture are re-drawn each frame.
show | whether to show the paint rectangles |
|
pure virtual |
Sends a touch input event to the View.
events | an array of 'count' events |
count | the count of events passed |
handled | an array of 'count' booleans indicating whether the events were handled by the UI. Can be nullptr. |
userData | an opaque pointer passed to the ViewListener::OnNodeTouched method. Can be nullptr. |
|
pure virtual |
Remove a bound C++ handler.
handle | the handle of the handler to be unbound |
|
pure virtual |
Remove all handlers bound to a specific object.
object | the object whose handlers will be removed |
|
pure virtual |
Remove a registered C++ handler.
handle | the handle of the event handler to be unregistered |
|
pure virtual |
Unregisters a model.
model | the model to be unregistered. |
|
pure virtual |
Marks a model as dirty. Properties will be synchronized using the View::SynchronizeModels call.
model | the model to be marked as dirty |