187 switch (wi->type & WWT_MASK) { |
187 switch (wi->type & WWT_MASK) { |
188 case WWT_PANEL: /* WWT_IMGBTN */ |
188 case WWT_PANEL: /* WWT_IMGBTN */ |
189 case WWT_PANEL_2: { |
189 case WWT_PANEL_2: { |
190 int img; |
190 int img; |
191 |
191 |
192 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
192 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
193 |
193 |
194 if ((img = wi->unkA) != 0) { // has an image |
194 if ((img = wi->unkA) != 0) { // has an image |
195 if ((wi->type & WWT_MASK) == WWT_PANEL_2 && clicked) img++; // show diff image when clicked |
195 if ((wi->type & WWT_MASK) == WWT_PANEL_2 && clicked) img++; // show diff image when clicked |
196 |
196 |
197 DrawSprite(img, r.left + 1 + clicked, r.top + 1 + clicked); |
197 DrawSprite(img, r.left + 1 + clicked, r.top + 1 + clicked); |
277 |
277 |
278 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
278 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
279 |
279 |
280 // draw up/down buttons |
280 // draw up/down buttons |
281 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP); |
281 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP); |
282 DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? 0x20 : 0); |
282 DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : 0); |
283 DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); |
283 DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); |
284 |
284 |
285 clicked = !!(((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN)); |
285 clicked = !!(((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN)); |
286 DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
286 DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
287 DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); |
287 DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); |
288 |
288 |
289 c1 = _color_list[wi->color&0xF].window_color_1a; |
289 c1 = _color_list[wi->color&0xF].window_color_1a; |
290 c2 = _color_list[wi->color&0xF].window_color_2; |
290 c2 = _color_list[wi->color&0xF].window_color_2; |
291 |
291 |
298 GfxFillRect(r.left+3, r.top+10, r.left+3, r.bottom-10, c2); |
298 GfxFillRect(r.left+3, r.top+10, r.left+3, r.bottom-10, c2); |
299 GfxFillRect(r.left+7, r.top+10, r.left+7, r.bottom-10, c1); |
299 GfxFillRect(r.left+7, r.top+10, r.left+7, r.bottom-10, c1); |
300 GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2); |
300 GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2); |
301 |
301 |
302 pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom); |
302 pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom); |
303 DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? 0x20 : 0); |
303 DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? FR_LOWERED : 0); |
304 break; |
304 break; |
305 } |
305 } |
306 case WWT_SCROLL2BAR: { |
306 case WWT_SCROLL2BAR: { |
307 Point pt; |
307 Point pt; |
308 int c1,c2; |
308 int c1,c2; |
309 |
309 |
310 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
310 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
311 |
311 |
312 // draw up/down buttons |
312 // draw up/down buttons |
313 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2)); |
313 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2)); |
314 DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? 0x20 : 0); |
314 DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : 0); |
315 DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); |
315 DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); |
316 |
316 |
317 clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2)); |
317 clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2)); |
318 DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
318 DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
319 DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); |
319 DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); |
320 |
320 |
321 c1 = _color_list[wi->color&0xF].window_color_1a; |
321 c1 = _color_list[wi->color&0xF].window_color_1a; |
322 c2 = _color_list[wi->color&0xF].window_color_2; |
322 c2 = _color_list[wi->color&0xF].window_color_2; |
323 |
323 |
330 GfxFillRect(r.left+3, r.top+10, r.left+3, r.bottom-10, c2); |
330 GfxFillRect(r.left+3, r.top+10, r.left+3, r.bottom-10, c2); |
331 GfxFillRect(r.left+7, r.top+10, r.left+7, r.bottom-10, c1); |
331 GfxFillRect(r.left+7, r.top+10, r.left+7, r.bottom-10, c1); |
332 GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2); |
332 GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2); |
333 |
333 |
334 pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom); |
334 pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom); |
335 DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? 0x20 : 0); |
335 DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? FR_LOWERED : 0); |
336 break; |
336 break; |
337 } |
337 } |
338 |
338 |
339 // horizontal scrollbar |
339 // horizontal scrollbar |
340 case WWT_HSCROLLBAR: { |
340 case WWT_HSCROLLBAR: { |
342 int c1,c2; |
342 int c1,c2; |
343 |
343 |
344 assert(r.bottom - r.top == 11); // XXX - to ensure the same sizes are used everywhere! |
344 assert(r.bottom - r.top == 11); // XXX - to ensure the same sizes are used everywhere! |
345 |
345 |
346 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL)); |
346 clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL)); |
347 DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
347 DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
348 DrawSprite(SPR_ARROW_LEFT, r.left + 1 + clicked, r.top + 1 + clicked); |
348 DrawSprite(SPR_ARROW_LEFT, r.left + 1 + clicked, r.top + 1 + clicked); |
349 |
349 |
350 clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL)); |
350 clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL)); |
351 DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
351 DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
352 DrawSprite(SPR_ARROW_RIGHT, r.right - 8 + clicked, r.top + 1 + clicked); |
352 DrawSprite(SPR_ARROW_RIGHT, r.right - 8 + clicked, r.top + 1 + clicked); |
353 |
353 |
354 c1 = _color_list[wi->color&0xF].window_color_1a; |
354 c1 = _color_list[wi->color&0xF].window_color_1a; |
355 c2 = _color_list[wi->color&0xF].window_color_2; |
355 c2 = _color_list[wi->color&0xF].window_color_2; |
356 |
356 |
364 GfxFillRect(r.left+10, r.top+7, r.right-10, r.top+7, c1); |
364 GfxFillRect(r.left+10, r.top+7, r.right-10, r.top+7, c1); |
365 GfxFillRect(r.left+10, r.top+8, r.right-10, r.top+8, c2); |
365 GfxFillRect(r.left+10, r.top+8, r.right-10, r.top+8, c2); |
366 |
366 |
367 // draw actual scrollbar |
367 // draw actual scrollbar |
368 pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right); |
368 pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right); |
369 DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? 0x20 : 0); |
369 DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? FR_LOWERED : 0); |
370 |
370 |
371 break; |
371 break; |
372 } |
372 } |
373 |
373 |
374 case WWT_FRAME: { |
374 case WWT_FRAME: { |
404 goto restore_dparam; |
404 goto restore_dparam; |
405 } |
405 } |
406 |
406 |
407 case WWT_STICKYBOX: { |
407 case WWT_STICKYBOX: { |
408 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
408 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
409 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
409 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
410 DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2 + clicked, r.top + 3 + clicked); |
410 DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2 + clicked, r.top + 3 + clicked); |
411 break; |
411 break; |
412 } |
412 } |
413 |
413 |
414 case WWT_RESIZEBOX: { |
414 case WWT_RESIZEBOX: { |
415 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
415 assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere! |
416 |
416 |
417 clicked = !!(w->flags4 & WF_SIZING); |
417 clicked = !!(w->flags4 & WF_SIZING); |
418 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0); |
418 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); |
419 DrawSprite(SPR_WINDOW_RESIZE, r.left + 3 + clicked, r.top + 3 + clicked); |
419 DrawSprite(SPR_WINDOW_RESIZE, r.left + 3 + clicked, r.top + 3 + clicked); |
420 break; |
420 break; |
421 } |
421 } |
422 |
422 |
423 case WWT_CAPTION: { |
423 case WWT_CAPTION: { |
424 assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere! |
424 assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere! |
425 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x10); |
425 DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_BORDERONLY); |
426 DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? 0x60 : 0x70); |
426 DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY); |
427 |
427 |
428 if (w->caption_color != 0xFF) { |
428 if (w->caption_color != 0xFF) { |
429 GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b); |
429 GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b); |
430 } |
430 } |
431 |
431 |
441 } while (cur_click>>=1, cur_disabled>>=1, cur_hidden >>= 1, (++wi)->type != WWT_LAST); |
441 } while (cur_click>>=1, cur_disabled>>=1, cur_hidden >>= 1, (++wi)->type != WWT_LAST); |
442 |
442 |
443 |
443 |
444 if (w->flags4 & WF_WHITE_BORDER_MASK) { |
444 if (w->flags4 & WF_WHITE_BORDER_MASK) { |
445 //DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10); |
445 //DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10); |
446 DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, 0x10); |
446 DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, FR_BORDERONLY); |
447 } |
447 } |
448 |
448 |
449 } |
449 } |
450 |
450 |
451 static uint _dropdown_item_count; |
451 static uint _dropdown_item_count; |