src/statusbar_gui.cpp
changeset 10570 b83e3644d1da
parent 10521 79e3bb000aed
child 10572 bdc63a6797fe
equal deleted inserted replaced
10569:1359ca399ddd 10570:b83e3644d1da
    16 #include "news_gui.h"
    16 #include "news_gui.h"
    17 #include "player_gui.h"
    17 #include "player_gui.h"
    18 #include "window_gui.h"
    18 #include "window_gui.h"
    19 #include "variables.h"
    19 #include "variables.h"
    20 #include "window_func.h"
    20 #include "window_func.h"
       
    21 #include "statusbar_gui.h"
    21 
    22 
    22 #include "table/strings.h"
    23 #include "table/strings.h"
    23 #include "table/sprites.h"
    24 #include "table/sprites.h"
    24 
    25 
    25 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
    26 static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
   105 
   106 
   106 			if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT, PALETTE_TO_RED, w->widget[1].right - 11, 2);
   107 			if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT, PALETTE_TO_RED, w->widget[1].right - 11, 2);
   107 		} break;
   108 		} break;
   108 
   109 
   109 		case WE_INVALIDATE_DATA:
   110 		case WE_INVALIDATE_DATA:
   110 			WP(w, def_d).data_3 = e->we.invalidate.data;
   111 			switch (e->we.invalidate.data) {
       
   112 				default: NOT_REACHED();
       
   113 				case SBI_SAVELOAD_START:  WP(w, def_d).data_3 = true;  break;
       
   114 				case SBI_SAVELOAD_FINISH: WP(w, def_d).data_3 = false; break;
       
   115 				case SBI_SHOW_TICKER:     WP(w, def_d).data_1 = 360;   break;
       
   116 				case SBI_SHOW_REMINDER:   WP(w, def_d).data_2 = 91;    break;
       
   117 			}
   111 			break;
   118 			break;
   112 
   119 
   113 		case WE_CLICK:
   120 		case WE_CLICK:
   114 			switch (e->we.click.widget) {
   121 			switch (e->we.click.widget) {
   115 				case 1: ShowLastNewsMessage(); break;
   122 				case 1: ShowLastNewsMessage(); break;
   150 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   157 	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
   151 	_main_status_widgets,
   158 	_main_status_widgets,
   152 	StatusBarWndProc
   159 	StatusBarWndProc
   153 };
   160 };
   154 
   161 
       
   162 /**
       
   163  * Checks whether the news ticker is currently being used.
       
   164  */
       
   165 bool IsNewsTickerShown()
       
   166 {
       
   167 	const Window *w = FindWindowById(WC_STATUS_BAR, 0);
       
   168 	return w != NULL && WP(w, const def_d).data_1 > -1280;
       
   169 }
       
   170 
   155 void ShowStatusBar()
   171 void ShowStatusBar()
   156 {
   172 {
   157 	_main_status_desc.top = _screen.height - 12;
   173 	_main_status_desc.top = _screen.height - 12;
   158 	Window *w = new Window(&_main_status_desc);
   174 	Window *w = new Window(&_main_status_desc);
   159 	if (w != NULL) {
   175 	if (w != NULL) {