Checkboxes

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

void choose(Control *c)
{
  if (is_checked(c))
    printf("Oh, you want %s do you?\n", get_control_text(c));
  else
    printf("Don't want %s now, I see.\n", get_control_text(c));
}

void quit(Control *b)
{
  exit(0);
}

int main(int argc, char *argv[])
{
  App *app;
  Window *w;
  Control *c1, *c2;
  Control *b;

  app = new_app(argc, argv);
  w  = new_window(app, rect(0,0,200,150),
                  "Pizza", STANDARD_WINDOW);
  c1 = new_check_box(w, rect(10,10,160,25), "Ham", choose);
  c2 = new_check_box(w, rect(10,40,160,25), "Mushrooms", choose);
  b  = new_button(w, rect(10,80,80,30), "Quit", quit);
  show_window(w);
  main_loop(app);
  return 0;
}

Notes: