Rev 4438 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4438 | Serge | 1 | |
2 | #include |
||
3 | #include |
||
4 | #include "winlib.h" |
||
5 | |||
6 | |||
7 | |||
8 | |||
9 | extern int res_caption_right[]; |
||
10 | extern int res_caption_body[]; |
||
11 | |||
12 | |||
13 | extern int res_close_btn_hl[]; |
||
14 | extern int res_close_btn_pressed[]; |
||
15 | |||
16 | |||
17 | extern int res_minimize_btn_hl[]; |
||
18 | extern int res_minimize_btn_pressed[]; |
||
19 | |||
20 | |||
21 | extern int res_full_btn_hl[]; |
||
22 | extern int res_full_btn_pressed[]; |
||
23 | |||
24 | |||
25 | |||
26 | |||
27 | |||
28 | |||
29 | |||
30 | |||
31 | |||
32 | { |
||
33 | button_t *btn; |
||
34 | |||
35 | |||
36 | ctx_t *ctx = &cpt->ctx; |
||
37 | |||
38 | |||
39 | list_initialize(&cpt->ctrl.child); |
||
40 | |||
41 | |||
42 | cpt->ctrl.parent = (ctrl_t*)win; |
||
43 | |||
44 | |||
45 | |||
46 | |||
5372 | serge | 47 | ctx->pixmap_pitch= 1920*4; |
48 | ctx->offset_x = 0; |
||
4438 | Serge | 49 | ctx->offset_y = 0; |
50 | |||
51 | |||
52 | |||
53 | |||
54 | cpt->close_btn = btn; |
||
55 | |||
56 | |||
57 | btn->img_hilite = res_close_btn_hl; |
||
58 | btn->img_pressed = res_close_btn_pressed; |
||
59 | |||
60 | |||
61 | cpt->minimize_btn = btn; |
||
62 | |||
63 | |||
64 | btn->img_hilite = res_minimize_btn_hl; |
||
65 | btn->img_pressed = res_minimize_btn_pressed; |
||
66 | |||
67 | |||
68 | cpt->full_btn = btn; |
||
69 | |||
70 | |||
71 | btn->img_hilite = res_full_btn_hl; |
||
72 | btn->img_pressed = res_full_btn_pressed; |
||
73 | |||
74 | |||
75 | |||
76 | |||
77 | }; |
||
78 | |||
79 | |||
80 | |||
81 | { |
||
82 | caption_t *cpt = &win->caption; |
||
83 | ctx_t *ctx = &cpt->ctx; |
||
5372 | serge | 84 | |
4438 | Serge | 85 | |
5372 | serge | 86 | |
4438 | Serge | 87 | |
88 | cpt->ctrl.rc.t = 0; |
||
89 | cpt->ctrl.rc.r = win->w; |
||
90 | cpt->ctrl.rc.b = CAPTION_HEIGHT; |
||
91 | cpt->ctrl.w = win->w; |
||
92 | cpt->ctrl.h = CAPTION_HEIGHT; |
||
93 | win->client.t = CAPTION_HEIGHT; |
||
94 | |||
95 | |||
96 | cpt->close_btn->ctrl.rc.r = cpt->close_btn->ctrl.rc.l + |
||
97 | cpt->close_btn->ctrl.w; |
||
98 | |||
99 | |||
100 | cpt->minimize_btn->ctrl.rc.r = cpt->minimize_btn->ctrl.rc.l + |
||
101 | cpt->minimize_btn->ctrl.w; |
||
102 | |||
103 | |||
104 | cpt->full_btn->ctrl.rc.r = cpt->full_btn->ctrl.rc.l + |
||
105 | cpt->full_btn->ctrl.w; |
||
106 | }; |
||
107 | |||
108 | |||
109 | |||
110 | |||
111 | { |
||
112 | ctx_t *ctx = &cpt->ctx; |
||
5372 | serge | 113 | int *pixmap, *src; |
114 | rect_t rc; |
||
115 | int i, j, w; |
||
116 | |||
4438 | Serge | 117 | |
5372 | serge | 118 | CAPTION_CORNER_W, CAPTION_HEIGHT, CAPTION_CORNER_W*4); |
4438 | Serge | 119 | |
120 | |||
121 | if( w > 0) |
||
122 | { |
||
123 | pixmap = (int*)ctx->pixmap_data; |
||
5372 | serge | 124 | pixmap+= CAPTION_CORNER_W; |
4438 | Serge | 125 | src = res_caption_body; |
126 | |||
127 | |||
128 | { |
||
129 | for(j = 0; j < w; j++) |
||
130 | pixmap[j] = src[i]; |
||
131 | pixmap+= ctx->pixmap_pitch/4; |
||
5372 | serge | 132 | } |
4438 | Serge | 133 | }; |
134 | |||
135 | |||
5372 | serge | 136 | CAPTION_CORNER_W, CAPTION_HEIGHT,CAPTION_CORNER_W*4); |
4438 | Serge | 137 | |
138 | |||
139 | rc.t = 0; |
||
140 | rc.r = cpt->ctrl.w - 27 - 18 - 18 - 5 - 5 - 8; |
||
141 | rc.b = 18; |
||
142 | |||
143 | |||
5372 | serge | 144 | |
4438 | Serge | 145 | |
146 | child = (ctrl_t*)cpt->ctrl.child.next; |
||
147 | |||
148 | |||
149 | { |
||
150 | send_message(child, 1, 0, 0); |
||
151 | child = (ctrl_t*)child->link.next; |
||
152 | }; |
||
153 | }; |
||
154 | |||
155 | |||
156 | |||
157 | { |
||
158 | caption_t *cpt = (caption_t*)ctrl; |
||
159 | window_t *win = (window_t*)ctrl->parent; |
||
160 | |||
161 | |||
162 | int x, y; |
||
163 | |||
164 | |||
165 | y = ((pos_t)arg2).y; |
||
166 | |||
167 | |||
168 | { |
||
169 | case 1: |
||
170 | break; |
||
171 | |||
172 | |||
173 | |||
174 | child = get_child(ctrl, x, y); |
||
175 | if( win->child_over ) |
||
176 | { |
||
177 | if(child == win->child_over) |
||
178 | send_message(child, msg, 0, arg2); |
||
179 | else |
||
180 | send_message(win->child_over, MSG_MOUSELEAVE, 0, arg2); |
||
181 | }; |
||
182 | |||
183 | |||
184 | if( child ) |
||
185 | { |
||
186 | send_message(child, MSG_MOUSEENTER, 0, arg2); |
||
187 | send_message(child,msg,0,arg2); |
||
188 | } |
||
189 | else if(main_cursor != 0) |
||
190 | { |
||
191 | set_cursor(0); |
||
192 | main_cursor = 0; |
||
193 | } |
||
194 | break; |
||
195 | |||
196 | |||
197 | |||
198 | switch((short)arg1) |
||
199 | { |
||
200 | case ID_CLOSE: |
||
201 | win->win_command = WIN_CLOSED; |
||
202 | break; |
||
203 | |||
204 | |||
205 | __asm__ __volatile__( |
||
206 | "int $0x40" |
||
207 | ::"a"(18),"b"(10)); |
||
208 | win->win_state = MINIMIZED; |
||
209 | send_message((ctrl_t*)win, MSG_SIZE, 0, 0); |
||
210 | break; |
||
211 | case ID_FULLSCREEN: |
||
212 | { |
||
213 | int screensize; |
||
214 | |||
215 | |||
216 | win->saved_state = win->win_state; |
||
217 | screensize = GetScreenSize(); |
||
218 | __asm__ __volatile__( |
||
219 | "int $0x40" |
||
220 | ::"a"(67), "b"(0), "c"(0), |
||
221 | "d"((screensize >> 16)-1),"S"((screensize & 0xFFFF)-1) ); |
||
222 | win->win_state = FULLSCREEN; |
||
223 | window_update_layout(win); |
||
224 | }; |
||
225 | break; |
||
226 | |||
227 | |||
228 | break; |
||
229 | }; |
||
230 | |||
231 | |||
232 | child = get_child(ctrl, x, y); |
||
233 | if(child) |
||
234 | return send_message(child, msg, 0, arg2); |
||
235 | } |
||
236 | return 1; |
||
237 | }; |
||
238 | |||
239 | |||
240 | |||
241 | |||
242 | { |
||
243 | // printf("%s w:%d h:%d stride: %d\n",__FUNCTION__, |
||
244 | // cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride); |
||
245 | |||
246 | |||
247 | |||
5372 | serge | 248 | cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap_pitch); |
249 | };>> |
||
4438 | Serge | 250 |