/* * Menu Check * ---------- * Demonstrates the creation of a menubar, menus and menu items. * Each menu item can have a mark placed next to it using the * check function, or removed from next to it using the uncheck * function, just like checkboxes or radio buttons. */ #include #define NUM_COLOURS 5 char *colour_name[NUM_COLOURS] = { "White", "Black", "Red", "Green", "Blue" }; rgb colour[NUM_COLOURS] = { White, Black, Red, Green, Blue }; menuitem item[NUM_COLOURS]; rgb which_colour; window w; void draw_window(window w, rect r) { drawto(w); setcolour(which_colour); fillrect(r); } void change_colour(menuitem m) { int i; int value; value = getvalue(m); /* uncheck all items in the menu */ for (i=0; i