More Checkboxes

#include <stdio.h>
#include "graphapp.h"

Control *ham, *mushrooms, *olives, *capsicum;

void place_order(Control *b)
{
  printf("Toppings:\n");
  if (is_checked(ham))        printf("  Ham\n");
  if (is_checked(mushrooms))  printf("  Mushrooms\n");
  if (is_checked(olives))     printf("  Olives\n");
  if (is_checked(capsicum))   printf("  Capsicum\n");
  exit(0);
}

int main(int argc, char *argv[])
{
  App *app;
  Window *w;
  Rect r;

  app = new_app(argc, argv);
  w = new_window(app, rect(0,0,200,180), "Pizza", STANDARD_WINDOW);
  r = rect(10,10,100,25);

  ham       = new_check_box(w, r, "Ham", NULL);        r.y += 30;
  mushrooms = new_check_box(w, r, "Mushrooms", NULL);  r.y += 30;
  olives    = new_check_box(w, r, "Olives", NULL);     r.y += 30;
  capsicum  = new_check_box(w, r, "Capsicum", NULL);   r.y += 30;

  new_button(w, r, "Order Pizza", place_order);
  show_window(w);
  main_loop(app);
  return 0;
}

Notes: