Resizing and Closing Windows

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

void resize_it(Window w)
{
  Rect r = get_window_area(w);
  printf("Resize event! New rectangle=(%d,%d,%d,%d)\n",
          r.x, r.y, r.width, r.height);
}

void redraw_it(Window w, Graphics *g)
{
  printf("Draw event!\n);
}

void close_it(window w)
{
  printf("Close event!\n");
  hide_window(w);
}

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

  app = new_app(argc, argv);
  w = newwindow(app, rect(0,0,200,150),
                "Watch stdout", STANDARD_WINDOW);
  on_window_resize(w, resize_it);
  on_window_redraw(w, redraw_it);
  on_window_close(w, close_it);
  show_window(w);
  main_loop(app);
  return 0;
}

Notes: