Rev 5372 | 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 | #define FRAME_WIDTH 7 |
||
8 | |||
9 | |||
10 | |||
11 | |||
12 | extern uint32_t cursor_we; |
||
13 | extern uint32_t cursor_nwse; |
||
14 | extern uint32_t cursor_nesw; |
||
15 | |||
16 | |||
17 | |||
18 | |||
19 | uint32_t arg1, uint32_t arg2); |
||
20 | |||
21 | |||
22 | { |
||
23 | frame_t *fr = &win->frame; |
||
24 | |||
25 | |||
26 | fr->left.t = win->client.t; |
||
27 | fr->left.r = FRAME_WIDTH; |
||
28 | fr->left.b = win->h-FRAME_WIDTH; |
||
29 | |||
30 | |||
31 | fr->right.t = win->client.t; |
||
32 | fr->right.r = win->w; |
||
33 | fr->right.b = win->h-FRAME_WIDTH; |
||
34 | |||
35 | |||
36 | fr->bottom.t = win->h - FRAME_WIDTH; |
||
37 | fr->bottom.r = win->w; |
||
38 | fr->bottom.b = win->h; |
||
39 | |||
40 | |||
41 | win->client.r = win->w - FRAME_WIDTH; |
||
42 | // win->client.b = win->h - FRAME_WIDTH; |
||
43 | // printf("Left: l:%d t:%d r:%d b:%d\n", |
||
44 | // fr->left.l,fr->left.t,fr->left.r,fr->left.b); |
||
45 | // printf("Left: l:%d t:%d r:%d b:%d\n", |
||
46 | // fr->right.l,fr->right.t,fr->right.r,fr->right.b); |
||
47 | // printf("Left: l:%d t:%d r:%d b:%d\n", |
||
48 | // fr->bottom.l,fr->bottom.t,fr->bottom.r,fr->bottom.b); |
||
49 | |||
50 | |||
51 | |||
52 | |||
53 | { |
||
54 | frame_t *fr = &win->frame; |
||
55 | |||
56 | |||
57 | list_initialize(&fr->child); |
||
58 | |||
59 | |||
60 | fr->parent = (ctrl_t*)win; |
||
61 | |||
62 | |||
63 | }; |
||
64 | |||
65 | |||
66 | |||
67 | extern int res_border_right[]; |
||
68 | |||
69 | |||
5372 | serge | 70 | int draw_frame(window_t *win) |
4438 | Serge | 71 | { |
72 | void *pixmap_data; |
||
5372 | serge | 73 | uint32_t pixmap_pitch; |
74 | |||
75 | |||
4438 | Serge | 76 | int i, j; |
77 | |||
78 | |||
79 | |||
80 | |||
81 | |||
82 | |||
83 | pixmap+= CAPTION_HEIGHT*win->w; |
||
84 | src = res_border_left; |
||
85 | |||
86 | |||
87 | { |
||
88 | for(j = 0; j < FRAME_WIDTH; j++) |
||
89 | pixmap[j] = src[j]; |
||
90 | |||
91 | |||
92 | }; |
||
93 | |||
94 | |||
95 | |||
96 | pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH; |
||
97 | src = res_border_right; |
||
98 | |||
99 | |||
100 | { |
||
101 | for(j = 0; j < FRAME_WIDTH; j++) |
||
102 | pixmap[j] = src[j]; |
||
103 | |||
104 | |||
105 | }; |
||
106 | |||
107 | |||
108 | |||
109 | |||
110 | |||
111 | |||
112 | { |
||
113 | for(j = 0; j < win->w; j++) |
||
114 | pixmap[j] = 0x808080; |
||
115 | |||
116 | |||
117 | }; |
||
118 | |||
119 | |||
120 | child = (ctrl_t*)fr->child.next; |
||
121 | |||
122 | |||
123 | { |
||
124 | send_message(child, 1, 0, 0); |
||
125 | child = (ctrl_t*)child->link.next; |
||
126 | }; |
||
127 | |||
128 | |||
129 | }; |
||
130 | #endif |
||
5372 | serge | 131 | |
4438 | Serge | 132 | |
5372 | serge | 133 | |
4438 | Serge | 134 | { |
135 | static pos_t spos; |
||
136 | static int track_mode; |
||
6658 | serge | 137 | |
4438 | Serge | 138 | |
139 | ctrl_t *child; |
||
140 | |||
141 | |||
142 | window_t *win = (window_t*)fr->parent; |
||
143 | rect_t *rc = NULL; |
||
144 | int x, y; |
||
145 | |||
146 | |||
147 | return 0; |
||
148 | |||
5061 | serge | 149 | |
4438 | Serge | 150 | y = ((pos_t)arg2).y; |
151 | |||
152 | |||
153 | |||
154 | // if(child) |
||
155 | // { |
||
156 | // return send_message(child, msg, 0, arg2); |
||
157 | // }; |
||
158 | |||
159 | |||
160 | (msg == MSG_MOUSEMOVE) ) |
||
161 | { |
||
162 | x = ((pos_t)arg2).x; |
||
163 | y = ((pos_t)arg2).y; |
||
164 | |||
165 | |||
166 | { |
||
167 | rc = &fr->left; |
||
168 | if( (y+24) > win->h) |
||
169 | cursor = cursor_nesw; |
||
170 | else |
||
171 | cursor = cursor_we; |
||
172 | set_cursor(cursor); |
||
173 | main_cursor = cursor; |
||
174 | } |
||
175 | else if( pt_in_rect(&fr->right, x, y)) |
||
176 | { |
||
177 | // printf("pos x%d y%d\n", x, y); |
||
178 | |||
179 | |||
180 | if( (y+24) > win->h) |
||
181 | cursor = cursor_nwse; |
||
182 | else |
||
183 | cursor = cursor_we; |
||
184 | // printf("Set cursor %x\n", cursor); |
||
185 | set_cursor(cursor); |
||
186 | main_cursor = cursor; |
||
187 | } |
||
188 | else if( pt_in_rect(&fr->bottom, x, y)) |
||
189 | { |
||
190 | rc = &fr->bottom; |
||
191 | cursor = cursor_ns; |
||
192 | if(x+24 > win->w) |
||
193 | cursor = cursor_nwse; |
||
194 | else if(x < rc->l+24) |
||
195 | cursor = cursor_nesw; |
||
196 | set_cursor(cursor); |
||
197 | main_cursor = cursor; |
||
198 | } |
||
199 | }; |
||
200 | |||
201 | |||
202 | { |
||
203 | case MSG_LBTNDOWN: |
||
204 | if( rc != NULL) |
||
205 | { |
||
206 | int relx, rely; |
||
207 | |||
208 | |||
209 | spos = GetMousePos(POS_SCREEN); |
||
5061 | serge | 210 | fr->track = rc; |
4438 | Serge | 211 | |
212 | |||
213 | rely = spos.y - win->rc.t; |
||
214 | // printf("relx %d rely %d\n", relx, rely); |
||
215 | |||
216 | |||
217 | fr->track == &fr->right) |
||
218 | { |
||
219 | if(rely+24 > win->h) |
||
220 | track_mode = 1; |
||
221 | }; |
||
222 | if(fr->track == &fr->bottom) |
||
223 | { |
||
224 | if(relx < 24) |
||
225 | track_mode = 2; |
||
226 | else if(relx+24 > win->w) |
||
227 | track_mode = 3; |
||
228 | } |
||
229 | |||
230 | |||
231 | }; |
||
232 | |||
233 | |||
234 | release_mouse(); |
||
235 | fr->track = NULL; |
||
236 | track_mode = 0; |
||
237 | break; |
||
238 | |||
239 | |||
240 | if(mouse_capture == ctrl) |
||
241 | { |
||
242 | pos_t npos; |
||
243 | npos = GetMousePos(POS_SCREEN); |
||
5061 | serge | 244 | // printf("cursor pos %dx%d\n", npos.x, npos.y); |
4438 | Serge | 245 | |
246 | |||
247 | { |
||
248 | int w, h; |
||
249 | |||
250 | |||
251 | spos = npos; |
||
252 | |||
253 | |||
254 | { |
||
255 | nrc.l = npos.x-2; |
||
256 | if(nrc.l < 0) |
||
257 | nrc.l = 0; |
||
258 | if(track_mode==1) |
||
259 | nrc.b = npos.y+2; |
||
260 | } |
||
261 | else if(fr->track == &fr->right) |
||
262 | { |
||
263 | nrc.r = npos.x+2; |
||
264 | if(track_mode==1) |
||
265 | nrc.b = npos.y+2; |
||
266 | } |
||
267 | else if(fr->track == &fr->bottom) |
||
268 | { |
||
269 | nrc.b = npos.y+2; |
||
270 | if(track_mode==2) |
||
271 | nrc.l = npos.x-2; |
||
272 | else if (track_mode==3) |
||
273 | nrc.r = npos.x+2; |
||
274 | }; |
||
275 | |||
276 | |||
277 | h = nrc.b - nrc.t; |
||
278 | |||
279 | |||
280 | w = 310; |
||
281 | if(h < 120) |
||
282 | h = 120; |
||
283 | |||
284 | |||
285 | "int $0x40" |
||
286 | ::"a"(67), "b"(nrc.l), "c"(nrc.t), |
||
287 | "d"(w-1),"S"(h-1) ); |
||
288 | }; |
||
289 | } |
||
290 | }; |
||
291 | |||
292 | |||
293 | }>310) |
||
294 | >>>>>>>>>> |
||
295 |