1.3.1.2
Gameface
View.h
1 /*
2 This file is part of Cohtml, Gameface and Prysm - modern user interface technologies.
3 
4 Copyright (c) 2012-2018 Coherent Labs AD and/or its licensors. All
5 rights reserved in all media.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain confidential
9 and unpublished information proprietary Coherent Labs and/or its
10 licensors, which is protected by United States of America federal
11 copyright law and by international treaties.
12 
13 This software or source code is supplied under the terms of a license
14 agreement and nondisclosure agreement with Coherent Labs AD and may
15 not be copied, disclosed, or exploited except in accordance with the
16 terms of that agreement. The Data may not be disclosed or distributed to
17 third parties, in whole or in part, without the prior written consent of
18 Coherent Labs AD.
19 
20 COHERENT LABS MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS
21 SOURCE CODE FOR ANY PURPOSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
22 HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE
25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER, ITS AFFILIATES,
26 PARENT COMPANIES, LICENSORS, SUPPLIERS, OR CONTRIBUTORS BE LIABLE FOR
27 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 ANY WAY OUT OF THE USE OR PERFORMANCE OF THIS SOFTWARE OR SOURCE CODE,
33 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 #pragma once
36 
37 #include <cohtml/Declarations.h>
38 #include <cohtml/ResourceHandler.h>
39 #include <cohtml/CursorTypes.h>
40 #include <cohtml/Binding/Binder.h>
41 
42 #if !defined(COHTML_TRIGGER_EVENT_SCOPE)
43 #define COHTML_TRIGGER_EVENT_SCOPE(CompileTimeArgsCount, RuntimeEventName)
44 #endif
45 
46 namespace cohtml
47 {
48 class Binder;
49 class IViewListener;
50 struct TouchEventData;
51 struct MouseEventData;
52 struct KeyEventData;
53 struct GestureEventData;
54 class IEventHandler;
55 class INodeProxy;
56 typedef void* BoundEventHandle;
57 
58 template <typename T>
59 void CoherentCreateModelBindPointer(Binder* binder, T* model)
60 {
61  binder->BeginType();
62  CoherentBind(binder, model);
63  binder->EndType(model);
64 }
65 
66 #if defined(IW_SDK)
67 template <typename T>
68 void CoherentGenericBind(Binder* b, const void* arg)
69 {
70  CoherentBindInternal(b, *(const T*)arg);
71 }
72 typedef void(*CoherentGenericBindFuncPtr)(Binder*, const void*);
73 #endif
74 }
75 
76 #if defined(IW_SDK)
77 extern "C"
78 {
79 void HummingbirdTriggerEventOnOSThread(void* binder, const char* name, int numArgs,
80  void* functions, const void** args);
81 }
82 #endif
83 
84 namespace cohtml
85 {
86 
88 {
91 };
92 
93 typedef void (*OnRenderingTasksAvailableFunc)(void* userData, unsigned viewId, unsigned frameId, RenderingTasksAvailableType type);
94 typedef double (*OnMonotonicallyIncreasingTimeRequestFunc)(void* userdata, unsigned viewId);
95 
98 {
101 
103  unsigned Width;
104 
106  unsigned Height;
107 
111 
115 
117  void* UserData;
118 
127 
134 
136  : Listener(nullptr)
137  , Width(1280u)
138  , Height(720u)
139  , OnRenderingTasksAvailable(nullptr)
141  , UserData(nullptr)
145  {}
146 };
147 
148 
149 namespace InputEventPhase
150 {
153  {
155  NONE = 0,
156 
159 
162 
165  };
166 }
167 
169 namespace EventAction
170 {
172  enum Actions
173  {
176 
180  };
181 };
182 
183 
184 namespace TextInputControlType
185 {
188  {
191 
194  };
195 };
196 
199 {
201  unsigned Width;
202 
204  unsigned Height;
205 
207  unsigned AvailableWidth;
208 
210  unsigned AvailableHeight;
211 
213  unsigned ColorDepth;
214 
216  unsigned PixelDepth;
217 
219  : Width(0)
220  , Height(0)
221  , AvailableWidth(0)
222  , AvailableHeight(0)
223  , ColorDepth(0)
224  , PixelDepth(0)
225  {}
226 };
227 
229 class COHTML_API IViewListener
230 {
231 public:
232  virtual ~IViewListener();
233 
238  virtual bool OnNavigateTo(const char* url)
239  {
240  UNUSED_PARAM(url);
241  return true;
242  }
243 
247  virtual void OnScriptContextCreated()
248  {}
249 
252  virtual void OnDOMBuilt()
253  {}
254 
258  virtual void OnLoadFailed(const char* url, const char* error)
259  {
260  UNUSED_PARAM(url);
261  UNUSED_PARAM(error);
262  }
263 
267  virtual void OnFinishLoad(const char* url)
268  {
269  UNUSED_PARAM(url);
270  }
271 
273  virtual void OnReadyForBindings()
274  {}
275 
279  virtual void OnBindingsReleased()
280  {}
281 
285  {
286  cohtml::ScreenInfo info;
287  info.AvailableWidth = 1920u;
288  info.AvailableHeight = 1080u;
289  info.ColorDepth = 24;
290  info.PixelDepth = 24;
291  info.Width = 1920u;
292  info.Height = 1080u;
293  return info;
294  }
295 
300  const TouchEventData* event,
301  void* userData,
302  const InputEventPhase::PhaseType phase)
303  {
304  UNUSED_PARAM(node);
305  UNUSED_PARAM(event);
306  UNUSED_PARAM(userData);
307  UNUSED_PARAM(phase);
309  }
310 
315  const MouseEventData* event,
316  void* userData,
317  const InputEventPhase::PhaseType phase)
318  {
319  UNUSED_PARAM(node);
320  UNUSED_PARAM(event);
321  UNUSED_PARAM(userData);
322  UNUSED_PARAM(phase);
324  }
325 
330  const KeyEventData* event,
331  void* userData,
332  const InputEventPhase::PhaseType phase)
333  {
334  UNUSED_PARAM(node);
335  UNUSED_PARAM(event);
336  UNUSED_PARAM(userData);
337  UNUSED_PARAM(phase);
339  }
340 
346  virtual void OnAudioStreamCreated(int id, int bitDepth, int channels,
347  float samplingRate)
348  {
349  UNUSED_PARAM(id);
350  UNUSED_PARAM(bitDepth);
351  UNUSED_PARAM(channels);
352  UNUSED_PARAM(samplingRate);
353  }
354 
357  virtual void OnAudioStreamClosed(int id)
358  {
359  UNUSED_PARAM(id);
360  }
361 
364  virtual void OnAudioStreamPlay(int id)
365  {
366  UNUSED_PARAM(id);
367  }
368 
371  virtual void OnAudioStreamPause(int id)
372  {
373  UNUSED_PARAM(id);
374  }
375 
382  virtual void OnAudioDataReceived(int id, int samples, float** pcm,
383  int channels)
384  {
385  UNUSED_PARAM(id);
386  UNUSED_PARAM(samples);
387  UNUSED_PARAM(pcm);
388  UNUSED_PARAM(channels);
389  }
390 
393  virtual void OnAudioStreamEnded(int id)
394  {
395  UNUSED_PARAM(id);
396  }
397 
401  virtual void OnAudioStreamVolumeChanged(int id, float volume)
402  {
403  UNUSED_PARAM(id);
404  UNUSED_PARAM(volume);
405  }
406 
411  {
412  UNUSED_PARAM(type);
413  }
414 
422  virtual void OnCaretRectChanged(int x,
423  int y,
424  unsigned width,
425  unsigned height)
426  {
427  UNUSED_PARAM(x);
428  UNUSED_PARAM(y);
429  UNUSED_PARAM(width);
430  UNUSED_PARAM(height);
431  }
432 
438  {}
439 
446  virtual void OnCursorChanged(CursorTypes::Cursors cursor, const char* url, const float* xHotspot, const float* yHotspot)
447  {
448  UNUSED_PARAM(cursor);
449  UNUSED_PARAM(url);
450  UNUSED_PARAM(xHotspot);
451  UNUSED_PARAM(yHotspot);
452  }
453 
458  virtual void OnClipboardTextSet(const char* text, unsigned lengthBytes)
459  {
460  UNUSED_PARAM(text);
461  UNUSED_PARAM(lengthBytes);
462  }
463 
467  {
471  virtual void Set(const char* text, unsigned lengthBytes) = 0;
472 
473  virtual ~IClipboardData() {}
474  };
475 
481  virtual void OnClipboardTextGet(IClipboardData* setDataObject)
482  {
483  UNUSED_PARAM(setDataObject);
484  }
485 };
486 
488 struct DebugDump
489 {
491  {
492  DF_None = 0,
495  };
496 
497  const char* Dump;
498  virtual void Release() = 0;
499  virtual ~DebugDump();
500 };
501 
506 {
508  const char* Data;
509 
511  unsigned long long Size;
512 
514  virtual void Release() = 0;
515  virtual ~FrameCapture();
516 };
517 
522 {
524  virtual const char* Next() = 0;
525 
527  virtual void ResetIterator() = 0;
528 
530  virtual void Release() = 0;
531  virtual ~ImagesList();
532 };
533 
536 namespace ImagesListExtract
537 {
539  enum Options
540  {
542  Images = 0,
544  Hidden = 1 << 0,
547  Styles = 1 << 1
548  };
549 }
550 
554 typedef void(*FrameCaptureCallback)(void* userData, FrameCapture* capture);
555 
557 {
560  ICACHE_Shadows = 1 << 0,
563  ICACHE_Paths = 1 << 1,
566  ICACHE_Textures = 1 << 2,
570 };
571 
575 class View
576 {
577 public:
578  virtual ~View();
579 
581  virtual void Destroy() = 0;
582 
585  virtual void LoadURL(const char* url) = 0;
586 
588  virtual void Reload() = 0;
589 
593  virtual void UnloadDocument() = 0;
594 
599  virtual unsigned Advance(TimePoint timeMilliseconds) = 0;
600 
602  virtual unsigned GetId() const = 0;
603 
605  virtual TaskFamilyId GetTaskFamilyId() const = 0;
606 
612  virtual void Resize(unsigned width, unsigned height) = 0;
613 
615  virtual unsigned GetWidth() const = 0;
616 
618  virtual unsigned GetHeight() const = 0;
619 
623  virtual void EnableRendering(bool value) = 0;
624 
628  virtual void ContinuousRepaint(bool enable) = 0;
629 
632  virtual void ShowPaintRectangles(bool show) = 0;
633 
636  virtual void ShowElementAABBs(bool show) = 0;
637 
648  virtual void EmitRenderingMetadata(bool emit) = 0;
649 
651  virtual DebugDump* DebugDumpDOMTree(unsigned flags) = 0;
652 
658  virtual void TouchEvent(const cohtml::TouchEventData* events, unsigned count, bool* handled, void* userData) = 0;
659 
664  virtual void GestureEvent(const cohtml::GestureEventData& event, bool* handled, void* userData) = 0;
665 
670  virtual void MouseEvent(const cohtml::MouseEventData& event, bool* handled, void* userData) = 0;
671 
676  virtual void KeyEvent(const cohtml::KeyEventData& event, bool* handled, void* userData) = 0;
677 
684  virtual bool IMESetComposition(const char* composition,
685  unsigned targetStart,
686  unsigned targetEnd) = 0;
687 
692  virtual bool IMEConfirmComposition(const char* composition) = 0;
693 
697  virtual bool IMECancelComposition() = 0;
698 
701  virtual void SetUserAgent(const char* userAgent) = 0;
702 
710  virtual ImagesList* GetUsedImagesList(ImagesListExtract::Options options) const = 0;
711 
720  virtual void BeginCaptureDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
721 
723  virtual void EndCaptureDebugFrame() = 0;
724 
734  virtual void CaptureSingleDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
735 
742  virtual void GetCacheCountStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
743 
750  virtual void GetCacheBytesStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
751 
757  virtual void QueueSetCacheCountSize(InternalCaches cache, unsigned capacity) = 0;
758 
764  virtual void QueueSetCacheBytesSize(InternalCaches cache, unsigned capacity) = 0;
765 
769  virtual void QueueClearCaches(unsigned caches) = 0;
770 
776  virtual BoundEventHandle RegisterForEvent(const char* name,
777  IEventHandler* handler) = 0;
778 
783  virtual void UnregisterFromEvent(BoundEventHandle handle) = 0;
784 
790  virtual BoundEventHandle BindCall(const char* name, IEventHandler* handler)
791  = 0;
792 
797  virtual void UnbindCall(BoundEventHandle handle) = 0;
798 
803  virtual void UnbindObject(const void* object) = 0;
804 
808  template <typename T>
809  void ExposeAsGlobal(const char* name, T* object)
810  {
811  Binder* binder = GetBinder();
812  binder->BeginExposeObject();
813  CoherentBindInternal(binder, object);
814  binder->SetAsGlobal(name, object);
815  }
816 
819  virtual void DestroyExposedObject(void* object) = 0;
820 
824  virtual bool IsReadyForBindings() const = 0;
825 
830  virtual void ExecuteScript(const char* script) = 0;
831 
837  virtual void AddInitialScript(const char* script) = 0;
838 
840  virtual void ResetInitialScripts() = 0;
841 
843  virtual Binder* GetBinder() = 0;
844 
848 
850 
854  template <typename T>
855  void CreateModel(const char* name, T* model)
856  {
857  typedef void(*CoherentInternalBindFunc)(cohtml::Binder*, T*);
858  CoherentInternalBindFunc bindFuncPtr = &CoherentCreateModelBindPointer<T>;
859  CoherentInternalBindGenericFunc bindGenericPtr = reinterpret_cast<CoherentInternalBindGenericFunc>(bindFuncPtr);
860  RegisterModel(name, model, bindGenericPtr);
861  }
862 
866  virtual void UpdateWholeModel(void* model) = 0;
867 
870  virtual void SynchronizeModels() = 0;
871 
877  virtual void RegisterModel(const char* name, void* model, CoherentInternalBindGenericFunc func) = 0;
878 
882  virtual void UnregisterModel(void* model) = 0;
883 
885 
886 
890 
891 #if !defined(IW_SDK)
892  virtual void TriggerEvent(const char* name) = 0;
895 
898  template <typename T1>
899  void TriggerEvent(const char* name, const T1& argument1)
900  {
901  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
902  Binder* binder = GetBinder();
903 
904  if (binder)
905  {
906  binder->BeginEvent(name, 1);
907 
908  CoherentBindInternal(binder, argument1);
909 
910  binder->EndEvent();
911  }
912  }
913 
916  template <typename T1, typename T2>
917  void TriggerEvent(const char* name,
918  const T1& argument1,
919  const T2& argument2)
920  {
921  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
922  Binder* binder = GetBinder();
923 
924  if (binder)
925  {
926 
927  binder->BeginEvent(name, 2);
928 
929  CoherentBindInternal(binder, argument1);
930  CoherentBindInternal(binder, argument2);
931 
932  binder->EndEvent();
933  }
934  }
935 
938  template <typename T1, typename T2, typename T3>
939  void TriggerEvent(const char* name,
940  const T1& argument1,
941  const T2& argument2,
942  const T3& argument3)
943  {
944  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
945  Binder* binder = GetBinder();
946 
947  if (binder)
948  {
949  binder->BeginEvent(name, 3);
950 
951  CoherentBindInternal(binder, argument1);
952  CoherentBindInternal(binder, argument2);
953  CoherentBindInternal(binder, argument3);
954 
955  binder->EndEvent();
956  }
957  }
958 
961  template <typename T1, typename T2, typename T3, typename T4>
962  void TriggerEvent(const char* name,
963  const T1& argument1,
964  const T2& argument2,
965  const T3& argument3,
966  const T4& argument4)
967  {
968  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
969  Binder* binder = GetBinder();
970 
971  if (binder)
972  {
973  binder->BeginEvent(name, 4);
974 
975  CoherentBindInternal(binder, argument1);
976  CoherentBindInternal(binder, argument2);
977  CoherentBindInternal(binder, argument3);
978  CoherentBindInternal(binder, argument4);
979 
980  binder->EndEvent();
981  }
982  }
983 
986  template <typename T1, typename T2, typename T3, typename T4, typename T5>
987  void TriggerEvent(const char* name,
988  const T1& argument1,
989  const T2& argument2,
990  const T3& argument3,
991  const T4& argument4,
992  const T5& argument5)
993  {
994  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
995  Binder* binder = GetBinder();
996 
997  if (binder)
998  {
999  binder->BeginEvent(name, 5);
1000 
1001  CoherentBindInternal(binder, argument1);
1002  CoherentBindInternal(binder, argument2);
1003  CoherentBindInternal(binder, argument3);
1004  CoherentBindInternal(binder, argument4);
1005  CoherentBindInternal(binder, argument5);
1006 
1007  binder->EndEvent();
1008  }
1009  }
1011 
1012 #else
1013  inline void TriggerEventOnOSThread(const char* name)
1016  {
1017  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_0_Param, name);
1018  Binder* binder = GetBinder();
1019 
1020  if (binder)
1021  {
1022  HummingbirdTriggerEventOnOSThread(binder, name, 0, NULL, NULL);
1023  }
1024  }
1025 
1028  template <typename T1>
1029  void TriggerEvent(const char* name, const T1& argument1)
1030  {
1031  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
1032  Binder* binder = GetBinder();
1033 
1034  if (binder)
1035  {
1036  CoherentGenericBindFuncPtr functions[] = {
1037  &CoherentGenericBind<T1>
1038  };
1039  const void* args[] = {
1040  &argument1
1041  };
1042  HummingbirdTriggerEventOnOSThread(binder, name, 1, functions, args);
1043  }
1044  }
1045 
1048  template <typename T1, typename T2>
1049  void TriggerEvent(const char* name,
1050  const T1& argument1,
1051  const T2& argument2)
1052  {
1053  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
1054  Binder* binder = GetBinder();
1055 
1056  if (binder)
1057  {
1058  CoherentGenericBindFuncPtr functions[] = {
1059  &CoherentGenericBind<T1>,
1060  &CoherentGenericBind<T2>
1061  };
1062  const void* args[] = {
1063  &argument1,
1064  &argument2
1065  };
1066  HummingbirdTriggerEventOnOSThread(binder, name, 2, functions, args);
1067  }
1068  }
1069 
1072  template <typename T1, typename T2, typename T3>
1073  void TriggerEvent(const char* name,
1074  const T1& argument1,
1075  const T2& argument2,
1076  const T3& argument3)
1077  {
1078  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
1079  Binder* binder = GetBinder();
1080 
1081  if (binder)
1082  {
1083  CoherentGenericBindFuncPtr functions[] = {
1084  &CoherentGenericBind<T1>,
1085  &CoherentGenericBind<T2>,
1086  &CoherentGenericBind<T3>,
1087  };
1088  const void* args[] = {
1089  &argument1,
1090  &argument2,
1091  &argument3
1092  };
1093  HummingbirdTriggerEventOnOSThread(binder, name, 3, functions, args);
1094  }
1095  }
1096 
1099  template <typename T1, typename T2, typename T3, typename T4>
1100  void TriggerEvent(const char* name,
1101  const T1& argument1,
1102  const T2& argument2,
1103  const T3& argument3,
1104  const T4& argument4)
1105  {
1106  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
1107  Binder* binder = GetBinder();
1108 
1109  if (binder)
1110  {
1111  CoherentGenericBindFuncPtr functions[] = {
1112  &CoherentGenericBind<T1>,
1113  &CoherentGenericBind<T2>,
1114  &CoherentGenericBind<T3>,
1115  &CoherentGenericBind<T4>
1116  };
1117  const void* args[] = {
1118  &argument1,
1119  &argument2,
1120  &argument3,
1121  &argument4
1122  };
1123  HummingbirdTriggerEventOnOSThread(binder, name, 4, functions, args);
1124  }
1125  }
1126 
1129  template <typename T1, typename T2, typename T3, typename T4, typename T5>
1130  void TriggerEventOnUIThread(const char* name,
1131  const T1& argument1,
1132  const T2& argument2,
1133  const T3& argument3,
1134  const T4& argument4,
1135  const T5& argument5)
1136  {
1137  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
1138  Binder* binder = GetBinder();
1139 
1140  if (binder)
1141  {
1142  CoherentGenericBindFuncPtr functions[] = {
1143  &CoherentGenericBind<T1>,
1144  &CoherentGenericBind<T2>,
1145  &CoherentGenericBind<T3>,
1146  &CoherentGenericBind<T4>,
1147  &CoherentGenericBind<T5>,
1148  };
1149  const void* args[] = {
1150  &argument1,
1151  &argument2,
1152  &argument3,
1153  &argument4,
1154  &argument5
1155  };
1156  HummingbirdTriggerEventOnOSThread(binder, name, 5, functions, args);
1157  }
1158  }
1160 #endif
1161 };
1162 
1163 }
virtual void BeginEvent(const char *eventName, int arguments)=0
No event is being processed at this time.
Definition: View.h:155
The event is being propagated through the target&#39;s ancestor objects.
Definition: View.h:158
Debugging class holding debug frame captured data and size. Passed to FrameCaptureCallback on View::B...
Definition: View.h:505
virtual unsigned GetHeight() const =0
Gets the View height.
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2)
Triggers a UI event.
Definition: View.h:917
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.
Options
Configures the images to include in the list.
Definition: View.h:539
void TriggerEvent(const char *name, const T1 &argument1)
Triggers a UI event.
Definition: View.h:899
virtual void OnDOMBuilt()
Called when the page&#39;s DOM is fully constructed, but the referenced resources may not finish loading...
Definition: View.h:252
virtual void TriggerEvent(const char *name)=0
Triggers a UI event.
virtual void BeginType()
virtual void ResetInitialScripts()=0
Resets the list of initial scripts executed on every page load.
virtual void SetAsGlobal(const char *name, void *object)=0
virtual bool IMESetComposition(const char *composition, unsigned targetStart, unsigned targetEnd)=0
Updates the internal state of the IME composition in the View.
OnMonotonicallyIncreasingTimeRequestFunc OnMonotonicallyIncreasingTimeRequest
Called during the advance of the views when accurate current time is needed The client should return ...
Definition: View.h:114
virtual void OnBindingsReleased()
Called when the JavaScript bindings are released Use this call to release any resources hold by the J...
Definition: View.h:279
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 vie...
unsigned AvailableHeight
Height of the user&#39;s screen, in pixels, minus interface features like the Windows Taskbar...
Definition: View.h:210
All handling will be interrupted along with event bubbling. Eventual event listeners on the Node will...
Definition: View.h:179
virtual void Resize(unsigned width, unsigned height)=0
Resizes the View contents.
virtual ~DebugDump()
unsigned MinimumVertexBufferSize
This controls the mininum count of vertices allocated when creating vertex buffers. If equal to 0 then default count will be used which is 32768.
Definition: View.h:130
The input type for text.
Definition: View.h:190
unsigned long long Size
Size in bytes of the data pointed by Data.
Definition: View.h:511
RenderingTasksAvailableType
Definition: View.h:87
double TimePoint
Definition: Declarations.h:39
virtual ~ImagesList()
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)...
Definition: View.h:458
virtual ScreenInfo OnScreenInfoRequested()
Called when JavaScript requested screen metrics Returns current screen metrics.
Definition: View.h:284
This flag will also include images on elements that are currently hidden (display: none) ...
Definition: View.h:544
virtual void ResetIterator()=0
Will reset the internal iterator used by Next() to the beginning of the list.
void(* OnRenderingTasksAvailableFunc)(void *userData, unsigned viewId, unsigned frameId, RenderingTasksAvailableType type)
Definition: View.h:93
unsigned AvailableWidth
Width of the user&#39;s screen, in pixels, minus interface features like the Windows Taskbar.
Definition: View.h:207
void CoherentBindInternal(Binder *binder, ArrayType(&array)[ArraySize])
Definition: Array.h:80
virtual void OnFinishLoad(const char *url)
Called when a page, including the resources it refers to, is completely loaded and initialized...
Definition: View.h:267
Contains almost all Coherent namespaces, classes and functions.
Definition: CursorTypes.h:37
InternalCaches
Definition: View.h:556
Debugging class used for dumping the whole structure of the page DOM.
Definition: View.h:488
virtual unsigned Advance(TimePoint timeMilliseconds)=0
Advances the internal timer of the View and runs all animations. If changes have happened in the page...
virtual void UnregisterFromEvent(BoundEventHandle handle)=0
Remove a registered C++ handler.
void(* FrameCaptureCallback)(void *userData, FrameCapture *capture)
Function signature of callback used in View::BeginCaptureDebugFrame and View::CaptureSingleDebugFrame...
Definition: View.h:554
virtual void EndType(void *)
virtual void LoadURL(const char *url)=0
Loads a page in the View.
virtual BoundEventHandle BindCall(const char *name, IEventHandler *handler)=0
Expose C++ handler to be called from UI.
virtual unsigned GetId() const =0
Returns the unique ID of the View.
virtual void QueueSetCacheCountSize(InternalCaches cache, unsigned capacity)=0
Queue task to set the maximum number of objects in internal cache.
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4, const T5 &argument5)
Triggers a UI event.
Definition: View.h:987
virtual TaskFamilyId GetTaskFamilyId() const =0
Returns the Task Family Id that can be used to schedule Layout work in an auxiliary thread...
Access the cache for client textures (such as image elements) This cache has both size in number of c...
Definition: View.h:566
A touch event.
Definition: InputEvents.h:63
ControlType
Enum containing the text input types.
Definition: View.h:187
ViewSettings()
Definition: View.h:135
virtual void OnAudioStreamVolumeChanged(int id, float volume)
Called when an audio stream volume has changed.
Definition: View.h:401
Other non-input types.
Definition: View.h:193
int TaskFamilyId
Definition: Declarations.h:40
void CoherentCreateModelBindPointer(Binder *binder, T *model)
Definition: View.h:59
virtual void Destroy()=0
Destroys the View. Should be called before the destruction of the System and Library.
virtual void KeyEvent(const cohtml::KeyEventData &event, bool *handled, void *userData)=0
Sends a keyboard input event to the View.
virtual bool IMECancelComposition()=0
Cancels the current IME composition.
The View will continue with the normal handling of the event.
Definition: View.h:175
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 hand...
Definition: View.h:299
virtual void GestureEvent(const cohtml::GestureEventData &event, bool *handled, void *userData)=0
Sends a gesture input event to the View.
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.
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.
Definition: View.h:410
OnRenderingTasksAvailableFunc OnRenderingTasksAvailable
Called when the View is completely advanced and laid-out.
Definition: View.h:110
virtual ~View()
virtual void OnReadyForBindings()
Called when the view is ready to accept JavaScript bindings.
Definition: View.h:273
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...
void ExposeAsGlobal(const char *name, T *object)
Expose object as global variable.
Definition: View.h:809
virtual void TouchEvent(const cohtml::TouchEventData *events, unsigned count, bool *handled, void *userData)=0
Sends a touch input event to the View.
virtual Binder * GetBinder()=0
Returns a pointer to the internal binder.
virtual const char * Next()=0
Returns the next image in the list. Will return nullptr when the end is reached.
virtual bool IsReadyForBindings() const =0
Checks whether the cohtml.js bindings are initialized and ready to use.
unsigned MinimumIndexBufferSize
This controls the mininum count of indices allocated when creating index buffers. If equal to 0 then ...
Definition: View.h:133
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 hand...
Definition: View.h:314
virtual DebugDump * DebugDumpDOMTree(unsigned flags)=0
Debugging helper. Collects a comprehensive DOM structure dump.
virtual void OnAudioStreamEnded(int id)
Called when an audio stream ends and will no longer receive data.
Definition: View.h:393
void * UserData
Passed to the OnRenderingTasksAvailable and OnMonotonicallyIncreasingTimeRequest callbacks.
Definition: View.h:117
virtual BoundEventHandle RegisterForEvent(const char *name, IEventHandler *handler)=0
Expose C++ handler to be called when a specific event occurs.
virtual void UpdateWholeModel(void *model)=0
Marks a model as dirty. Properties will be synchronized using the View::SynchronizeModels call...
virtual void OnAudioStreamClosed(int id)
Called when an audio stream is destroyed.
Definition: View.h:357
virtual void OnAudioStreamPause(int id)
Called by the UI when a playing media element pauses.
Definition: View.h:371
IViewListener * Listener
The ViewListener is notified of events happening in the View.
Definition: View.h:100
Access the cache for complex shapes This cache has only size in number of contained objects...
Definition: View.h:563
virtual unsigned GetWidth() const =0
Gets the View width.
virtual void ExecuteScript(const char *script)=0
Execute arbitrary JavaScript code. This should be called only with a valid script context created...
virtual void QueueClearCaches(unsigned caches)=0
Queue a task to clear an internal caches list.
A keyboard event.
Definition: InputEvents.h:160
virtual void OnAudioStreamCreated(int id, int bitDepth, int channels, float samplingRate)
Called by the UI when a media element initializes an audio stream.
Definition: View.h:346
virtual void UnbindCall(BoundEventHandle handle)=0
Remove a bound C++ handler.
Definition: EventHandler.h:125
virtual void EndCaptureDebugFrame()=0
Ends serializing rendered frames.
unsigned Width
The Width of the View.
Definition: View.h:103
The View represents a UI page with its DOM, styles and JavaScript context. Think of the View as a who...
Definition: View.h:575
Cursors
Definition: CursorTypes.h:41
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 ...
Definition: View.h:446
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3)
Triggers a UI event.
Definition: View.h:939
A gesture event.
Definition: InputEvents.h:222
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 hand...
Definition: View.h:329
ScreenInfo()
Definition: View.h:218
unsigned Width
Full width in pixels.
Definition: View.h:201
virtual void UnregisterModel(void *model)=0
Unregisters a model.
virtual void QueueSetCacheBytesSize(InternalCaches cache, unsigned capacity)=0
Queue task to set the maximum bytes allowed for internal cache.
virtual void ShowElementAABBs(bool show)=0
Debugging flag. This will cause the View to draw the bounding-boxes of all elements.
Provides binding between C++ and the UI.
Definition: Binder.h:138
virtual void SynchronizeModels()=0
Applies the changes accumulated by View::UpdateWholeModel and View::UpdateModelProperty to the corres...
virtual ~IClipboardData()
Definition: View.h:473
virtual void SetUserAgent(const char *userAgent)=0
Sets the User Agent string.
virtual void MouseEvent(const cohtml::MouseEventData &event, bool *handled, void *userData)=0
Sends a mouse input event to the View.
virtual void GetCacheBytesStats(InternalCaches cache, unsigned &filled, unsigned &capacity)=0
Get info about the bytes statistic of a particular internal cache.
virtual void Release()=0
Frees the underlying data.
virtual void OnAudioStreamPlay(int id)
Called by the UI when a media element starts playing an audio stream.
Definition: View.h:364
The event is propagating back up through the target&#39;s ancestors in reverse order. ...
Definition: View.h:164
virtual void OnAudioDataReceived(int id, int samples, float **pcm, int channels)
Called by the UI when there is decoded PCM data available for playing.
Definition: View.h:382
virtual void EnableRendering(bool value)=0
Enables or disables the recording of rendering commands for the view. Enabled by default.
Access the cache for temporary internal textures The size of the texture is only in bytes...
Definition: View.h:569
This flag is always on - the images of Visible elements will be selected.
Definition: View.h:542
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 co...
Definition: View.h:238
virtual void OnClipboardTextGet(IClipboardData *setDataObject)
Called when the user has initiated an operation that recovers data from the clipboard (paste)...
Definition: View.h:481
virtual ImagesList * GetUsedImagesList(ImagesListExtract::Options options) const =0
Return a list of images currently in use by the View The list can be used to decide which images to p...
const char * Data
Pointer to the binary capture data.
Definition: View.h:508
virtual void OnScriptContextCreated()
Called immediately after the script context has been created for the page. This happens before starti...
Definition: View.h:247
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.
Definition: View.h:466
void CreateModel(const char *name, T *model)
Creates a model for binding.
Definition: View.h:855
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4)
Triggers a UI event.
Definition: View.h:962
void(* CoherentInternalBindGenericFunc)(cohtml::Binder *, void *)
Definition: View.h:849
Definition: InputEvents.h:104
Definition: View.h:492
virtual void EndEvent()=0
virtual void RegisterModel(const char *name, void *model, CoherentInternalBindGenericFunc func)=0
Registers a model with a given name.
Represents a DOM element in the View - i.e. a DIV, the BODY etc.
Definition: NodeProxy.h:43
void * BoundEventHandle
Definition: View.h:55
virtual void GetCacheCountStats(InternalCaches cache, unsigned &filled, unsigned &capacity)=0
Get info about the number of objects statistic of a particular internal cache.
virtual void OnIMEShouldCancelComposition()
Called when the user must cancel the IME composition due to an event in the View itself (i...
Definition: View.h:437
virtual void DestroyExposedObject(void *object)=0
Remove exposed object from JavaScript.
const char * Dump
Definition: View.h:497
Interface that allows to listen for various events in the View.
Definition: View.h:229
virtual void OnLoadFailed(const char *url, const char *error)
Called when a navigation change request failed.
Definition: View.h:258
The event has arrived at the event&#39;s target, event&#39;s node is the one that is being hit by the input...
Definition: View.h:161
virtual void ShowPaintRectangles(bool show)=0
Debugging flag. This will cause the View show which parts of the texture are re-drawn each frame...
virtual bool IMEConfirmComposition(const char *composition)=0
Confirms the current IME composition.
DumpFlags
Definition: View.h:490
bool EnableComplexCSSSelectorsStyling
Tells if to enable complex CSS selectors when doing style matching. By complex in this context we mea...
Definition: View.h:126
This flag will also include all images mentioned in CSS styles, even though they might not be current...
Definition: View.h:547
Holds the information about current screen.
Definition: View.h:198
Actions
Possible actions when deciding on input handling.
Definition: View.h:172
unsigned Height
Full height in pixels.
Definition: View.h:204
unsigned Height
The Height of the View.
Definition: View.h:106
Access the cache for shadow textures (e.g. box-shadow, text-shadow) This cache has only size in numbe...
Definition: View.h:560
PhaseType
Holds information for input event PhaseType.
Definition: View.h:152
unsigned PixelDepth
Pixel depth in bits.
Definition: View.h:216
A list of images. Used for getting all images that are currently loaded by this View. The list can be used to build a collection of resources that must be pre-loaded via native code or JavaScript to avoid dynamic loading when the page is shown.
Definition: View.h:521
Settings used when initializing a View.
Definition: View.h:97
double(* OnMonotonicallyIncreasingTimeRequestFunc)(void *userdata, unsigned viewId)
Definition: View.h:94
virtual void EmitRenderingMetadata(bool emit)=0
Debugging flag. Enabling this will request the library to attach and emit metadata for every renderin...
virtual void Release()=0
Frees the underlying data.
virtual void BeginExposeObject()=0
virtual void ContinuousRepaint(bool enable)=0
Debugging flag. This will cause the View to re-draw itself each frame.
unsigned ColorDepth
Color depth in bits.
Definition: View.h:213
virtual void UnbindObject(const void *object)=0
Remove all handlers bound to a specific object.
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...
Definition: View.h:422
virtual void Release()=0