Rev 4438 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4438 | Serge | 1 | #ifndef __WINLIB_H__ |
2 | #define __WINLIB_H__ |
||
3 | |||
4 | #include |
||
5 | |||
6 | #include "control.h" |
||
7 | |||
8 | #define CAPTION_HEIGHT 24 |
||
9 | #define PANEL_HEIGHT 55 |
||
10 | |||
11 | typedef struct |
||
12 | { |
||
13 | link_t link; |
||
14 | link_t child; |
||
15 | |||
16 | handler_t *handler; |
||
17 | ctrl_t *parent; |
||
18 | |||
19 | ctx_t *ctx; |
||
20 | uint32_t id; |
||
21 | uint32_t style; |
||
22 | |||
23 | rect_t rc; |
||
24 | int w; |
||
25 | int h; |
||
26 | |||
27 | rect_t left; /* left border */ |
||
28 | rect_t right; /* right border */ |
||
29 | rect_t bottom; /* bottom border */ |
||
30 | |||
31 | button_t *close_btn; |
||
32 | rect_t *track; |
||
33 | }frame_t; |
||
34 | |||
35 | typedef struct |
||
36 | { |
||
37 | ctrl_t ctrl; |
||
38 | ctx_t ctx; |
||
39 | char *text; |
||
40 | ctrl_t *child_over; |
||
41 | |||
42 | button_t *full_btn; |
||
43 | button_t *minimize_btn; |
||
44 | button_t *close_btn; |
||
45 | |||
46 | }caption_t; |
||
47 | |||
48 | typedef struct |
||
49 | { |
||
50 | ctrl_t ctrl; |
||
51 | ctx_t ctx; |
||
52 | rect_t draw; |
||
53 | ctrl_t *child_over; |
||
54 | int layout; |
||
55 | progress_t *prg; |
||
56 | level_t *lvl; |
||
57 | slider_t *sld; |
||
58 | button_t *play_btn; |
||
59 | button_t *stop_btn; |
||
60 | }panel_t; |
||
61 | |||
62 | enum win_state{ |
||
63 | NORMAL, MINIMIZED, ROLLED, MAXIMIZED, FULLSCREEN |
||
64 | }; |
||
65 | |||
66 | typedef struct |
||
67 | { |
||
68 | link_t link; |
||
69 | link_t child; |
||
70 | |||
71 | handler_t *handler; |
||
72 | ctrl_t *parent; |
||
73 | |||
5372 | serge | 74 | ctx_t ctx; |
4438 | Serge | 75 | uint32_t id; |
76 | uint32_t style; |
||
77 | |||
78 | rect_t rc; |
||
79 | int w; |
||
80 | int h; |
||
81 | |||
82 | rect_t saved; |
||
83 | rect_t client; |
||
84 | |||
85 | char *caption_txt; |
||
86 | ctrl_t *child_over; |
||
87 | ctrl_t *child_focus; |
||
88 | |||
89 | caption_t caption; |
||
90 | panel_t panel; |
||
91 | frame_t frame; |
||
92 | |||
93 | enum win_state win_state; |
||
94 | enum win_state saved_state; |
||
95 | |||
96 | enum win_command{ |
||
97 | WIN_CLOSED=1 |
||
98 | }win_command; |
||
99 | |||
100 | }window_t; |
||
101 | |||
102 | #define get_parent_window(x) ((window_t*)((x)->parent)) |
||
103 | |||
104 | ctrl_t *win_get_child(window_t *win, int x, int y); |
||
105 | |||
106 | void init_winlib(void); |
||
107 | |||
108 | void draw_caption(caption_t *cpt); |
||
109 | void draw_panel(panel_t *panel); |
||
110 | void blit_caption(caption_t *cpt); |
||
111 | int init_caption(window_t *win); |
||
112 | int init_panel(window_t *win); |
||
113 | |||
114 | |||
115 | |||
116 | window_t *create_window(char *caption, int style, int x, int y, |
||
117 | int w, int h, handler_t handler); |
||
118 | |||
119 | int show_window(window_t *win, int state); |
||
120 | |||
121 | int def_window_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2); |
||
122 | |||
123 | void frame_run(window_t *win); |
||
124 | |||
125 | button_t *create_button(char *caption, int id, int x, int y, |
||
126 | int w, int h, ctrl_t *parent); |
||
127 | progress_t *create_progress(char *caption, int id, int x, int y, |
||
128 | int w, int h, ctrl_t *parent); |
||
129 | level_t *create_level(char *caption, int id, int x, int y, |
||
130 | int w, int h, ctrl_t *parent); |
||
131 | scroller_t *create_scroller(uint32_t style, int id, int x, int y, |
||
132 | int w, int h, ctrl_t *parent); |
||
133 | slider_t *create_slider(char *caption, int id, int x, int y, |
||
134 | int w, int h, ctrl_t *parent); |
||
135 | |||
136 | |||
137 | //static uint32_t update_timers(uint32_t realtime); |
||
138 | |||
139 | int set_timer(ctrl_t *ctrl, ostimer_t *timer, uint32_t delay); |
||
140 | |||
141 | void update_rect(ctrl_t *ctrl); |
||
142 | |||
143 | |||
144 | #endif |