7 static void display(Window *win);
8 static void keyboard(Window *win, int key, bool pressed);
9 static void button(Window *win, int bn, bool pressed, int x, int y);
10 static void motion(Window *win, int x, int y);
11 static void cleanup();
21 Window *win1 = new Window;
22 win1->set_title("Clipping the win title");
24 win1->resize(200, 300);
25 win1->set_display_callback(display);
26 win1->set_keyboard_callback(keyboard);
27 win1->set_mouse_button_callback(button);
28 win1->set_mouse_motion_callback(motion);
30 Window *win2 = new Window;
31 win2->set_title("window 2");
33 win2->resize(200, 300);
34 win2->set_display_callback(display);
35 win2->set_keyboard_callback(keyboard);
36 win2->set_mouse_button_callback(button);
37 win2->set_mouse_motion_callback(motion);
43 if(!(bg.load("data/bg.ppm"))) {
44 fprintf(stderr, "failed to load pixmap\n");
47 wm->set_background(&bg);
54 static void display(Window *win)
56 fill_rect(win->get_absolute_rect(), 128, 128, 128);
59 static void keyboard(Window *win, int key, bool pressed)
67 static void button(Window *win, int bn, bool pressed, int x, int y)
69 printf("WINDOW(%p) button %d %s\n", (void*)win, bn, pressed ? "press" : "release");
72 static void motion(Window *win, int x, int y)
74 printf("WINDOW(%p) motion %d %d\n", (void*)win, x, y);