1.7.2.9
Prysm
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/Binding.h>
41 #include <cohtml/Socket.h>
42 
43 #if !defined(COHTML_TRIGGER_EVENT_SCOPE)
44 #define COHTML_TRIGGER_EVENT_SCOPE(CompileTimeArgsCount, RuntimeEventName)
45 #endif
46 
47 namespace cohtml
48 {
49 class Binder;
50 class IViewListener;
51 struct TouchEventData;
52 struct MouseEventData;
53 struct KeyEventData;
54 struct GestureEventData;
55 class IEventHandler;
56 class INodeProxy;
58 typedef void* BoundEventHandle;
59 
60 template <typename T>
61 void CoherentCreateModelBindPointer(Binder* binder, T* model)
62 {
63  binder->BeginType();
64  CoherentBind(binder, model);
65  binder->EndType(model);
66 }
67 
68 #if defined(IW_SDK)
69 template <typename T>
70 void CoherentGenericBind(Binder* b, const void* arg)
71 {
72  CoherentBindInternal(b, *(const T*)arg);
73 }
74 typedef void(*CoherentGenericBindFuncPtr)(Binder*, const void*);
75 #endif
76 }
77 
78 #if defined(IW_SDK)
79 extern "C"
80 {
81 void HummingbirdTriggerEventOnOSThread(void* binder, const char* name, int numArgs,
82  void* functions, const void** args);
83 }
84 #endif
85 
86 namespace cohtml
87 {
88 
90 {
93 };
94 
95 typedef void (*OnRenderingTasksAvailableFunc)(void* userData, unsigned viewId, unsigned frameId, RenderingTasksAvailableType type);
96 typedef double (*OnMonotonicallyIncreasingTimeRequestFunc)(void* userdata, unsigned viewId);
97 
100 {
103 
105  unsigned Width;
106 
108  unsigned Height;
109 
113 
117 
119  void* UserData;
120 
129 
135 
139 
143 
148 
150  unsigned DoubleClickTime;
151 
155 
158 
160  const void* DeveloperOptions;
161 
163  : Listener(nullptr)
164  , Width(1280u)
165  , Height(720u)
166  , OnRenderingTasksAvailable(nullptr)
168  , UserData(nullptr)
174  , DoubleClickTime(200)
175  , TextInputHandler(nullptr)
176  , StartPanThreshold(8)
177  , DeveloperOptions(nullptr)
178  {}
179 };
180 
181 
182 namespace InputEventPhase
183 {
186  {
188  NONE = 0,
189 
192 
195 
198  };
199 }
200 
202 namespace EventAction
203 {
205  enum Actions
206  {
209 
213  };
214 };
215 
216 
217 namespace TextInputControlType
218 {
221  {
224 
227  };
228 };
229 
230 namespace TextInput
231 {
234  {
241  };
242 
244  struct Range
245  {
247  unsigned Start;
249  unsigned End;
250  };
251 
253  struct Selection
254  {
259  };
260 
261  struct Rectangle
262  {
264  float X;
266  float Y;
268  float Width;
270  float Height;
271  };
272 };
273 
276 {
278  unsigned Width;
279 
281  unsigned Height;
282 
284  unsigned AvailableWidth;
285 
287  unsigned AvailableHeight;
288 
290  unsigned ColorDepth;
291 
293  unsigned PixelDepth;
294 
296  : Width(0)
297  , Height(0)
298  , AvailableWidth(0)
299  , AvailableHeight(0)
300  , ColorDepth(0)
301  , PixelDepth(0)
302  {}
303 };
304 
305 // Reflects the status based on which cohtml should handle a concrete resource request
307 {
310 };
311 
313 class COHTML_API IViewListener
314 {
315 public:
316  virtual ~IViewListener();
317 
322  virtual bool OnNavigateTo(const char* url)
323  {
324  UNUSED_PARAM(url);
325  return true;
326  }
327 
334  {
335  UNUSED_PARAM(url);
336  return InterceptRequestStatus::Allow;
337  }
338 
342  virtual void OnScriptContextCreated()
343  {}
344 
347  virtual void OnDOMBuilt()
348  {}
349 
353  virtual void OnLoadFailed(const char* url, const char* error)
354  {
355  UNUSED_PARAM(url);
356  UNUSED_PARAM(error);
357  }
358 
362  virtual void OnFinishLoad(const char* url)
363  {
364  UNUSED_PARAM(url);
365  }
366 
368  virtual void OnReadyForBindings()
369  {}
370 
374  virtual void OnBindingsReleased()
375  {}
376 
380  {
381  cohtml::ScreenInfo info;
382  info.AvailableWidth = 1920u;
383  info.AvailableHeight = 1080u;
384  info.ColorDepth = 24;
385  info.PixelDepth = 24;
386  info.Width = 1920u;
387  info.Height = 1080u;
388  return info;
389  }
390 
395  const TouchEventData* event,
396  void* userData,
397  const InputEventPhase::PhaseType phase)
398  {
399  UNUSED_PARAM(node);
400  UNUSED_PARAM(event);
401  UNUSED_PARAM(userData);
402  UNUSED_PARAM(phase);
404  }
405 
410  const MouseEventData* event,
411  void* userData,
412  const InputEventPhase::PhaseType phase)
413  {
414  UNUSED_PARAM(node);
415  UNUSED_PARAM(event);
416  UNUSED_PARAM(userData);
417  UNUSED_PARAM(phase);
419  }
420 
425  const KeyEventData* event,
426  void* userData,
427  const InputEventPhase::PhaseType phase)
428  {
429  UNUSED_PARAM(node);
430  UNUSED_PARAM(event);
431  UNUSED_PARAM(userData);
432  UNUSED_PARAM(phase);
434  }
435 
441  virtual void OnAudioStreamCreated(int id, int bitDepth, int channels,
442  float samplingRate)
443  {
444  UNUSED_PARAM(id);
445  UNUSED_PARAM(bitDepth);
446  UNUSED_PARAM(channels);
447  UNUSED_PARAM(samplingRate);
448  }
449 
452  virtual void OnAudioStreamClosed(int id)
453  {
454  UNUSED_PARAM(id);
455  }
456 
459  virtual void OnAudioStreamPlay(int id)
460  {
461  UNUSED_PARAM(id);
462  }
463 
466  virtual void OnAudioStreamPause(int id)
467  {
468  UNUSED_PARAM(id);
469  }
470 
477  virtual void OnAudioDataReceived(int id, int samples, float** pcm,
478  int channels)
479  {
480  UNUSED_PARAM(id);
481  UNUSED_PARAM(samples);
482  UNUSED_PARAM(pcm);
483  UNUSED_PARAM(channels);
484  }
485 
488  virtual void OnAudioStreamEnded(int id)
489  {
490  UNUSED_PARAM(id);
491  }
492 
496  virtual void OnAudioStreamVolumeChanged(int id, float volume)
497  {
498  UNUSED_PARAM(id);
499  UNUSED_PARAM(volume);
500  }
501 
506  {
507  UNUSED_PARAM(type);
508  }
509 
517  virtual void OnCaretRectChanged(int x,
518  int y,
519  unsigned width,
520  unsigned height)
521  {
522  UNUSED_PARAM(x);
523  UNUSED_PARAM(y);
524  UNUSED_PARAM(width);
525  UNUSED_PARAM(height);
526  }
527 
531  {}
532 
539  virtual void OnCursorChanged(CursorTypes::Cursors cursor, const char* url, const float* xHotspot, const float* yHotspot)
540  {
541  UNUSED_PARAM(cursor);
542  UNUSED_PARAM(url);
543  UNUSED_PARAM(xHotspot);
544  UNUSED_PARAM(yHotspot);
545  }
546 
551  virtual void OnClipboardTextSet(const char* text, unsigned lengthBytes)
552  {
553  UNUSED_PARAM(text);
554  UNUSED_PARAM(lengthBytes);
555  }
556 
560  {
564  virtual void Set(const char* text, unsigned lengthBytes) = 0;
565 
566  virtual ~IClipboardData() {}
567  };
568 
574  virtual void OnClipboardTextGet(IClipboardData* setDataObject)
575  {
576  UNUSED_PARAM(setDataObject);
577  }
578 
590  virtual IClientSideSocket* OnCreateWebSocket(ISocketListener * listener, const char* url, const char**protocols, unsigned protocolsCount)
591  {
592  UNUSED_PARAM(listener);
593  UNUSED_PARAM(url);
594  UNUSED_PARAM(protocols);
595  UNUSED_PARAM(protocolsCount);
596  return nullptr;
597  }
598 };
599 
601 struct DebugDump
602 {
604  {
605  DF_None = 0,
608  };
609 
610  const char* Dump;
611  virtual void Release() = 0;
612  virtual ~DebugDump();
613 };
614 
619 {
621  const char* Data;
622 
624  unsigned long long Size;
625 
627  virtual void Release() = 0;
628  virtual ~FrameCapture();
629 };
630 
635 {
637  virtual const char* Next() = 0;
638 
640  virtual void ResetIterator() = 0;
641 
643  virtual void Release() = 0;
644  virtual ~ImagesList();
645 };
646 
649 namespace ImagesListExtract
650 {
652  enum Options
653  {
655  Images = 0,
657  Hidden = 1 << 0,
660  Styles = 1 << 1
661  };
662 }
663 
667 typedef void(*FrameCaptureCallback)(void* userData, FrameCapture* capture);
668 
670 {
673  ICACHE_Shadows = 1 << 0,
676  ICACHE_Paths = 1 << 1,
679  ICACHE_Textures = 1 << 2,
683 };
684 
688 class View
689 {
690 public:
691  virtual ~View();
692 
694  virtual void Destroy() = 0;
695 
698  virtual void LoadURL(const char* url) = 0;
699 
701  virtual void Reload() = 0;
702 
706  virtual void UnloadDocument() = 0;
707 
712  virtual unsigned Advance(TimePoint timeMilliseconds) = 0;
713 
715  virtual unsigned GetId() const = 0;
716 
718  virtual TaskFamilyId GetTaskFamilyId() const = 0;
719 
725  virtual void Resize(unsigned width, unsigned height) = 0;
726 
728  virtual unsigned GetWidth() const = 0;
729 
731  virtual unsigned GetHeight() const = 0;
732 
736  virtual void EnableRendering(bool value) = 0;
737 
741  virtual void ContinuousRepaint(bool enable) = 0;
742 
745  virtual void ShowPaintRectangles(bool show) = 0;
746 
749  virtual void ShowElementAABBs(bool show) = 0;
750 
761  virtual void EmitRenderingMetadata(bool emit) = 0;
762 
764  virtual DebugDump* DebugDumpDOMTree(unsigned flags) = 0;
765 
768 
774  virtual void TouchEvent(const cohtml::TouchEventData* events, unsigned count, bool* handled, void* userData) = 0;
775 
780  virtual void GestureEvent(const cohtml::GestureEventData& event, bool* handled, void* userData) = 0;
781 
786  virtual void MouseEvent(const cohtml::MouseEventData& event, bool* handled, void* userData) = 0;
787 
792  virtual void KeyEvent(const cohtml::KeyEventData& event, bool* handled, void* userData) = 0;
793 
799  virtual bool IMESetComposition(const char* composition,
800  unsigned targetStart,
801  unsigned targetEnd) = 0;
802 
806  virtual bool IMEConfirmComposition(const char* composition) = 0;
807 
810  virtual bool IMECancelComposition() = 0;
811 
813  virtual float GetStartPanThreshold() const = 0;
814 
817  virtual void SetStartPanThreshold(float value) = 0;
818 
821  virtual void SetUserAgent(const char* userAgent) = 0;
822 
830  virtual ImagesList* GetUsedImagesList(ImagesListExtract::Options options) const = 0;
831 
840  virtual void BeginCaptureDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
841 
843  virtual void EndCaptureDebugFrame() = 0;
844 
854  virtual void CaptureSingleDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
855 
862  virtual void GetCacheCountStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
863 
870  virtual void GetCacheBytesStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
871 
877  virtual void QueueSetCacheCountSize(InternalCaches cache, unsigned capacity) = 0;
878 
884  virtual void QueueSetCacheBytesSize(InternalCaches cache, unsigned capacity) = 0;
885 
889  virtual void QueueClearCaches(unsigned caches) = 0;
890 
896  virtual BoundEventHandle RegisterForEvent(const char* name,
897  IEventHandler* handler) = 0;
898 
903  virtual void UnregisterFromEvent(BoundEventHandle handle) = 0;
904 
910  virtual BoundEventHandle BindCall(const char* name, IEventHandler* handler)
911  = 0;
912 
917  virtual void UnbindCall(BoundEventHandle handle) = 0;
918 
923  virtual void UnbindObject(const void* object) = 0;
924 
928  template <typename T>
929  void ExposeAsGlobal(const char* name, T* object)
930  {
931  Binder* binder = GetBinder();
932  binder->BeginExposeObject();
933  CoherentBindInternal(binder, object);
934  binder->SetAsGlobal(name, object);
935  }
936 
939  virtual void DestroyExposedObject(void* object) = 0;
940 
944  virtual bool IsReadyForBindings() const = 0;
945 
950  virtual void ExecuteScript(const char* script) = 0;
951 
957  virtual void AddInitialScript(const char* script) = 0;
958 
960  virtual void ResetInitialScripts() = 0;
961 
963  virtual Binder* GetBinder() = 0;
964 
968 
970 
974  template <typename T>
975  void CreateModel(const char* name, T* model)
976  {
977  typedef void(*CoherentInternalBindFunc)(cohtml::Binder*, T*);
978  CoherentInternalBindFunc bindFuncPtr = &CoherentCreateModelBindPointer<T>;
979  CoherentInternalBindGenericFunc bindGenericPtr = reinterpret_cast<CoherentInternalBindGenericFunc>(bindFuncPtr);
980  RegisterModel(name, model, bindGenericPtr);
981  }
982 
986  virtual void UpdateWholeModel(void* model) = 0;
987 
990  virtual void SynchronizeModels() = 0;
991 
997  virtual void RegisterModel(const char* name, void* model, CoherentInternalBindGenericFunc func) = 0;
998 
1002  virtual void UnregisterModel(void* model) = 0;
1003 
1005 
1006 
1010 
1011 #if !defined(IW_SDK)
1012  virtual void TriggerEvent(const char* name) = 0;
1015 
1018  template <typename T1>
1019  void TriggerEvent(const char* name, const T1& argument1)
1020  {
1021  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
1022  Binder* binder = GetBinder();
1023 
1024  if (binder)
1025  {
1026  binder->BeginEvent(name, 1);
1027 
1028  CoherentBindInternal(binder, argument1);
1029 
1030  binder->EndEvent();
1031  }
1032  }
1033 
1036  template <typename T1, typename T2>
1037  void TriggerEvent(const char* name,
1038  const T1& argument1,
1039  const T2& argument2)
1040  {
1041  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
1042  Binder* binder = GetBinder();
1043 
1044  if (binder)
1045  {
1046 
1047  binder->BeginEvent(name, 2);
1048 
1049  CoherentBindInternal(binder, argument1);
1050  CoherentBindInternal(binder, argument2);
1051 
1052  binder->EndEvent();
1053  }
1054  }
1055 
1058  template <typename T1, typename T2, typename T3>
1059  void TriggerEvent(const char* name,
1060  const T1& argument1,
1061  const T2& argument2,
1062  const T3& argument3)
1063  {
1064  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
1065  Binder* binder = GetBinder();
1066 
1067  if (binder)
1068  {
1069  binder->BeginEvent(name, 3);
1070 
1071  CoherentBindInternal(binder, argument1);
1072  CoherentBindInternal(binder, argument2);
1073  CoherentBindInternal(binder, argument3);
1074 
1075  binder->EndEvent();
1076  }
1077  }
1078 
1081  template <typename T1, typename T2, typename T3, typename T4>
1082  void TriggerEvent(const char* name,
1083  const T1& argument1,
1084  const T2& argument2,
1085  const T3& argument3,
1086  const T4& argument4)
1087  {
1088  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
1089  Binder* binder = GetBinder();
1090 
1091  if (binder)
1092  {
1093  binder->BeginEvent(name, 4);
1094 
1095  CoherentBindInternal(binder, argument1);
1096  CoherentBindInternal(binder, argument2);
1097  CoherentBindInternal(binder, argument3);
1098  CoherentBindInternal(binder, argument4);
1099 
1100  binder->EndEvent();
1101  }
1102  }
1103 
1106  template <typename T1, typename T2, typename T3, typename T4, typename T5>
1107  void TriggerEvent(const char* name,
1108  const T1& argument1,
1109  const T2& argument2,
1110  const T3& argument3,
1111  const T4& argument4,
1112  const T5& argument5)
1113  {
1114  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
1115  Binder* binder = GetBinder();
1116 
1117  if (binder)
1118  {
1119  binder->BeginEvent(name, 5);
1120 
1121  CoherentBindInternal(binder, argument1);
1122  CoherentBindInternal(binder, argument2);
1123  CoherentBindInternal(binder, argument3);
1124  CoherentBindInternal(binder, argument4);
1125  CoherentBindInternal(binder, argument5);
1126 
1127  binder->EndEvent();
1128  }
1129  }
1131 
1132 #else
1133  inline void TriggerEventOnOSThread(const char* name)
1136  {
1137  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_0_Param, name);
1138  Binder* binder = GetBinder();
1139 
1140  if (binder)
1141  {
1142  HummingbirdTriggerEventOnOSThread(binder, name, 0, NULL, NULL);
1143  }
1144  }
1145 
1148  template <typename T1>
1149  void TriggerEvent(const char* name, const T1& argument1)
1150  {
1151  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
1152  Binder* binder = GetBinder();
1153 
1154  if (binder)
1155  {
1156  CoherentGenericBindFuncPtr functions[] = {
1157  &CoherentGenericBind<T1>
1158  };
1159  const void* args[] = {
1160  &argument1
1161  };
1162  HummingbirdTriggerEventOnOSThread(binder, name, 1, functions, args);
1163  }
1164  }
1165 
1168  template <typename T1, typename T2>
1169  void TriggerEvent(const char* name,
1170  const T1& argument1,
1171  const T2& argument2)
1172  {
1173  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
1174  Binder* binder = GetBinder();
1175 
1176  if (binder)
1177  {
1178  CoherentGenericBindFuncPtr functions[] = {
1179  &CoherentGenericBind<T1>,
1180  &CoherentGenericBind<T2>
1181  };
1182  const void* args[] = {
1183  &argument1,
1184  &argument2
1185  };
1186  HummingbirdTriggerEventOnOSThread(binder, name, 2, functions, args);
1187  }
1188  }
1189 
1192  template <typename T1, typename T2, typename T3>
1193  void TriggerEvent(const char* name,
1194  const T1& argument1,
1195  const T2& argument2,
1196  const T3& argument3)
1197  {
1198  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
1199  Binder* binder = GetBinder();
1200 
1201  if (binder)
1202  {
1203  CoherentGenericBindFuncPtr functions[] = {
1204  &CoherentGenericBind<T1>,
1205  &CoherentGenericBind<T2>,
1206  &CoherentGenericBind<T3>,
1207  };
1208  const void* args[] = {
1209  &argument1,
1210  &argument2,
1211  &argument3
1212  };
1213  HummingbirdTriggerEventOnOSThread(binder, name, 3, functions, args);
1214  }
1215  }
1216 
1219  template <typename T1, typename T2, typename T3, typename T4>
1220  void TriggerEvent(const char* name,
1221  const T1& argument1,
1222  const T2& argument2,
1223  const T3& argument3,
1224  const T4& argument4)
1225  {
1226  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
1227  Binder* binder = GetBinder();
1228 
1229  if (binder)
1230  {
1231  CoherentGenericBindFuncPtr functions[] = {
1232  &CoherentGenericBind<T1>,
1233  &CoherentGenericBind<T2>,
1234  &CoherentGenericBind<T3>,
1235  &CoherentGenericBind<T4>
1236  };
1237  const void* args[] = {
1238  &argument1,
1239  &argument2,
1240  &argument3,
1241  &argument4
1242  };
1243  HummingbirdTriggerEventOnOSThread(binder, name, 4, functions, args);
1244  }
1245  }
1246 
1249  template <typename T1, typename T2, typename T3, typename T4, typename T5>
1250  void TriggerEventOnUIThread(const char* name,
1251  const T1& argument1,
1252  const T2& argument2,
1253  const T3& argument3,
1254  const T4& argument4,
1255  const T5& argument5)
1256  {
1257  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
1258  Binder* binder = GetBinder();
1259 
1260  if (binder)
1261  {
1262  CoherentGenericBindFuncPtr functions[] = {
1263  &CoherentGenericBind<T1>,
1264  &CoherentGenericBind<T2>,
1265  &CoherentGenericBind<T3>,
1266  &CoherentGenericBind<T4>,
1267  &CoherentGenericBind<T5>,
1268  };
1269  const void* args[] = {
1270  &argument1,
1271  &argument2,
1272  &argument3,
1273  &argument4,
1274  &argument5
1275  };
1276  HummingbirdTriggerEventOnOSThread(binder, name, 5, functions, args);
1277  }
1278  }
1280 #endif
1281 };
1282 
1283 }
virtual void BeginEvent(const char *eventName, int arguments)=0
No event is being processed at this time.
Definition: View.h:188
The event is being propagated through the target&#39;s ancestor objects.
Definition: View.h:191
Debugging class holding debug frame captured data and size. Passed to FrameCaptureCallback on View::B...
Definition: View.h:618
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:1037
Denotes a text range.
Definition: View.h:244
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:652
void TriggerEvent(const char *name, const T1 &argument1)
Triggers a UI event.
Definition: View.h:1019
virtual void OnDOMBuilt()
Called when the page&#39;s DOM is fully constructed, but the referenced resources may not finish loading...
Definition: View.h:347
virtual void TriggerEvent(const char *name)=0
Triggers a UI event.
Direction
Enum containing the possible text selection directions.
Definition: View.h:233
virtual void BeginType()
Direction SelectionDirection
The direction of the selection, which shows on which end does the caret go.
Definition: View.h:258
virtual void ResetInitialScripts()=0
Resets the list of initial scripts executed on every page load.
virtual DebugDump * DebugDumpStackingContextTree()=0
Debugging helper. Collects data about stacking context subtrees of the DOM tree.
virtual void SetAsGlobal(const char *name, void *object)=0
Holds the information about a text selection.
Definition: View.h:253
virtual bool IMESetComposition(const char *composition, unsigned targetStart, unsigned targetEnd)=0
Updates the internal state of the IME composition in the View.
float X
Leftmost coordinate in pixels.
Definition: View.h:264
OnMonotonicallyIncreasingTimeRequestFunc OnMonotonicallyIncreasingTimeRequest
Called during the advance of the views when accurate current time is needed The client should return ...
Definition: View.h:116
virtual void OnBindingsReleased()
Called when the JavaScript bindings are released Use this call to release any resources hold by the J...
Definition: View.h:374
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:287
bool InterceptResourceRequests
Allows you to intercept resource requests for this view in order to restrict resource access of the v...
Definition: View.h:134
EnableIf<!IsChar< ArrayType >::Value||IsSame< ArrayType, unsigned char >::Value >::Type CoherentBindInternal(Binder *binder, ArrayType(&array)[ArraySize])
Definition: Array.h:83
Definition: View.h:309
All handling will be interrupted along with event bubbling. Eventual event listeners on the Node will...
Definition: View.h:212
virtual void Resize(unsigned width, unsigned height)=0
Resizes the View contents.
virtual ~DebugDump()
unsigned MinimumVertexBufferSize
Controls the mininum count of vertices allocated when creating vertex buffers. If equal to 0 then def...
Definition: View.h:138
The input type for text.
Definition: View.h:223
unsigned long long Size
Size in bytes of the data pointed by Data.
Definition: View.h:624
RenderingTasksAvailableType
Definition: View.h:89
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:551
InterceptRequestStatus
Definition: View.h:306
virtual ScreenInfo OnScreenInfoRequested()
Called when JavaScript requested screen metrics Returns current screen metrics.
Definition: View.h:379
This flag will also include images on elements that are currently hidden (display: none) ...
Definition: View.h:657
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:95
Notifies of changes to input elements.
Definition: TextInputHandler.h:41
unsigned AvailableWidth
Width of the user&#39;s screen, in pixels, minus interface features like the Windows Taskbar.
Definition: View.h:284
virtual void OnFinishLoad(const char *url)
Called when a page, including the resources it refers to, is completely loaded and initialized...
Definition: View.h:362
Contains almost all Coherent namespaces, classes and functions.
Definition: CursorTypes.h:37
InternalCaches
Definition: View.h:669
Debugging class used for dumping the whole structure of the page DOM.
Definition: View.h:601
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:667
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.
Definition: View.h:308
virtual IClientSideSocket * OnCreateWebSocket(ISocketListener *listener, const char *url, const char **protocols, unsigned protocolsCount)
Called when the view tries to establish a web socket connection. When JS tries to create a new web so...
Definition: View.h:590
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:1107
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:679
unsigned VertexIndexBufferRingSize
Controls the size of each ring buffer (the VB ring buffer and the IB ring buffer). Every call to BeginFrame rotates the ring buffer and takes the next available buffer that the GPU should not be using. The acceptable range is between 1 and 8.
Definition: View.h:147
A touch event.
Definition: InputEvents.h:63
ControlType
Enum containing the text input types.
Definition: View.h:220
ViewSettings()
Definition: View.h:162
virtual void OnAudioStreamVolumeChanged(int id, float volume)
Called when an audio stream volume has changed.
Definition: View.h:496
Other non-input types.
Definition: View.h:226
unsigned End
The end position of the range.
Definition: View.h:249
int TaskFamilyId
Definition: Declarations.h:40
float StartPanThreshold
Controls the minumum lenght of pans to be performed.
Definition: View.h:157
void CoherentCreateModelBindPointer(Binder *binder, T *model)
Definition: View.h:61
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:208
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:394
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:505
OnRenderingTasksAvailableFunc OnRenderingTasksAvailable
Called when the View is completely advanced and laid-out.
Definition: View.h:112
virtual ~View()
virtual void OnReadyForBindings()
Called when the view is ready to accept JavaScript bindings.
Definition: View.h:368
ITextInputHandler * TextInputHandler
Notifies of changes to an input elements Can be set to nullptr if the user is not interested in recei...
Definition: View.h:154
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:929
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
Controls the mininum count of indices allocated when creating index buffers. If equal to 0 then defau...
Definition: View.h:142
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:409
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:488
void * UserData
Passed to the OnRenderingTasksAvailable and OnMonotonicallyIncreasingTimeRequest callbacks.
Definition: View.h:119
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:452
virtual void OnAudioStreamPause(int id)
Called by the UI when a playing media element pauses.
Definition: View.h:466
IViewListener * Listener
The ViewListener is notified of events happening in the View.
Definition: View.h:102
Range SelectionRange
The start and end positions of the selection.
Definition: View.h:256
Access the cache for complex shapes This cache has only size in number of contained objects...
Definition: View.h:676
The ISocketListener represents cohtml::View side of the web sockets.
Definition: Socket.h:90
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:166
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:441
virtual void UnbindCall(BoundEventHandle handle)=0
Remove a bound C++ handler.
Definition: EventHandler.h:127
virtual void EndCaptureDebugFrame()=0
Ends serializing rendered frames.
unsigned Start
The start position of the range.
Definition: View.h:247
unsigned Width
The Width of the View.
Definition: View.h:105
The View represents a UI page with its DOM, styles and JavaScript context. Think of the View as a who...
Definition: View.h:688
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:539
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3)
Triggers a UI event.
Definition: View.h:1059
float Height
Height in pixels.
Definition: View.h:270
A gesture event.
Definition: InputEvents.h:228
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:424
ScreenInfo()
Definition: View.h:295
unsigned Width
Full width in pixels.
Definition: View.h:278
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 InterceptRequestStatus OnResourceRequestIntercepted(const char *url)
Only used when View::InterceptResourceRequests is explicitly set to true. Called before sending a req...
Definition: View.h:333
virtual ~IClipboardData()
Definition: View.h:566
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.
float Y
Topmost coordinate in pixels.
Definition: View.h:266
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:459
The event is propagating back up through the target&#39;s ancestors in reverse order. ...
Definition: View.h:197
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:477
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:682
This flag is always on - the images of Visible elements will be selected.
Definition: View.h:655
unsigned DoubleClickTime
The double-click time is the maximum number of milliseconds that may occur between the first and seco...
Definition: View.h:150
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:322
const void * DeveloperOptions
Reserved property for internal usage. Do not use it.
Definition: View.h:160
virtual void OnClipboardTextGet(IClipboardData *setDataObject)
Called when the user has initiated an operation that recovers data from the clipboard (paste)...
Definition: View.h:574
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:621
Definition: View.h:261
virtual void OnScriptContextCreated()
Called immediately after the script context has been created for the page. This happens before starti...
Definition: View.h:342
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:559
void CreateModel(const char *name, T *model)
Creates a model for binding.
Definition: View.h:975
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4)
Triggers a UI event.
Definition: View.h:1082
void(* CoherentInternalBindGenericFunc)(cohtml::Binder *, void *)
Definition: View.h:969
Definition: InputEvents.h:108
float Width
Width in pixels.
Definition: View.h:268
Backward direction, the caret should be at the begining of the selection.
Definition: View.h:240
Definition: View.h:605
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
virtual void SetStartPanThreshold(float value)=0
Sets the minumum lenght of pans to be performed.
void * BoundEventHandle
Definition: View.h:57
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 reset the IME composition due to an event in the View itself (i...
Definition: View.h:530
virtual void DestroyExposedObject(void *object)=0
Remove exposed object from JavaScript.
const char * Dump
Definition: View.h:610
Interface that allows to listen for various events in the View.
Definition: View.h:313
virtual void OnLoadFailed(const char *url, const char *error)
Called when a navigation change request failed.
Definition: View.h:353
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:194
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.
Forward direction, the caret should be at the end of the selection.
Definition: View.h:238
The IClientSideSocket represents platform/client specific part of the web sockets.
Definition: Socket.h:42
DumpFlags
Definition: View.h:603
virtual float GetStartPanThreshold() const =0
Returns the minumum lenght of pans to be performed.
bool EnableComplexCSSSelectorsStyling
Tells if to enable complex CSS selectors when doing style matching. By complex in this context we mea...
Definition: View.h:128
This flag will also include all images mentioned in CSS styles, even though they might not be current...
Definition: View.h:660
Holds the information about current screen.
Definition: View.h:275
Actions
Possible actions when deciding on input handling.
Definition: View.h:205
unsigned Height
Full height in pixels.
Definition: View.h:281
unsigned Height
The Height of the View.
Definition: View.h:108
Access the cache for shadow textures (e.g. box-shadow, text-shadow) This cache has only size in numbe...
Definition: View.h:673
The default selection direction.
Definition: View.h:236
PhaseType
Holds information for input event PhaseType.
Definition: View.h:185
unsigned PixelDepth
Pixel depth in bits.
Definition: View.h:293
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:634
Settings used when initializing a View.
Definition: View.h:99
double(* OnMonotonicallyIncreasingTimeRequestFunc)(void *userdata, unsigned viewId)
Definition: View.h:96
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:290
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:517
virtual void Release()=0