axle OS
x86_32 UNIX-like hobby OS
window.h
1 #ifndef WINDOW_H
2 #define WINDOW_H
3 
4 #include <std/std_base.h>
5 #include <stdint.h>
6 #include "gfx.h"
7 #include "rect.h"
8 #include "ca_layer.h"
9 #include "color.h"
10 #include "view.h"
11 
12 __BEGIN_DECLS
13 
14 #define WINDOW_TITLE_VIEW_HEIGHT 25
15 
16 typedef struct window {
17  //common
18  Rect frame;
19  char needs_redraw;
20  ca_layer* layer;
21  struct window* superview;
22  array_m* subviews;
23 
24  Size size;
25  char* title;
26  struct view* title_view;
27  struct view* content_view;
28  Color border_color;
29  int border_width;
30  array_m* animations;
31  event_handler teardown_handler;
32  event_handler redraw_handler;
33 
34  uint32_t last_draw_timestamp;
35 } Window;
36 
37 Window* create_window(Rect frame);
38 bool draw_window(Window* window);
39 void window_teardown(Window* window);
40 
41 void add_subwindow(Window* window, Window* subwindow);
42 void remove_subwindow(Window* window, Window* subwindow);
43 
44 //add window to desktop hierarchy
45 void present_window(Window* window);
46 //remove window from desktop hierarchy
47 //should this also free window resources? What if window should be presented again later?
48 void kill_window(Window* window);
49 
50 void set_border_width(Window* window, int width);
51 
52 //is xserv displaying this window?
53 bool window_presented(Window* w);
54 
55 __END_DECLS
56 
57 #endif
Definition: color.h:7
Definition: size.h:4
Definition: rect.h:14
Definition: array_m.h:14
Definition: window.h:16
Definition: view.h:15