*work in progress*
[winnie] / src / window.h
1 #ifndef WINDOW_H_
2 #define WINDOW_H_
3
4 #include "geom.h"
5 #include "event.h"
6
7 class Window {
8 private:
9         char *title;
10         Rect rect;
11         Callbacks callbacks;
12
13         bool dirty;
14
15 public:
16         Window();
17         ~Window();
18
19         const Rect &get_rect() const;
20         bool contains_point(int ptr_x, int ptr_y);
21
22         void move(int x, int y);
23         void resize(int x, int y);
24
25         void set_title(const char *s);
26         const char *get_title() const;
27
28         /* mark this window as dirty, and notify the window manager
29          * to repaint it, and anything it used to cover.
30          */
31         void invalidate();
32
33         void draw();
34
35         unsigned char *get_win_start_on_fb();
36         int get_scanline_width();
37
38         void set_display_callback(DisplayFuncType func);
39         void set_keyboard_callback(KeyboardFuncType func);
40         void set_mouse_button_callback(MouseButtonFuncType func);
41         void set_mouse_motion_callback(MouseMotionFuncType func);
42
43         const DisplayFuncType get_display_callback() const;
44         const KeyboardFuncType get_keyboard_callback() const;
45         const MouseButtonFuncType get_mouse_button_callback() const;
46         const MouseMotionFuncType get_mouse_motion_callback() const;
47
48         // XXX remove if not needed
49         friend class WindowManager;
50 };
51
52 #endif  // WINDOW_H_