Rev 2693 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2693 | Rev 3068 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #include |
3 | #include |
4 | #include |
4 | #include |
5 | #include "winlib.h" |
5 | #include "winlib.h" |
6 | 6 | ||
Line 7... | Line -... | ||
7 | #define CAPTION_HEIGHT 24 |
- | |
8 | #define CAPTION_CORNER_W 8 |
7 | #define CAPTION_CORNER_W 8 |
Line 9... | Line 8... | ||
9 | 8 | ||
10 | extern int res_caption_left[]; |
9 | extern int res_caption_left[]; |
11 | extern int res_caption_right[]; |
10 | extern int res_caption_right[]; |
Line 18... | Line 17... | ||
18 | extern int res_minimize_btn[]; |
17 | extern int res_minimize_btn[]; |
19 | extern int res_minimize_btn_hl[]; |
18 | extern int res_minimize_btn_hl[]; |
20 | extern int res_minimize_btn_pressed[]; |
19 | extern int res_minimize_btn_pressed[]; |
Line -... | Line 20... | ||
- | 20 | ||
- | 21 | extern uint32_t main_cursor; |
|
21 | 22 | ||
Line 22... | Line 23... | ||
22 | void update_caption_size(window_t *win); |
23 | void update_caption_size(window_t *win); |
Line 36... | Line 37... | ||
36 | 37 | ||
Line 37... | Line 38... | ||
37 | cpt->ctrl.handler = caption_proc; |
38 | cpt->ctrl.handler = caption_proc; |
38 | cpt->ctrl.parent = (ctrl_t*)win; |
39 | cpt->ctrl.parent = (ctrl_t*)win; |
Line -... | Line 40... | ||
- | 40 | ||
- | 41 | cpt->text = win->caption_txt; |
|
39 | 42 | ||
40 | ctx->pixmap = user_alloc(1920*CAPTION_HEIGHT*4); |
43 | ctx->pixmap = user_alloc(1920*CAPTION_HEIGHT*4); |
41 | if(!ctx->pixmap) |
44 | if(!ctx->pixmap) |
42 | { |
45 | { |
43 | printf("not enough memory for caption bitmap\n"); |
46 | printf("not enough memory for caption bitmap\n"); |
Line 100... | Line 103... | ||
100 | cpt->ctrl.w = win->w; |
103 | cpt->ctrl.w = win->w; |
101 | cpt->ctrl.h = CAPTION_HEIGHT; |
104 | cpt->ctrl.h = CAPTION_HEIGHT; |
102 | win->client.t = CAPTION_HEIGHT; |
105 | win->client.t = CAPTION_HEIGHT; |
103 | 106 | ||
Line 104... | Line 107... | ||
104 | cpt->close_btn->rc.l = win->w - 25; |
107 | cpt->close_btn->ctrl.rc.l = win->w - 25; |
105 | cpt->close_btn->rc.r = cpt->close_btn->rc.l + |
108 | cpt->close_btn->ctrl.rc.r = cpt->close_btn->ctrl.rc.l + |
106 | cpt->close_btn->w; |
109 | cpt->close_btn->ctrl.w; |
107 | 110 | ||
108 | cpt->minimize_btn->rc.l = win->w - 25 - 16 - 5; |
111 | cpt->minimize_btn->ctrl.rc.l = win->w - 25 - 16 - 5; |
109 | cpt->minimize_btn->rc.r = cpt->minimize_btn->rc.l + |
112 | cpt->minimize_btn->ctrl.rc.r = cpt->minimize_btn->ctrl.rc.l + |
110 | cpt->minimize_btn->w; |
113 | cpt->minimize_btn->ctrl.w; |
Line 111... | Line 114... | ||
111 | 114 | ||
Line -... | Line 115... | ||
- | 115 | }; |
|
- | 116 | ||
- | 117 | typedef struct |
|
- | 118 | { |
|
- | 119 | uint32_t width; |
|
- | 120 | uint32_t height; |
|
- | 121 | uint32_t pitch; |
|
- | 122 | uint32_t handle; |
|
- | 123 | uint8_t *data; |
|
- | 124 | }bitmap_t; |
|
Line 112... | Line 125... | ||
112 | }; |
125 | |
113 | 126 | extern int win_font; |
|
114 | 127 | ||
115 | void draw_caption(caption_t *cpt) |
128 | void draw_caption(caption_t *cpt) |
Line 155... | Line 168... | ||
155 | pixmap+= cpt->ctx.stride/4; |
168 | pixmap+= cpt->ctx.stride/4; |
156 | src+= CAPTION_CORNER_W; |
169 | src+= CAPTION_CORNER_W; |
157 | }; |
170 | }; |
158 | 171 | ||
Line -... | Line 172... | ||
- | 172 | bitmap_t bitmap; |
|
- | 173 | ||
- | 174 | bitmap.data = cpt->ctx.pixmap; |
|
- | 175 | bitmap.pitch = cpt->ctx.stride; |
|
- | 176 | ||
- | 177 | draw_text(&bitmap, win_font, cpt->text, 8, 18, 0xFFFFFFFF); |
|
- | 178 | ||
159 | ctrl_t *child; |
179 | ctrl_t *child; |
160 | child = (ctrl_t*)cpt->ctrl.child.next; |
180 | child = (ctrl_t*)cpt->ctrl.child.next; |
Line 161... | Line 181... | ||
161 | 181 | ||
162 | while( &child->link != &cpt->ctrl.child) |
182 | while( &child->link != &cpt->ctrl.child) |
Line 191... | Line 211... | ||
191 | if(child == win->child_over) |
211 | if(child == win->child_over) |
192 | send_message(child, msg, 0, arg2); |
212 | send_message(child, msg, 0, arg2); |
193 | else |
213 | else |
194 | send_message(win->child_over, MSG_MOUSELEAVE, 0, arg2); |
214 | send_message(win->child_over, MSG_MOUSELEAVE, 0, arg2); |
195 | } |
215 | }; |
196 | else if( child ) |
216 | |
197 | send_message(child, MSG_MOUSEENTER, 0, arg2); |
- | |
198 | - | ||
Line 199... | Line 217... | ||
199 | win->child_over = child; |
217 | win->child_over = child; |
200 | if( child ) |
218 | if( child ) |
- | 219 | { |
|
- | 220 | send_message(child, MSG_MOUSEENTER, 0, arg2); |
|
201 | send_message(child,msg,0,arg2); |
221 | send_message(child,msg,0,arg2); |
- | 222 | } |
|
202 | // else if(main_cursor != 0) |
223 | else if(main_cursor != 0) |
203 | // { |
224 | { |
204 | // set_cursor(0); |
225 | set_cursor(0); |
205 | // main_cursor = 0; |
226 | main_cursor = 0; |
206 | // } |
227 | } |
207 | break; |
228 | break; |
Line 208... | Line 229... | ||
208 | 229 | ||
209 | 230 |