0ba8a04506e3c77ab7d80ecd6c3b7ab79ccdfbc5
[winnie] / src / wm.h
1 #ifndef WM_H_
2 #define WM_H_
3
4 #include <list>
5
6 #include "geom.h"
7 #include "pixmap.h"
8
9 class Window;
10
11 bool init_window_manager();
12 void destroy_window_manager(); 
13
14 class WindowManager {
15 private:
16         std::list<Window*> windows;
17
18         std::list<Rect> dirty_rects;
19
20         int bg_color[3];
21         int frame_thickness;
22         int titlebar_thickness;
23         int frame_fcolor[3];
24         int frame_ucolor[3];
25
26         Window *root_win;
27         Window *focused_win;
28         Window *grab_win;
29
30         Pixmap mouse_cursor;
31         Pixmap *background;
32
33         void create_frame(Window *win);
34         void destroy_frame(Window *win);
35
36 public:
37         WindowManager();
38         ~WindowManager();
39
40         void invalidate_region(const Rect &rect);
41         void process_windows();
42
43         void add_window(Window *win);
44         void remove_window(Window *win);
45
46         void set_focused_window(Window *win);
47         const Window *get_focused_window() const;
48         Window *get_focused_window();
49
50         Window *get_window_at_pos(int pointer_x, int pointer_y);
51         Window *get_root_window() const;
52
53         void set_focused_frame_color(int r, int g, int b);
54         void get_focused_frame_color(int *r, int *g, int *b) const;
55
56         void set_unfocused_frame_color(int r, int g, int b);
57         void get_unfocused_frame_color(int *r, int *g, int *b) const;
58
59         void set_background(const Pixmap *pixmap);
60         const Pixmap *get_background() const;
61
62         Window *get_grab_window() const;
63
64         void grab_mouse(Window *win);
65         void release_mouse();
66
67         void raise_window(Window *win);
68         void sink_window(Window *win);
69
70         void maximize_window(Window *win);
71         void unmaximize_window(Window *win);
72 };
73
74 extern WindowManager *wm;
75
76 #endif  // WM_H_