Vuo  2.0.0
VuoDragEvent.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoDragEvent.h"
12 
14 #ifdef VUO_COMPILER
16  "title" : "Drag Event",
17  "description" : "Information about an in-progress or completed file drag.",
18  "keywords" : [ ],
19  "version" : "1.0.0",
20  "dependencies" : [
21  "VuoPoint2d",
22  "VuoUrl",
23  "VuoList_VuoUrl"
24  ]
25  });
26 #endif
27 
40 {
41  return (VuoDragEvent){
42  VuoJson_getObjectValue(VuoPoint2d, js, "position", (VuoPoint2d){0,0}),
43  VuoJson_getObjectValue(VuoList_VuoUrl, js, "urls", NULL),
44  ""};
45 }
46 
51 {
52  json_object *js = json_object_new_object();
53 
54  json_object_object_add(js, "position", VuoPoint2d_getJson(value.position));
55 
56  if (value.urls)
57  json_object_object_add(js, "urls", VuoList_VuoUrl_getJson(value.urls));
58 
59  return js;
60 }
61 
66 {
67  char *listSummary = VuoList_VuoUrl_getSummary(value.urls);
68  char *summary = VuoText_format("%g,%g<br>%s", value.position.x, value.position.y, listSummary);
69  free(listSummary);
70  return summary;
71 }
72 
76 VuoDragEvent VuoDragEvent_make(const VuoPoint2d position, const VuoList_VuoUrl urls)
77 {
78  return (VuoDragEvent){position, urls, ""};
79 }
80 
87 bool VuoDragEvent_areEqual(const VuoDragEvent value1, const VuoDragEvent value2)
88 {
89  if (!VuoPoint2d_areEqual(value1.position, value2.position))
90  return false;
91 
92  if (!VuoList_VuoUrl_areEqual(value1.urls, value2.urls))
93  return false;
94 
95  return true;
96 }
97 
102 {
103  VuoType_returnInequality(VuoPoint2d, a.position, b.position);
104  VuoType_returnInequality(VuoList_VuoUrl, a.urls, b.urls);
105  return false;
106 }