Rev 5372 | Go to most recent revision | Details | 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 | |||
70 | { |
||
71 | int *pixmap, *src; |
||
72 | int i, j; |
||
73 | |||
74 | |||
75 | |||
76 | |||
77 | |||
78 | |||
79 | pixmap+= CAPTION_HEIGHT*win->w; |
||
80 | src = res_border_left; |
||
81 | |||
82 | |||
83 | { |
||
84 | for(j = 0; j < FRAME_WIDTH; j++) |
||
85 | pixmap[j] = src[j]; |
||
86 | |||
87 | |||
88 | }; |
||
89 | |||
90 | |||
91 | |||
92 | pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH; |
||
93 | src = res_border_right; |
||
94 | |||
95 | |||
96 | { |
||
97 | for(j = 0; j < FRAME_WIDTH; j++) |
||
98 | pixmap[j] = src[j]; |
||
99 | |||
100 | |||
101 | }; |
||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | { |
||
109 | for(j = 0; j < win->w; j++) |
||
110 | pixmap[j] = 0x808080; |
||
111 | |||
112 | |||
113 | }; |
||
114 | |||
115 | |||
116 | child = (ctrl_t*)fr->child.next; |
||
117 | |||
118 | |||
119 | { |
||
120 | send_message(child, 1, 0, 0); |
||
121 | child = (ctrl_t*)child->link.next; |
||
122 | }; |
||
123 | |||
124 | |||
125 | }; |
||
126 | |||
127 | |||
128 | { |
||
129 | static pos_t spos; |
||
130 | static track_mode; |
||
131 | |||
132 | |||
133 | ctrl_t *child; |
||
134 | |||
135 | |||
136 | window_t *win = (window_t*)fr->parent; |
||
137 | rect_t *rc = NULL; |
||
138 | int x, y; |
||
139 | |||
140 | |||
141 | return 0; |
||
142 | |||
143 | |||
144 | y = ((pos_t)arg2).y; |
||
145 | |||
146 | |||
147 | |||
148 | // if(child) |
||
149 | // { |
||
150 | // return send_message(child, msg, 0, arg2); |
||
151 | // }; |
||
152 | |||
153 | |||
154 | (msg == MSG_MOUSEMOVE) ) |
||
155 | { |
||
156 | x = ((pos_t)arg2).x; |
||
157 | y = ((pos_t)arg2).y; |
||
158 | |||
159 | |||
160 | { |
||
161 | rc = &fr->left; |
||
162 | if( (y+24) > win->h) |
||
163 | cursor = cursor_nesw; |
||
164 | else |
||
165 | cursor = cursor_we; |
||
166 | set_cursor(cursor); |
||
167 | main_cursor = cursor; |
||
168 | } |
||
169 | else if( pt_in_rect(&fr->right, x, y)) |
||
170 | { |
||
171 | // printf("pos x%d y%d\n", x, y); |
||
172 | |||
173 | |||
174 | if( (y+24) > win->h) |
||
175 | cursor = cursor_nwse; |
||
176 | else |
||
177 | cursor = cursor_we; |
||
178 | // printf("Set cursor %x\n", cursor); |
||
179 | set_cursor(cursor); |
||
180 | main_cursor = cursor; |
||
181 | } |
||
182 | else if( pt_in_rect(&fr->bottom, x, y)) |
||
183 | { |
||
184 | rc = &fr->bottom; |
||
185 | cursor = cursor_ns; |
||
186 | if(x+24 > win->w) |
||
187 | cursor = cursor_nwse; |
||
188 | else if(x < rc->l+24) |
||
189 | cursor = cursor_nesw; |
||
190 | set_cursor(cursor); |
||
191 | main_cursor = cursor; |
||
192 | } |
||
193 | }; |
||
194 | |||
195 | |||
196 | { |
||
197 | case MSG_LBTNDOWN: |
||
198 | if( rc != NULL) |
||
199 | { |
||
200 | int relx, rely; |
||
201 | |||
202 | |||
203 | spos = get_cursor_pos(); |
||
204 | fr->track = rc; |
||
205 | |||
206 | |||
207 | rely = spos.y - win->rc.t; |
||
208 | // printf("relx %d rely %d\n", relx, rely); |
||
209 | |||
210 | |||
211 | fr->track == &fr->right) |
||
212 | { |
||
213 | if(rely+24 > win->h) |
||
214 | track_mode = 1; |
||
215 | }; |
||
216 | if(fr->track == &fr->bottom) |
||
217 | { |
||
218 | if(relx < 24) |
||
219 | track_mode = 2; |
||
220 | else if(relx+24 > win->w) |
||
221 | track_mode = 3; |
||
222 | } |
||
223 | |||
224 | |||
225 | }; |
||
226 | |||
227 | |||
228 | release_mouse(); |
||
229 | fr->track = NULL; |
||
230 | track_mode = 0; |
||
231 | break; |
||
232 | |||
233 | |||
234 | if(mouse_capture == ctrl) |
||
235 | { |
||
236 | pos_t npos; |
||
237 | npos = get_cursor_pos(); |
||
238 | // printf("cursor pos %dx%d\n", npos.x, npos.y); |
||
239 | |||
240 | |||
241 | { |
||
242 | int w, h; |
||
243 | |||
244 | |||
245 | spos = npos; |
||
246 | |||
247 | |||
248 | { |
||
249 | nrc.l = npos.x-2; |
||
250 | if(nrc.l < 0) |
||
251 | nrc.l = 0; |
||
252 | if(track_mode==1) |
||
253 | nrc.b = npos.y+2; |
||
254 | } |
||
255 | else if(fr->track == &fr->right) |
||
256 | { |
||
257 | nrc.r = npos.x+2; |
||
258 | if(track_mode==1) |
||
259 | nrc.b = npos.y+2; |
||
260 | } |
||
261 | else if(fr->track == &fr->bottom) |
||
262 | { |
||
263 | nrc.b = npos.y+2; |
||
264 | if(track_mode==2) |
||
265 | nrc.l = npos.x-2; |
||
266 | else if (track_mode==3) |
||
267 | nrc.r = npos.x+2; |
||
268 | }; |
||
269 | |||
270 | |||
271 | h = nrc.b - nrc.t; |
||
272 | |||
273 | |||
274 | w = 310; |
||
275 | if(h < 120) |
||
276 | h = 120; |
||
277 | |||
278 | |||
279 | "int $0x40" |
||
280 | ::"a"(67), "b"(nrc.l), "c"(nrc.t), |
||
281 | "d"(w-1),"S"(h-1) ); |
||
282 | }; |
||
283 | } |
||
284 | }; |
||
285 | |||
286 | |||
287 | }>310) |
||
288 | >>>>>>>>>> |
||
289 |