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