Vuo  2.3.2
VuoScreen.h
Go to the documentation of this file.
1 
10 #pragma once
11 
20 #include "VuoInteger.h"
21 #include "VuoPoint2d.h"
22 #include "VuoText.h"
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
32 typedef enum
33 {
34  VuoScreenType_Active,
35  VuoScreenType_Primary,
36  VuoScreenType_Secondary,
37  VuoScreenType_MatchId,
38  VuoScreenType_MatchName
40 
44 typedef struct
45 {
46  VuoScreenType type;
50 
51  bool isRealized;
52 
53  VuoPoint2d topLeft; // In points (not pixels).
54 
55  VuoInteger width; // In points (not pixels).
56  VuoInteger height;
57 
58  VuoInteger dpiHorizontal; // Pixels per inch horizontally — e.g., 72 for typical displays, 144 for retina
59  VuoInteger dpiVertical;
60 } VuoScreen;
61 
63 struct json_object * VuoScreen_getJson(const VuoScreen value);
64 char *VuoScreen_getSummary(const VuoScreen value);
65 
66 #define VuoScreen_SUPPORTS_COMPARISON
67 bool VuoScreen_areEqual(VuoScreen value1, VuoScreen value2);
68 bool VuoScreen_isLessThan(const VuoScreen a, const VuoScreen b);
69 
70 bool VuoScreen_realize(VuoScreen screen, VuoScreen *realizedScreen);
71 
77 char * VuoScreen_getString(const VuoScreen value);
81 
85 static inline VuoScreen VuoScreen_makeFromName(VuoText name) __attribute__((const));
87 {
88  VuoScreen s = {VuoScreenType_MatchName,-1,-1,name,false,{0,0},0,0,0,0};
89  return s;
90 }
91 
95 static inline const char * VuoScreen_cStringForType(VuoScreenType type)
96 {
97  switch (type)
98  {
99  case VuoScreenType_Active:
100  return "active";
101  case VuoScreenType_Primary:
102  return "primary";
103  case VuoScreenType_Secondary:
104  return "secondary";
105  case VuoScreenType_MatchId:
106  return "match-id";
107  case VuoScreenType_MatchName:
108  return "match-name";
109  // -Wunreachable-code doesn't like it if we cover all possible enum values *and* specify a default.
110  //default:
111  // return "primary";
112  }
113 }
114 
118 static inline VuoScreenType VuoScreen_typeFromCString(const char *typeString)
119 {
120  if (strcmp(typeString,"active")==0)
121  return VuoScreenType_Active;
122  else if (strcmp(typeString,"primary")==0)
123  return VuoScreenType_Primary;
124  else if (strcmp(typeString,"secondary")==0)
125  return VuoScreenType_Secondary;
126  else if (strcmp(typeString,"match-id")==0)
127  return VuoScreenType_MatchId;
128  else if (strcmp(typeString,"match-name")==0)
129  return VuoScreenType_MatchName;
130 
131  return VuoScreenType_Active;
132 }
133 
134 #ifdef __cplusplus
135 }
136 #endif
137