main_gui.c
changeset 4781 3e0c04509b05
parent 4748 8a928d86a56c
child 4820 dd69fb4c3fcd
equal deleted inserted replaced
4780:307af11a644c 4781:3e0c04509b05
  1759 };
  1759 };
  1760 
  1760 
  1761 static void MainToolbarWndProc(Window *w, WindowEvent *e)
  1761 static void MainToolbarWndProc(Window *w, WindowEvent *e)
  1762 {
  1762 {
  1763 	switch (e->event) {
  1763 	switch (e->event) {
  1764 	case WE_PAINT: {
  1764 	case WE_PAINT:
  1765 		bool is_spectator = _current_player == OWNER_SPECTATOR;
       
  1766 
       
  1767 		// Draw brown-red toolbar bg.
  1765 		// Draw brown-red toolbar bg.
  1768 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1766 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1769 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT);
  1767 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT);
  1770 
  1768 
  1771 		/* If spectator, disable all construction buttons
  1769 		/* If spectator, disable all construction buttons
  1772 		 * ie : Build road, rail, ships, airports and landscaping
  1770 		 * ie : Build road, rail, ships, airports and landscaping
  1773 		 * Since enabled state is the default, just disable when needed */
  1771 		 * Since enabled state is the default, just disable when needed */
  1774 		SetWindowWidgetDisabledState(w, 19, is_spectator);
  1772 		SetWindowWidgetsDisabledState(w, _current_player == OWNER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END);
  1775 		SetWindowWidgetDisabledState(w, 20, is_spectator);
  1773 		/* disable company list drop downs, if there are no companies */
  1776 		SetWindowWidgetDisabledState(w, 21, is_spectator);
  1774 		SetWindowWidgetsDisabledState(w, ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END);
  1777 		SetWindowWidgetDisabledState(w, 22, is_spectator);
       
  1778 		SetWindowWidgetDisabledState(w, 23, is_spectator);
       
  1779 
  1775 
  1780 		DrawWindowWidgets(w);
  1776 		DrawWindowWidgets(w);
  1781 		break;
  1777 		break;
  1782 	}
       
  1783 
  1778 
  1784 	case WE_CLICK: {
  1779 	case WE_CLICK: {
  1785 		if (_game_mode != GM_MENU && !IsWindowWidgetDisabled(w, e->we.click.widget))
  1780 		if (_game_mode != GM_MENU && !IsWindowWidgetDisabled(w, e->we.click.widget))
  1786 			_toolbar_button_procs[e->we.click.widget](w);
  1781 			_toolbar_button_procs[e->we.click.widget](w);
  1787 	} break;
  1782 	} break;