Vuo 2.4.2
Loading...
Searching...
No Matches
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
25extern "C"
26{
27#endif
28
32typedef enum
33{
34 VuoScreenType_Active,
35 VuoScreenType_Primary,
36 VuoScreenType_Secondary,
37 VuoScreenType_MatchId,
38 VuoScreenType_MatchName
40
44typedef struct
45{
46 VuoScreenType type;
50
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
63struct json_object * VuoScreen_getJson(const VuoScreen value);
64char *VuoScreen_getSummary(const VuoScreen value);
65
66#define VuoScreen_SUPPORTS_COMPARISON
67bool VuoScreen_areEqual(VuoScreen value1, VuoScreen value2);
68bool VuoScreen_isLessThan(const VuoScreen a, const VuoScreen b);
69
70bool VuoScreen_realize(VuoScreen screen, VuoScreen *realizedScreen);
71
76char * VuoScreen_getString(const VuoScreen value);
80
84static inline VuoScreen VuoScreen_makeFromName(VuoText name) __attribute__((const));
86{
87 VuoScreen s = {VuoScreenType_MatchName,-1,-1,name,false,{0,0},0,0,0,0};
88 return s;
89}
90
94static inline const char * VuoScreen_cStringForType(VuoScreenType type)
95{
96 switch (type)
97 {
98 case VuoScreenType_Active:
99 return "active";
100 case VuoScreenType_Primary:
101 return "primary";
102 case VuoScreenType_Secondary:
103 return "secondary";
104 case VuoScreenType_MatchId:
105 return "match-id";
106 case VuoScreenType_MatchName:
107 return "match-name";
108 // -Wunreachable-code doesn't like it if we cover all possible enum values *and* specify a default.
109 //default:
110 // return "primary";
111 }
112}
113
117static inline VuoScreenType VuoScreen_typeFromCString(const char *typeString)
118{
119 if (strcmp(typeString,"active")==0)
120 return VuoScreenType_Active;
121 else if (strcmp(typeString,"primary")==0)
122 return VuoScreenType_Primary;
123 else if (strcmp(typeString,"secondary")==0)
124 return VuoScreenType_Secondary;
125 else if (strcmp(typeString,"match-id")==0)
126 return VuoScreenType_MatchId;
127 else if (strcmp(typeString,"match-name")==0)
128 return VuoScreenType_MatchName;
129
130 return VuoScreenType_Active;
131}
132
133#ifdef __cplusplus
134}
135#endif
136