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);
47 static void display(Window *win)
49 fill_rect(win->get_absolute_rect(), 128, 128, 128);
52 static void keyboard(Window *win, int key, bool pressed)
60 static void button(Window *win, int bn, bool pressed, int x, int y)
62 printf("WINDOW(%p) button %d %s\n", (void*)win, bn, pressed ? "press" : "release");
65 static void motion(Window *win, int x, int y)
67 printf("WINDOW(%p) motion %d %d\n", (void*)win, x, y);