1.6.0.1
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/Binding.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;
57 typedef void* BoundEventHandle;
58 
59 template <typename T>
60 void CoherentCreateModelBindPointer(Binder* binder, T* model)
61 {
62  binder->BeginType();
63  CoherentBind(binder, model);
64  binder->EndType(model);
65 }
66 
67 #if defined(IW_SDK)
68 template <typename T>
69 void CoherentGenericBind(Binder* b, const void* arg)
70 {
71  CoherentBindInternal(b, *(const T*)arg);
72 }
73 typedef void(*CoherentGenericBindFuncPtr)(Binder*, const void*);
74 #endif
75 }
76 
77 #if defined(IW_SDK)
78 extern "C"
79 {
80 void HummingbirdTriggerEventOnOSThread(void* binder, const char* name, int numArgs,
81  void* functions, const void** args);
82 }
83 #endif
84 
85 namespace cohtml
86 {
87 
89 {
92 };
93 
94 typedef void (*OnRenderingTasksAvailableFunc)(void* userData, unsigned viewId, unsigned frameId, RenderingTasksAvailableType type);
95 typedef double (*OnMonotonicallyIncreasingTimeRequestFunc)(void* userdata, unsigned viewId);
96 
99 {
102 
104  unsigned Width;
105 
107  unsigned Height;
108 
112 
116 
118  void* UserData;
119 
128 
134 
138 
142 
147 
149  unsigned DoubleClickTime;
150 
154 
156  const void* DeveloperOptions;
157 
159  : Listener(nullptr)
160  , Width(1280u)
161  , Height(720u)
162  , OnRenderingTasksAvailable(nullptr)
164  , UserData(nullptr)
170  , DoubleClickTime(200)
171  , TextInputHandler(nullptr)
172  , DeveloperOptions(nullptr)
173  {}
174 };
175 
176 
177 namespace InputEventPhase
178 {
181  {
183  NONE = 0,
184 
187 
190 
193  };
194 }
195 
197 namespace EventAction
198 {
200  enum Actions
201  {
204 
208  };
209 };
210 
211 
212 namespace TextInputControlType
213 {
216  {
219 
222  };
223 };
224 
225 namespace TextInput
226 {
229  {
236  };
237 
239  struct Range
240  {
242  unsigned Start;
244  unsigned End;
245  };
246 
248  struct Selection
249  {
254  };
255 
256  struct Rectangle
257  {
259  float X;
261  float Y;
263  float Width;
265  float Height;
266  };
267 };
268 
271 {
273  unsigned Width;
274 
276  unsigned Height;
277 
279  unsigned AvailableWidth;
280 
282  unsigned AvailableHeight;
283 
285  unsigned ColorDepth;
286 
288  unsigned PixelDepth;
289 
291  : Width(0)
292  , Height(0)
293  , AvailableWidth(0)
294  , AvailableHeight(0)
295  , ColorDepth(0)
296  , PixelDepth(0)
297  {}
298 };
299 
300 // Reflects the status based on which cohtml should handle a concrete resource request
302 {
305 };
306 
308 class COHTML_API IViewListener
309 {
310 public:
311  virtual ~IViewListener();
312 
317  virtual bool OnNavigateTo(const char* url)
318  {
319  UNUSED_PARAM(url);
320  return true;
321  }
322 
329  {
330  UNUSED_PARAM(url);
331  return InterceptRequestStatus::Allow;
332  }
333 
337  virtual void OnScriptContextCreated()
338  {}
339 
342  virtual void OnDOMBuilt()
343  {}
344 
348  virtual void OnLoadFailed(const char* url, const char* error)
349  {
350  UNUSED_PARAM(url);
351  UNUSED_PARAM(error);
352  }
353 
357  virtual void OnFinishLoad(const char* url)
358  {
359  UNUSED_PARAM(url);
360  }
361 
363  virtual void OnReadyForBindings()
364  {}
365 
369  virtual void OnBindingsReleased()
370  {}
371 
375  {
376  cohtml::ScreenInfo info;
377  info.AvailableWidth = 1920u;
378  info.AvailableHeight = 1080u;
379  info.ColorDepth = 24;
380  info.PixelDepth = 24;
381  info.Width = 1920u;
382  info.Height = 1080u;
383  return info;
384  }
385 
390  const TouchEventData* event,
391  void* userData,
392  const InputEventPhase::PhaseType phase)
393  {
394  UNUSED_PARAM(node);
395  UNUSED_PARAM(event);
396  UNUSED_PARAM(userData);
397  UNUSED_PARAM(phase);
399  }
400 
405  const MouseEventData* event,
406  void* userData,
407  const InputEventPhase::PhaseType phase)
408  {
409  UNUSED_PARAM(node);
410  UNUSED_PARAM(event);
411  UNUSED_PARAM(userData);
412  UNUSED_PARAM(phase);
414  }
415 
420  const KeyEventData* event,
421  void* userData,
422  const InputEventPhase::PhaseType phase)
423  {
424  UNUSED_PARAM(node);
425  UNUSED_PARAM(event);
426  UNUSED_PARAM(userData);
427  UNUSED_PARAM(phase);
429  }
430 
436  virtual void OnAudioStreamCreated(int id, int bitDepth, int channels,
437  float samplingRate)
438  {
439  UNUSED_PARAM(id);
440  UNUSED_PARAM(bitDepth);
441  UNUSED_PARAM(channels);
442  UNUSED_PARAM(samplingRate);
443  }
444 
447  virtual void OnAudioStreamClosed(int id)
448  {
449  UNUSED_PARAM(id);
450  }
451 
454  virtual void OnAudioStreamPlay(int id)
455  {
456  UNUSED_PARAM(id);
457  }
458 
461  virtual void OnAudioStreamPause(int id)
462  {
463  UNUSED_PARAM(id);
464  }
465 
472  virtual void OnAudioDataReceived(int id, int samples, float** pcm,
473  int channels)
474  {
475  UNUSED_PARAM(id);
476  UNUSED_PARAM(samples);
477  UNUSED_PARAM(pcm);
478  UNUSED_PARAM(channels);
479  }
480 
483  virtual void OnAudioStreamEnded(int id)
484  {
485  UNUSED_PARAM(id);
486  }
487 
491  virtual void OnAudioStreamVolumeChanged(int id, float volume)
492  {
493  UNUSED_PARAM(id);
494  UNUSED_PARAM(volume);
495  }
496 
501  {
502  UNUSED_PARAM(type);
503  }
504 
512  virtual void OnCaretRectChanged(int x,
513  int y,
514  unsigned width,
515  unsigned height)
516  {
517  UNUSED_PARAM(x);
518  UNUSED_PARAM(y);
519  UNUSED_PARAM(width);
520  UNUSED_PARAM(height);
521  }
522 
526  {}
527 
534  virtual void OnCursorChanged(CursorTypes::Cursors cursor, const char* url, const float* xHotspot, const float* yHotspot)
535  {
536  UNUSED_PARAM(cursor);
537  UNUSED_PARAM(url);
538  UNUSED_PARAM(xHotspot);
539  UNUSED_PARAM(yHotspot);
540  }
541 
546  virtual void OnClipboardTextSet(const char* text, unsigned lengthBytes)
547  {
548  UNUSED_PARAM(text);
549  UNUSED_PARAM(lengthBytes);
550  }
551 
555  {
559  virtual void Set(const char* text, unsigned lengthBytes) = 0;
560 
561  virtual ~IClipboardData() {}
562  };
563 
569  virtual void OnClipboardTextGet(IClipboardData* setDataObject)
570  {
571  UNUSED_PARAM(setDataObject);
572  }
573 };
574 
576 struct DebugDump
577 {
579  {
580  DF_None = 0,
583  };
584 
585  const char* Dump;
586  virtual void Release() = 0;
587  virtual ~DebugDump();
588 };
589 
594 {
596  const char* Data;
597 
599  unsigned long long Size;
600 
602  virtual void Release() = 0;
603  virtual ~FrameCapture();
604 };
605 
610 {
612  virtual const char* Next() = 0;
613 
615  virtual void ResetIterator() = 0;
616 
618  virtual void Release() = 0;
619  virtual ~ImagesList();
620 };
621 
624 namespace ImagesListExtract
625 {
627  enum Options
628  {
630  Images = 0,
632  Hidden = 1 << 0,
635  Styles = 1 << 1
636  };
637 }
638 
642 typedef void(*FrameCaptureCallback)(void* userData, FrameCapture* capture);
643 
645 {
648  ICACHE_Shadows = 1 << 0,
651  ICACHE_Paths = 1 << 1,
654  ICACHE_Textures = 1 << 2,
658 };
659 
663 class View
664 {
665 public:
666  virtual ~View();
667 
669  virtual void Destroy() = 0;
670 
673  virtual void LoadURL(const char* url) = 0;
674 
676  virtual void Reload() = 0;
677 
681  virtual void UnloadDocument() = 0;
682 
687  virtual unsigned Advance(TimePoint timeMilliseconds) = 0;
688 
690  virtual unsigned GetId() const = 0;
691 
693  virtual TaskFamilyId GetTaskFamilyId() const = 0;
694 
700  virtual void Resize(unsigned width, unsigned height) = 0;
701 
703  virtual unsigned GetWidth() const = 0;
704 
706  virtual unsigned GetHeight() const = 0;
707 
711  virtual void EnableRendering(bool value) = 0;
712 
716  virtual void ContinuousRepaint(bool enable) = 0;
717 
720  virtual void ShowPaintRectangles(bool show) = 0;
721 
724  virtual void ShowElementAABBs(bool show) = 0;
725 
736  virtual void EmitRenderingMetadata(bool emit) = 0;
737 
739  virtual DebugDump* DebugDumpDOMTree(unsigned flags) = 0;
740 
743 
749  virtual void TouchEvent(const cohtml::TouchEventData* events, unsigned count, bool* handled, void* userData) = 0;
750 
755  virtual void GestureEvent(const cohtml::GestureEventData& event, bool* handled, void* userData) = 0;
756 
761  virtual void MouseEvent(const cohtml::MouseEventData& event, bool* handled, void* userData) = 0;
762 
767  virtual void KeyEvent(const cohtml::KeyEventData& event, bool* handled, void* userData) = 0;
768 
774  virtual bool IMESetComposition(const char* composition,
775  unsigned targetStart,
776  unsigned targetEnd) = 0;
777 
781  virtual bool IMEConfirmComposition(const char* composition) = 0;
782 
785  virtual bool IMECancelComposition() = 0;
786 
789  virtual void SetUserAgent(const char* userAgent) = 0;
790 
798  virtual ImagesList* GetUsedImagesList(ImagesListExtract::Options options) const = 0;
799 
808  virtual void BeginCaptureDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
809 
811  virtual void EndCaptureDebugFrame() = 0;
812 
822  virtual void CaptureSingleDebugFrame(void* userData, FrameCaptureCallback callback) = 0;
823 
830  virtual void GetCacheCountStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
831 
838  virtual void GetCacheBytesStats(InternalCaches cache, unsigned& filled, unsigned& capacity) = 0;
839 
845  virtual void QueueSetCacheCountSize(InternalCaches cache, unsigned capacity) = 0;
846 
852  virtual void QueueSetCacheBytesSize(InternalCaches cache, unsigned capacity) = 0;
853 
857  virtual void QueueClearCaches(unsigned caches) = 0;
858 
864  virtual BoundEventHandle RegisterForEvent(const char* name,
865  IEventHandler* handler) = 0;
866 
871  virtual void UnregisterFromEvent(BoundEventHandle handle) = 0;
872 
878  virtual BoundEventHandle BindCall(const char* name, IEventHandler* handler)
879  = 0;
880 
885  virtual void UnbindCall(BoundEventHandle handle) = 0;
886 
891  virtual void UnbindObject(const void* object) = 0;
892 
896  template <typename T>
897  void ExposeAsGlobal(const char* name, T* object)
898  {
899  Binder* binder = GetBinder();
900  binder->BeginExposeObject();
901  CoherentBindInternal(binder, object);
902  binder->SetAsGlobal(name, object);
903  }
904 
907  virtual void DestroyExposedObject(void* object) = 0;
908 
912  virtual bool IsReadyForBindings() const = 0;
913 
918  virtual void ExecuteScript(const char* script) = 0;
919 
925  virtual void AddInitialScript(const char* script) = 0;
926 
928  virtual void ResetInitialScripts() = 0;
929 
931  virtual Binder* GetBinder() = 0;
932 
936 
938 
942  template <typename T>
943  void CreateModel(const char* name, T* model)
944  {
945  typedef void(*CoherentInternalBindFunc)(cohtml::Binder*, T*);
946  CoherentInternalBindFunc bindFuncPtr = &CoherentCreateModelBindPointer<T>;
947  CoherentInternalBindGenericFunc bindGenericPtr = reinterpret_cast<CoherentInternalBindGenericFunc>(bindFuncPtr);
948  RegisterModel(name, model, bindGenericPtr);
949  }
950 
954  virtual void UpdateWholeModel(void* model) = 0;
955 
958  virtual void SynchronizeModels() = 0;
959 
965  virtual void RegisterModel(const char* name, void* model, CoherentInternalBindGenericFunc func) = 0;
966 
970  virtual void UnregisterModel(void* model) = 0;
971 
973 
974 
978 
979 #if !defined(IW_SDK)
980  virtual void TriggerEvent(const char* name) = 0;
983 
986  template <typename T1>
987  void TriggerEvent(const char* name, const T1& argument1)
988  {
989  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
990  Binder* binder = GetBinder();
991 
992  if (binder)
993  {
994  binder->BeginEvent(name, 1);
995 
996  CoherentBindInternal(binder, argument1);
997 
998  binder->EndEvent();
999  }
1000  }
1001 
1004  template <typename T1, typename T2>
1005  void TriggerEvent(const char* name,
1006  const T1& argument1,
1007  const T2& argument2)
1008  {
1009  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
1010  Binder* binder = GetBinder();
1011 
1012  if (binder)
1013  {
1014 
1015  binder->BeginEvent(name, 2);
1016 
1017  CoherentBindInternal(binder, argument1);
1018  CoherentBindInternal(binder, argument2);
1019 
1020  binder->EndEvent();
1021  }
1022  }
1023 
1026  template <typename T1, typename T2, typename T3>
1027  void TriggerEvent(const char* name,
1028  const T1& argument1,
1029  const T2& argument2,
1030  const T3& argument3)
1031  {
1032  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
1033  Binder* binder = GetBinder();
1034 
1035  if (binder)
1036  {
1037  binder->BeginEvent(name, 3);
1038 
1039  CoherentBindInternal(binder, argument1);
1040  CoherentBindInternal(binder, argument2);
1041  CoherentBindInternal(binder, argument3);
1042 
1043  binder->EndEvent();
1044  }
1045  }
1046 
1049  template <typename T1, typename T2, typename T3, typename T4>
1050  void TriggerEvent(const char* name,
1051  const T1& argument1,
1052  const T2& argument2,
1053  const T3& argument3,
1054  const T4& argument4)
1055  {
1056  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
1057  Binder* binder = GetBinder();
1058 
1059  if (binder)
1060  {
1061  binder->BeginEvent(name, 4);
1062 
1063  CoherentBindInternal(binder, argument1);
1064  CoherentBindInternal(binder, argument2);
1065  CoherentBindInternal(binder, argument3);
1066  CoherentBindInternal(binder, argument4);
1067 
1068  binder->EndEvent();
1069  }
1070  }
1071 
1074  template <typename T1, typename T2, typename T3, typename T4, typename T5>
1075  void TriggerEvent(const char* name,
1076  const T1& argument1,
1077  const T2& argument2,
1078  const T3& argument3,
1079  const T4& argument4,
1080  const T5& argument5)
1081  {
1082  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
1083  Binder* binder = GetBinder();
1084 
1085  if (binder)
1086  {
1087  binder->BeginEvent(name, 5);
1088 
1089  CoherentBindInternal(binder, argument1);
1090  CoherentBindInternal(binder, argument2);
1091  CoherentBindInternal(binder, argument3);
1092  CoherentBindInternal(binder, argument4);
1093  CoherentBindInternal(binder, argument5);
1094 
1095  binder->EndEvent();
1096  }
1097  }
1099 
1100 #else
1101  inline void TriggerEventOnOSThread(const char* name)
1104  {
1105  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_0_Param, name);
1106  Binder* binder = GetBinder();
1107 
1108  if (binder)
1109  {
1110  HummingbirdTriggerEventOnOSThread(binder, name, 0, NULL, NULL);
1111  }
1112  }
1113 
1116  template <typename T1>
1117  void TriggerEvent(const char* name, const T1& argument1)
1118  {
1119  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_1_Param, name);
1120  Binder* binder = GetBinder();
1121 
1122  if (binder)
1123  {
1124  CoherentGenericBindFuncPtr functions[] = {
1125  &CoherentGenericBind<T1>
1126  };
1127  const void* args[] = {
1128  &argument1
1129  };
1130  HummingbirdTriggerEventOnOSThread(binder, name, 1, functions, args);
1131  }
1132  }
1133 
1136  template <typename T1, typename T2>
1137  void TriggerEvent(const char* name,
1138  const T1& argument1,
1139  const T2& argument2)
1140  {
1141  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_2_Param, name);
1142  Binder* binder = GetBinder();
1143 
1144  if (binder)
1145  {
1146  CoherentGenericBindFuncPtr functions[] = {
1147  &CoherentGenericBind<T1>,
1148  &CoherentGenericBind<T2>
1149  };
1150  const void* args[] = {
1151  &argument1,
1152  &argument2
1153  };
1154  HummingbirdTriggerEventOnOSThread(binder, name, 2, functions, args);
1155  }
1156  }
1157 
1160  template <typename T1, typename T2, typename T3>
1161  void TriggerEvent(const char* name,
1162  const T1& argument1,
1163  const T2& argument2,
1164  const T3& argument3)
1165  {
1166  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_3_Param, name);
1167  Binder* binder = GetBinder();
1168 
1169  if (binder)
1170  {
1171  CoherentGenericBindFuncPtr functions[] = {
1172  &CoherentGenericBind<T1>,
1173  &CoherentGenericBind<T2>,
1174  &CoherentGenericBind<T3>,
1175  };
1176  const void* args[] = {
1177  &argument1,
1178  &argument2,
1179  &argument3
1180  };
1181  HummingbirdTriggerEventOnOSThread(binder, name, 3, functions, args);
1182  }
1183  }
1184 
1187  template <typename T1, typename T2, typename T3, typename T4>
1188  void TriggerEvent(const char* name,
1189  const T1& argument1,
1190  const T2& argument2,
1191  const T3& argument3,
1192  const T4& argument4)
1193  {
1194  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_4_Param, name);
1195  Binder* binder = GetBinder();
1196 
1197  if (binder)
1198  {
1199  CoherentGenericBindFuncPtr functions[] = {
1200  &CoherentGenericBind<T1>,
1201  &CoherentGenericBind<T2>,
1202  &CoherentGenericBind<T3>,
1203  &CoherentGenericBind<T4>
1204  };
1205  const void* args[] = {
1206  &argument1,
1207  &argument2,
1208  &argument3,
1209  &argument4
1210  };
1211  HummingbirdTriggerEventOnOSThread(binder, name, 4, functions, args);
1212  }
1213  }
1214 
1217  template <typename T1, typename T2, typename T3, typename T4, typename T5>
1218  void TriggerEventOnUIThread(const char* name,
1219  const T1& argument1,
1220  const T2& argument2,
1221  const T3& argument3,
1222  const T4& argument4,
1223  const T5& argument5)
1224  {
1225  COHTML_TRIGGER_EVENT_SCOPE(TriggerEvent_5_Param, name);
1226  Binder* binder = GetBinder();
1227 
1228  if (binder)
1229  {
1230  CoherentGenericBindFuncPtr functions[] = {
1231  &CoherentGenericBind<T1>,
1232  &CoherentGenericBind<T2>,
1233  &CoherentGenericBind<T3>,
1234  &CoherentGenericBind<T4>,
1235  &CoherentGenericBind<T5>,
1236  };
1237  const void* args[] = {
1238  &argument1,
1239  &argument2,
1240  &argument3,
1241  &argument4,
1242  &argument5
1243  };
1244  HummingbirdTriggerEventOnOSThread(binder, name, 5, functions, args);
1245  }
1246  }
1248 #endif
1249 };
1250 
1251 }
virtual void BeginEvent(const char *eventName, int arguments)=0
No event is being processed at this time.
Definition: View.h:183
The event is being propagated through the target&#39;s ancestor objects.
Definition: View.h:186
Debugging class holding debug frame captured data and size. Passed to FrameCaptureCallback on View::B...
Definition: View.h:593
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:1005
Denotes a text range.
Definition: View.h:239
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:627
void TriggerEvent(const char *name, const T1 &argument1)
Triggers a UI event.
Definition: View.h:987
virtual void OnDOMBuilt()
Called when the page&#39;s DOM is fully constructed, but the referenced resources may not finish loading...
Definition: View.h:342
virtual void TriggerEvent(const char *name)=0
Triggers a UI event.
Direction
Enum containing the possible text selection directions.
Definition: View.h:228
virtual void BeginType()
Direction SelectionDirection
The direction of the selection, which shows on which end does the caret go.
Definition: View.h:253
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:248
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:259
OnMonotonicallyIncreasingTimeRequestFunc OnMonotonicallyIncreasingTimeRequest
Called during the advance of the views when accurate current time is needed The client should return ...
Definition: View.h:115
virtual void OnBindingsReleased()
Called when the JavaScript bindings are released Use this call to release any resources hold by the J...
Definition: View.h:369
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:282
bool InterceptResourceRequests
Allows you to intercept resource requests for this view in order to restrict resource access of the v...
Definition: View.h:133
EnableIf<!IsChar< ArrayType >::Value||IsSame< ArrayType, unsigned char >::Value >::Type CoherentBindInternal(Binder *binder, ArrayType(&array)[ArraySize])
Definition: Array.h:83
Definition: View.h:304
All handling will be interrupted along with event bubbling. Eventual event listeners on the Node will...
Definition: View.h:207
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:137
The input type for text.
Definition: View.h:218
unsigned long long Size
Size in bytes of the data pointed by Data.
Definition: View.h:599
RenderingTasksAvailableType
Definition: View.h:88
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:546
InterceptRequestStatus
Definition: View.h:301
virtual ScreenInfo OnScreenInfoRequested()
Called when JavaScript requested screen metrics Returns current screen metrics.
Definition: View.h:374
This flag will also include images on elements that are currently hidden (display: none) ...
Definition: View.h:632
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:94
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:279
virtual void OnFinishLoad(const char *url)
Called when a page, including the resources it refers to, is completely loaded and initialized...
Definition: View.h:357
Contains almost all Coherent namespaces, classes and functions.
Definition: CursorTypes.h:37
InternalCaches
Definition: View.h:644
Debugging class used for dumping the whole structure of the page DOM.
Definition: View.h:576
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:642
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:303
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:1075
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:654
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:146
A touch event.
Definition: InputEvents.h:63
ControlType
Enum containing the text input types.
Definition: View.h:215
ViewSettings()
Definition: View.h:158
virtual void OnAudioStreamVolumeChanged(int id, float volume)
Called when an audio stream volume has changed.
Definition: View.h:491
Other non-input types.
Definition: View.h:221
unsigned End
The end position of the range.
Definition: View.h:244
int TaskFamilyId
Definition: Declarations.h:40
void CoherentCreateModelBindPointer(Binder *binder, T *model)
Definition: View.h:60
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:203
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:389
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:500
OnRenderingTasksAvailableFunc OnRenderingTasksAvailable
Called when the View is completely advanced and laid-out.
Definition: View.h:111
virtual ~View()
virtual void OnReadyForBindings()
Called when the view is ready to accept JavaScript bindings.
Definition: View.h:363
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:153
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:897
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:141
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:404
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:483
void * UserData
Passed to the OnRenderingTasksAvailable and OnMonotonicallyIncreasingTimeRequest callbacks.
Definition: View.h:118
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:447
virtual void OnAudioStreamPause(int id)
Called by the UI when a playing media element pauses.
Definition: View.h:461
IViewListener * Listener
The ViewListener is notified of events happening in the View.
Definition: View.h:101
Range SelectionRange
The start and end positions of the selection.
Definition: View.h:251
Access the cache for complex shapes This cache has only size in number of contained objects...
Definition: View.h:651
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:436
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:242
unsigned Width
The Width of the View.
Definition: View.h:104
The View represents a UI page with its DOM, styles and JavaScript context. Think of the View as a who...
Definition: View.h:663
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:534
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3)
Triggers a UI event.
Definition: View.h:1027
float Height
Height in pixels.
Definition: View.h:265
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:419
ScreenInfo()
Definition: View.h:290
unsigned Width
Full width in pixels.
Definition: View.h:273
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:328
virtual ~IClipboardData()
Definition: View.h:561
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:261
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:454
The event is propagating back up through the target&#39;s ancestors in reverse order. ...
Definition: View.h:192
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:472
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:657
This flag is always on - the images of Visible elements will be selected.
Definition: View.h:630
unsigned DoubleClickTime
The double-click time is the maximum number of milliseconds that may occur between the first and seco...
Definition: View.h:149
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:317
const void * DeveloperOptions
Reserved property for internal usage. Do not use it.
Definition: View.h:156
virtual void OnClipboardTextGet(IClipboardData *setDataObject)
Called when the user has initiated an operation that recovers data from the clipboard (paste)...
Definition: View.h:569
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:596
Definition: View.h:256
virtual void OnScriptContextCreated()
Called immediately after the script context has been created for the page. This happens before starti...
Definition: View.h:337
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:554
void CreateModel(const char *name, T *model)
Creates a model for binding.
Definition: View.h:943
void TriggerEvent(const char *name, const T1 &argument1, const T2 &argument2, const T3 &argument3, const T4 &argument4)
Triggers a UI event.
Definition: View.h:1050
void(* CoherentInternalBindGenericFunc)(cohtml::Binder *, void *)
Definition: View.h:937
Definition: InputEvents.h:108
float Width
Width in pixels.
Definition: View.h:263
Backward direction, the caret should be at the begining of the selection.
Definition: View.h:235
Definition: View.h:580
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:56
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:525
virtual void DestroyExposedObject(void *object)=0
Remove exposed object from JavaScript.
const char * Dump
Definition: View.h:585
Interface that allows to listen for various events in the View.
Definition: View.h:308
virtual void OnLoadFailed(const char *url, const char *error)
Called when a navigation change request failed.
Definition: View.h:348
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:189
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:233
DumpFlags
Definition: View.h:578
bool EnableComplexCSSSelectorsStyling
Tells if to enable complex CSS selectors when doing style matching. By complex in this context we mea...
Definition: View.h:127
This flag will also include all images mentioned in CSS styles, even though they might not be current...
Definition: View.h:635
Holds the information about current screen.
Definition: View.h:270
Actions
Possible actions when deciding on input handling.
Definition: View.h:200
unsigned Height
Full height in pixels.
Definition: View.h:276
unsigned Height
The Height of the View.
Definition: View.h:107
Access the cache for shadow textures (e.g. box-shadow, text-shadow) This cache has only size in numbe...
Definition: View.h:648
The default selection direction.
Definition: View.h:231
PhaseType
Holds information for input event PhaseType.
Definition: View.h:180
unsigned PixelDepth
Pixel depth in bits.
Definition: View.h:288
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:609
Settings used when initializing a View.
Definition: View.h:98
double(* OnMonotonicallyIncreasingTimeRequestFunc)(void *userdata, unsigned viewId)
Definition: View.h:95
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:285
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:512
virtual void Release()=0