Beispiel #1
0
int main(int argc, char* argv[])
{
  glutInit(&argc, argv);

  GLUI *edit = GLUI_Master.create_glui("Help on GLUI Widgets", 0);
  main_window = edit->get_glut_window_id();
  GLUI_Panel *ep = new GLUI_Panel(edit,"",true);
  new GLUI_StaticText(ep,"Widget Information:");
  hah = new GLUI_List(ep,true,1,control_cb);
  hah->add_item(0,"GLUI 2.3");
  hah->add_item(1,"TextBox");
  hah->add_item(2,"Scrollbar");
  hah->add_item(3,"GLUI_String");
  hah->add_item(4,"CommandLine");
  hah->add_item(5,"Tree");
  hah->add_item(6,"List");
  hah->add_item(7,"FileBrowser");
  new GLUI_StaticText(ep,"Open Text File:");
  fb = new GLUI_FileBrowser(ep, "", false, 7, control_cb);
  fb->set_h(180);
  hah->set_h(180);
  new GLUI_Column(ep,false);

  moo = new GLUI_TextBox(ep,true,1,textbox_cb);
  moo->set_text(general);
  moo->set_h(400);
  moo->set_w(410);
  moo->disable();
  enable_textbox=0;
  new GLUI_Checkbox(ep, "Enable text box:",&enable_textbox,12,control_cb);

  tree = GLUI_Master.create_glui("Tree Test", 0);
  ep = new GLUI_Panel(tree, "Tree Controls");
  bedit = new GLUI_EditText(ep, "New Branch Name:");
  new GLUI_Checkbox(ep, "Display Numbers", &num_display);
  new GLUI_StaticText(ep, "Number format:");
  GLUI_RadioGroup *rg = new GLUI_RadioGroup(ep, &num_format);
  new GLUI_RadioButton(rg, "Level Only");
  new GLUI_RadioButton(rg, "Hierarchal");
  new GLUI_Button(ep, "Update Format", 11, control_cb);
  new GLUI_Column(ep);
  new GLUI_Button(ep, "Add Branch", 2, control_cb);
  new GLUI_Button(ep, "Del Branch", 3, control_cb);
  new GLUI_Button(ep, "Up Branch", 4, control_cb);
  new GLUI_Button(ep, "Goto Root", 5, control_cb);
  new GLUI_Column(ep);
  new GLUI_Button(ep, "Descend to Leaf", 6, control_cb);
  new GLUI_Button(ep, "Next Branch", 8, control_cb);
  new GLUI_Button(ep, "Expand All", 9, control_cb);
  new GLUI_Button(ep, "Collapse All", 10, control_cb);
  tp = new GLUI_TreePanel(tree,"Tree Test");
  tp->set_format(GLUI_TREEPANEL_ALTERNATE_COLOR |
                 GLUI_TREEPANEL_CONNECT_CHILDREN_ONLY |
                 GLUI_TREEPANEL_DISPLAY_HIERARCHY |
                 GLUI_TREEPANEL_HIERARCHY_NUMERICDOT);
  tp->set_level_color(1,1,1);
  tp->ab("foo you");
  tree->hide();

  edit->set_main_gfx_window(main_window);
  tree->set_main_gfx_window(main_window);

  glutMainLoop();
  return 0;
}