src/toolbar_gui.cpp
changeset 9273 35e0224ea8f1
parent 9242 787ddde2b852
child 9301 3b20dfb6c4e8
equal deleted inserted replaced
9272:e64b518a7b54 9273:35e0224ea8f1
   682 			w->SetWidgetsDisabledState(ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END);
   682 			w->SetWidgetsDisabledState(ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END);
   683 
   683 
   684 			w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN));
   684 			w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN));
   685 			w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
   685 			w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
   686 
   686 
   687 			DrawWindowWidgets(w);
   687 			w->DrawWidgets();
   688 			break;
   688 			break;
   689 
   689 
   690 		case WE_CLICK:
   690 		case WE_CLICK:
   691 			if (_game_mode != GM_MENU && !w->IsWidgetDisabled(e->we.click.widget)) _toolbar_button_procs[e->we.click.widget](w);
   691 			if (_game_mode != GM_MENU && !w->IsWidgetDisabled(e->we.click.widget)) _toolbar_button_procs[e->we.click.widget](w);
   692 			break;
   692 			break;
   885 
   885 
   886 			/* Draw brown-red toolbar bg. */
   886 			/* Draw brown-red toolbar bg. */
   887 			GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB2);
   887 			GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB2);
   888 			GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
   888 			GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
   889 
   889 
   890 			DrawWindowWidgets(w);
   890 			w->DrawWidgets();
   891 
   891 
   892 			SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
   892 			SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
   893 			DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
   893 			DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
   894 
   894 
   895 			/* We hide this panel when the toolbar space gets too small */
   895 			/* We hide this panel when the toolbar space gets too small */
  1144 		w->SetDirty();
  1144 		w->SetDirty();
  1145 	}
  1145 	}
  1146 
  1146 
  1147 	virtual void OnPaint()
  1147 	virtual void OnPaint()
  1148 	{
  1148 	{
  1149 		DrawWindowWidgets(this);
  1149 		this->DrawWidgets();
  1150 
  1150 
  1151 		for (int i = 0, x = 1, y = 1; i != this->item_count; i++, y += 10) {
  1151 		for (int i = 0, x = 1, y = 1; i != this->item_count; i++, y += 10) {
  1152 			TextColour color = HasBit(this->disabled_items, i) ? TC_GREY : (this->sel_index == i) ? TC_WHITE : TC_BLACK;
  1152 			TextColour color = HasBit(this->disabled_items, i) ? TC_GREY : (this->sel_index == i) ? TC_WHITE : TC_BLACK;
  1153 			if (this->sel_index == i) GfxFillRect(x, y, x + this->width - 3, y + 9, 0);
  1153 			if (this->sel_index == i) GfxFillRect(x, y, x + this->width - 3, y + 9, 0);
  1154 
  1154 
  1321 	}
  1321 	}
  1322 
  1322 
  1323 	virtual void OnPaint()
  1323 	virtual void OnPaint()
  1324 	{
  1324 	{
  1325 		this->UpdatePlayerMenuHeight();
  1325 		this->UpdatePlayerMenuHeight();
  1326 		DrawWindowWidgets(this);
  1326 		this->DrawWidgets();
  1327 
  1327 
  1328 		int x = 1;
  1328 		int x = 1;
  1329 		int y = 1;
  1329 		int y = 1;
  1330 		int sel = this->sel_index;
  1330 		int sel = this->sel_index;
  1331 		int gray = this->gray_items;
  1331 		int gray = this->gray_items;