Using Menus (cont)

int main(int argc, char *argv[])
{
  App *app;
  MenuBar *mb;
  Menu *m;
  int i;

  app = new_app(argc, argv);
  w = new_window(app, rect(100,100,500,400),
                "Try the Menu", STANDARD_WINDOW);
  on_window_redraw(w, draw_window);

  mb = new_menu_bar(w);

  m = new_menu(mb, "File");
  new_menu_item(m, "Quit",  'Q', quit);

  m = new_menu(mb, "Colour");
  for (i=0; i < NUM_COLOURS; i++) {
    item[i] = new_menu_item(m, colour_name[i],  0, change_colour);
    set_menu_item_value(item[i], i);
  }

  change_colour(item[NUM_COLOURS-1]);

  show_window(w);
  main_loop(app);
  return 0;
}

Notes: