void createUI(NVGcontext *vg, float w, float h) { int col; uiClear(); { int root = uiItem(); // position root element uiSetLayout(root,UI_LEFT|UI_TOP); uiSetMargins(root,50,50,0,0); uiSetSize(root,250,400); } col = column(0); uiSetLayout(col, UI_TOP|UI_HFILL); button(col, __LINE__, BND_ICONID(6,3), "Item 1", demohandler); button(col, __LINE__, BND_ICONID(6,3), "Item 2", demohandler); { int h = hgroup(col); radio(h, __LINE__, BND_ICONID(6,3), "Item 3.0", &enum1); radio(h, __LINE__, BND_ICONID(0,10), NULL, &enum1); radio(h, __LINE__, BND_ICONID(1,10), NULL, &enum1); radio(h, __LINE__, BND_ICONID(6,3), "Item 3.3", &enum1); } { int colr; int rows = row(col); int coll = vgroup(rows); label(coll, -1, "Items 4.0:"); coll = vgroup(coll); button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.0", demohandler); button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.1", demohandler); colr = vgroup(rows); uiSetFrozen(colr, option1); label(colr, -1, "Items 4.1:"); colr = vgroup(colr); slider(colr, __LINE__, "Item 4.1.0", &progress1); slider(colr,__LINE__, "Item 4.1.1", &progress2); } button(col, __LINE__, BND_ICONID(6,3), "Item 5", NULL); check(col, __LINE__, "Frozen", &option1); check(col, __LINE__, "Item 7", &option2); check(col, __LINE__, "Item 8", &option3); textbox(col, (UIhandle)textbuffer, textbuffer, 32); uiLayout(); }
void build_democontent(int parent) { // some persistent variables for demonstration static float progress1 = 0.25f; static float progress2 = 0.75f; static int option1 = 1; static int option2 = 0; static int option3 = 0; int col = column(); uiInsert(parent, col); uiSetMargins(col, 10, 10, 10, 10); uiSetLayout(col, UI_TOP|UI_HFILL); column_append(col, button(BND_ICON_GHOST, "Item 1", demohandler)); if (option3) column_append(col, button(BND_ICON_GHOST, "Item 2", demohandler)); { int h = column_append(col, hbox()); hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.0", &enum1)); if (option2) uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_REC, NULL, &enum1)), -1,0,0,0); uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_PLAY, NULL, &enum1)), -1,0,0,0); uiSetMargins(hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.3", &enum1)), -1,0,0,0); } { int rows = column_append(col, row()); int coll = row_append(rows, vgroup()); vgroup_append(coll, label(-1, "Items 4.0:")); coll = vgroup_append(coll, vbox()); vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.0", demohandler)); uiSetMargins(vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.1", demohandler)),0,-2,0,0); int colr = row_append(rows, vgroup()); uiSetMargins(colr, 8, 0, 0, 0); uiSetFrozen(colr, option1); vgroup_append(colr, label(-1, "Items 4.1:")); colr = vgroup_append(colr, vbox()); vgroup_append(colr, slider("Item 4.1.0", &progress1)); uiSetMargins(vgroup_append(colr, slider("Item 4.1.1", &progress2)),0,-2,0,0); } column_append(col, button(BND_ICON_GHOST, "Item 5", NULL)); static char textbuffer[1024] = "The quick brown fox."; column_append(col, textbox(textbuffer, 1024)); column_append(col, check("Frozen", &option1)); column_append(col, check("Item 7", &option2)); column_append(col, check("Item 8", &option3)); }
variable(const std::string& vg) : model() { vgroup(vg); }