Vuo  2.0.0
VuoInputEditorNamedEnum.cc
Go to the documentation of this file.
1 
10 
11 extern "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  json_object_object_foreach(menuItemsValue, key, val)
28  {
29  if (strcmp(json_object_get_string(val), "-") == 0)
30  {
31  optionsTree->addSeparator();
32  continue;
33  }
34 
35  long intkey = (int)strtol(key, (char **)NULL, 10);
36  int intkeyResult = (intkey==0 ? errno : 0);
37  bool enabled = true;
38 
39  if (intkeyResult == EINVAL)
40  enabled = false;
41 
43  VuoInteger_getJson(intkey),
44  NULL,
45  enabled);
46  optionsTree->addItem(optionItem);
47  }
48 
49  return optionsTree;
50 }