widget.c
changeset 893 d9e69e5060ba
parent 884 9750c41c5860
child 894 ab8a5f7ea3db
equal deleted inserted replaced
892:3e5dd4c4d5b3 893:d9e69e5060ba
   271 		// vertical scrollbar
   271 		// vertical scrollbar
   272 		case WWT_SCROLLBAR: {
   272 		case WWT_SCROLLBAR: {
   273 			Point pt;
   273 			Point pt;
   274 			int c1,c2;
   274 			int c1,c2;
   275 
   275 
       
   276 			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
       
   277 
   276 			// draw up/down buttons
   278 			// draw up/down buttons
   277 			DrawFrameRect(r.left, r.top, r.right, r.top+9, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP ? 0x20 : 0);
   279 			DrawFrameRect(r.left, r.top, r.right, r.top+9, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP ? 0x20 : 0);
   278 			DrawFrameRect(r.left, r.bottom-9, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN ? 0x20 : 0);
   280 			DrawFrameRect(r.left, r.bottom-9, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN ? 0x20 : 0);
   279 
   281 
   280 			// draw icons in up/down buttons
   282 			// draw icons in up/down buttons
   300 		}
   302 		}
   301 		case WWT_SCROLL2BAR: {
   303 		case WWT_SCROLL2BAR: {
   302 			Point pt;
   304 			Point pt;
   303 			int c1,c2;
   305 			int c1,c2;
   304 
   306 
       
   307 			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
       
   308 
   305 			// draw up/down buttons
   309 			// draw up/down buttons
   306 			DrawFrameRect(r.left, r.top, r.right, r.top+9, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2) ? 0x20 : 0);
   310 			DrawFrameRect(r.left, r.top, r.right, r.top+9, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2) ? 0x20 : 0);
   307 			DrawFrameRect(r.left, r.bottom-9, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2) ? 0x20 : 0);
   311 			DrawFrameRect(r.left, r.bottom-9, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2) ? 0x20 : 0);
   308 
   312 
   309 			// draw icons in up/down buttons
   313 			// draw icons in up/down buttons
   331 		// horizontal scrollbar
   335 		// horizontal scrollbar
   332 		case WWT_HSCROLLBAR: {
   336 		case WWT_HSCROLLBAR: {
   333 			Point pt;
   337 			Point pt;
   334 			int c1,c2;
   338 			int c1,c2;
   335 
   339 
       
   340 			assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
       
   341 
   336 			DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL) ? 0x20 : 0);
   342 			DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL) ? 0x20 : 0);
   337 			DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL) ? 0x20 : 0);
   343 			DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL) ? 0x20 : 0);
   338 
   344 
   339 			// draw icons in up/down buttons
   345 			// draw icons in up/down buttons
   340 			DrawSprite(SPR_ARROW_LEFT, r.left + 3, r.top + 2);
   346 			DrawSprite(SPR_ARROW_LEFT, r.left + 3, r.top + 2);
   392 
   398 
   393 			goto restore_dparam;
   399 			goto restore_dparam;
   394 		}
   400 		}
   395 
   401 
   396 		case WWT_STICKYBOX: {
   402 		case WWT_STICKYBOX: {
       
   403 			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
   397 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (cur_click & 1) ? 0x20 : 0);
   404 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (cur_click & 1) ? 0x20 : 0);
   398 			DrawSprite((cur_click & 1) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2, r.top + 3);
   405 			DrawSprite((cur_click & 1) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2, r.top + 3);
   399 			break;
   406 			break;
   400 		}
   407 		}
   401 
   408 
   402 		case WWT_RESIZEBOX: {
   409 		case WWT_RESIZEBOX: {
       
   410 			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
       
   411 			
   403 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0);
   412 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0);
   404 			DrawSprite(SPR_WINDOW_RESIZE, r.left + 2, r.top + 3);
   413 			DrawSprite(SPR_WINDOW_RESIZE, r.left + 3, r.top + 3);
   405 			break;
   414 			break;
   406 		}
   415 		}
   407 
   416 
   408 		case WWT_CAPTION: {
   417 		case WWT_CAPTION: {
       
   418 			assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
   409 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x10);
   419 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x10);
   410 			DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? 0x60 : 0x70);
   420 			DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? 0x60 : 0x70);
   411 
   421 
   412 			if (w->caption_color != 0xFF) {
   422 			if (w->caption_color != 0xFF) {
   413 				GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b);
   423 				GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b);