Vuo 2.4.4
Loading...
Searching...
No Matches
VuoInputEditorNamedEnum.cc
Go to the documentation of this file.
1
10
11extern "C"
12{
13 #include "VuoInteger.h"
14 #include "VuoText.h"
15}
16
21{
22 VuoInputEditorMenuItem *optionsTree = new VuoInputEditorMenuItem("root");
23
24 json_object *menuItemsValue = NULL;
25 json_object_object_get_ex(details, "menuItems", &menuItemsValue);
26
27 int len = json_object_array_length(menuItemsValue);
28 for (int i = 0; i < len; ++i)
29 {
30 json_object *menuItem = json_object_array_get_idx(menuItemsValue, i);
31 if (json_object_is_type(menuItem, json_type_object))
32 {
33 json_object *value;
34 json_object_object_get_ex(menuItem, "value", &value);
35 json_object *name;
36 json_object_object_get_ex(menuItem, "name", &name);
37
38 optionsTree->addItem(new VuoInputEditorMenuItem(json_object_get_string(name), value, NULL, true));
39 }
40 else if (json_object_is_type(menuItem, json_type_string))
41 {
42 if (strcmp(json_object_get_string(menuItem), "---") == 0)
43 optionsTree->addSeparator();
44 else
45 optionsTree->addItem(new VuoInputEditorMenuItem(json_object_get_string(menuItem), 0, NULL, false));
46 }
47 }
48
49 return optionsTree;
50}