OpenTTD Source: src/statusbar_gui.cpp Source File

OpenTTD Source 14.1

statusbar_gui.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #include "stdafx.h"
11 #include "core/backup_type.hpp"
12 #include "gfx_func.h"
13 #include "news_func.h"
14 #include "company_func.h"
15 #include "string_func.h"
16 #include "strings_func.h"
17 #include "company_base.h"
18 #include "tilehighlight_func.h"
19 #include "news_gui.h"
20 #include "company_gui.h"
21 #include "window_gui.h"
22 #include "saveload/saveload.h"
23 #include "window_func.h"
24 #include "statusbar_gui.h"
25 #include "toolbar_gui.h"
26 #include "core/geometry_func.hpp"
27 #include "zoom_func.h"
28 #include "timer/timer.h"
29 #include "timer/timer_game_calendar.h"
30 #include "timer/timer_window.h"
31
32 #include "widgets/statusbar_widget.h"
33
34 #include "table/strings.h"
35 #include "table/sprites.h"
36
37 #include "safeguards.h"
38
39 static bool DrawScrollingStatusText(const NewsItem *ni, int scroll_pos, int left, int right, int top, int bottom)
40 {
41 CopyInDParam(ni->params);
42
43 /* Replace newlines and the likes with spaces. */
44 std::string message = StrMakeValid(GetString(ni->string_id), SVS_REPLACE_TAB_CR_NL_WITH_SPACE);
45
46 DrawPixelInfo tmp_dpi;
47 if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true;
48
49 int width = GetStringBoundingBox(message).width;
50 int pos = (_current_text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
51
52 AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
53 DrawString(pos, INT16_MAX, 0, message, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE);
54
55 return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
56 }
57
58 struct StatusBarWindow : Window {
59 bool saving;
60 int ticker_scroll;
61
62 static const int TICKER_STOP = 1640;
63 static const int COUNTER_STEP = 2;
64 static constexpr auto REMINDER_START = std::chrono::milliseconds(1350);
65
66 StatusBarWindow(WindowDesc *desc) : Window(desc)
67 {
68 this->ticker_scroll = TICKER_STOP;
69
70 this->InitNested();
71 CLRBITS(this->flags, WF_WHITE_BORDER);
72 PositionStatusbar(this);
73 }
74
75 Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
76 {
77 Point pt = { 0, _screen.height - sm_height };
78 return pt;
79 }
80
81 void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
82 {
83 Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
84 }
85
86 void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
87 {
88 Dimension d;
89 switch (widget) {
90 case WID_S_LEFT:
91 SetDParamMaxValue(0, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR));
92 d = GetStringBoundingBox(STR_JUST_DATE_LONG);
93 break;
94
95 case WID_S_RIGHT: {
96 int64_t max_money = UINT32_MAX;
97 for (const Company *c : Company::Iterate()) max_money = std::max<int64_t>(c->money, max_money);
98 SetDParam(0, 100LL * max_money);
99 d = GetStringBoundingBox(STR_JUST_CURRENCY_LONG);
100 break;
101 }
102
103 default:
104 return;
105 }
106
107 d.width += padding.width;
108 d.height += padding.height;
109 *size = maxdim(d, *size);
110 }
111
112 void DrawWidget(const Rect &r, WidgetID widget) const override
113 {
114 Rect tr = r.Shrink(WidgetDimensions::scaled.framerect, RectPadding::zero);
115 tr.top = CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
116 switch (widget) {
117 case WID_S_LEFT:
118 /* Draw the date */
119 SetDParam(0, TimerGameCalendar::date);
120 DrawString(tr, STR_JUST_DATE_LONG, TC_WHITE, SA_HOR_CENTER);
121 break;
122
123 case WID_S_RIGHT: {
124 if (_local_company == COMPANY_SPECTATOR) {
125 DrawString(tr, STR_STATUSBAR_SPECTATOR, TC_FROMSTRING, SA_HOR_CENTER);
126 } else if (_settings_game.difficulty.infinite_money) {
127 DrawString(tr, STR_STATUSBAR_INFINITE_MONEY, TC_FROMSTRING, SA_HOR_CENTER);
128 } else {
129 /* Draw company money, if any */
130 const Company *c = Company::GetIfValid(_local_company);
131 if (c != nullptr) {
132 SetDParam(0, c->money);
133 DrawString(tr, STR_JUST_CURRENCY_LONG, TC_WHITE, SA_HOR_CENTER);
134 }
135 }
136 break;
137 }
138
139 case WID_S_MIDDLE:
140 /* Draw status bar */
141 if (this->saving) { // true when saving is active
142 DrawString(tr, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER | SA_VERT_CENTER);
143 } else if (_do_autosave) {
144 DrawString(tr, STR_STATUSBAR_AUTOSAVE, TC_FROMSTRING, SA_HOR_CENTER);
145 } else if (_pause_mode != PM_UNPAUSED) {
146 StringID msg = (_pause_mode & PM_PAUSED_LINK_GRAPH) ? STR_STATUSBAR_PAUSED_LINK_GRAPH : STR_STATUSBAR_PAUSED;
147 DrawString(tr, msg, TC_FROMSTRING, SA_HOR_CENTER);
148 } else if (this->ticker_scroll < TICKER_STOP && _statusbar_news_item != nullptr && _statusbar_news_item->string_id != 0) {
149 /* Draw the scrolling news text */
150 if (!DrawScrollingStatusText(_statusbar_news_item, ScaleGUITrad(this->ticker_scroll), tr.left, tr.right, tr.top, tr.bottom)) {
151 InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED);
152 if (Company::IsValidID(_local_company)) {
153 /* This is the default text */
154 SetDParam(0, _local_company);
155 DrawString(tr, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
156 }
157 }
158 } else {
159 if (Company::IsValidID(_local_company)) {
160 /* This is the default text */
161 SetDParam(0, _local_company);
162 DrawString(tr, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
163 }
164 }
165
166 if (!this->reminder_timeout.HasFired()) {
167 Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
168 DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, tr.right - icon_size.width, CenterBounds(r.top, r.bottom, icon_size.height));
169 }
170 break;
171 }
172 }
173
179 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
180 {
181 if (!gui_scope) return;
182 switch (data) {
183 default: NOT_REACHED();
184 case SBI_SAVELOAD_START: this->saving = true; break;
185 case SBI_SAVELOAD_FINISH: this->saving = false; break;
186 case SBI_SHOW_TICKER: this->ticker_scroll = 0; break;
187 case SBI_SHOW_REMINDER: this->reminder_timeout.Reset(); break;
188 case SBI_NEWS_DELETED:
189 this->ticker_scroll = TICKER_STOP; // reset ticker ...
190 this->reminder_timeout.Abort(); // ... and reminder
191 break;
192 }
193 }
194
195 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
196 {
197 switch (widget) {
198 case WID_S_MIDDLE: ShowLastNewsMessage(); break;
199 case WID_S_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break;
200 default: ResetObjectToPlace();
201 }
202 }
203
205 IntervalTimer<TimerWindow> ticker_scroll_interval = {std::chrono::milliseconds(15), [this](uint count) {
206 if (_pause_mode != PM_UNPAUSED) return;
207
208 if (this->ticker_scroll < TICKER_STOP) {
209 this->ticker_scroll += count;
210 this->SetWidgetDirty(WID_S_MIDDLE);
211 }
212 }};
213
214 TimeoutTimer<TimerWindow> reminder_timeout = {REMINDER_START, [this]() {
215 this->SetWidgetDirty(WID_S_MIDDLE);
216 }};
217
218 IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
219 this->SetWidgetDirty(WID_S_LEFT);
220 }};
221 };
222
223 static constexpr NWidgetPart _nested_main_status_widgets[] = {
224 NWidget(NWID_HORIZONTAL),
225 NWidget(WWT_PANEL, COLOUR_GREY, WID_S_LEFT), SetMinimalSize(140, 12), EndContainer(),
226 NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(40, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0),
227 NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_RIGHT), SetMinimalSize(140, 12),
228 EndContainer(),
229 };
230
231 static WindowDesc _main_status_desc(__FILE__, __LINE__,
232 WDP_MANUAL, nullptr, 0, 0,
233 WC_STATUS_BAR, WC_NONE,
234 WDF_NO_FOCUS | WDF_NO_CLOSE,
235 std::begin(_nested_main_status_widgets), std::end(_nested_main_status_widgets)
236 );
237
241 bool IsNewsTickerShown()
242 {
243 const StatusBarWindow *w = dynamic_cast<StatusBarWindow*>(FindWindowById(WC_STATUS_BAR, 0));
244 return w != nullptr && w->ticker_scroll < StatusBarWindow::TICKER_STOP;
245 }
246
250 void ShowStatusBar()
251 {
252 new StatusBarWindow(&_main_status_desc);
253 }
StatusBarWindow::REMINDER_START
static constexpr auto REMINDER_START
time in ms for reminder notification (red dot on the right) to stay
Definition: statusbar_gui.cpp:64
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition: window.cpp:3204
CopyInDParam
void CopyInDParam(const std::span< const StringParameterBackup > backup)
Copy the parameters from the backup into the global string parameter array.
Definition: strings.cpp:159
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:30
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
Pool::PoolItem<&_company_pool >::GetIfValid
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:350
statusbar_widget.h
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition: geometry_type.hpp:98
toolbar_gui.h
statusbar_gui.h
NewsItem
Information about a single item of news.
Definition: news_type.h:128
company_base.h
timer_game_calendar.h
company_gui.h
Window::SetWidgetDirty
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:552
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
IntervalTimer< TimerWindow >
NewsItem::params
std::vector< StringParameterBackup > params
Parameters for string resolving.
Definition: news_type.h:144
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:77
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition: window.cpp:1099
GameSettings::difficulty
DifficultySettings difficulty
settings related to the difficulty
Definition: settings_type.h:617
StrMakeValid
static void StrMakeValid(T &dst, const char *str, const char *last, StringValidationSettings settings)
Copies the valid (UTF-8) characters from str up to last to the dst.
Definition: string.cpp:114
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1153
_do_autosave
bool _do_autosave
are we doing an autosave at the moment?
Definition: saveload.cpp:66
WDF_NO_FOCUS
@ WDF_NO_FOCUS
This window won't get focus/make any other window lose focus when click.
Definition: window_gui.h:199
saveload.h
zoom_func.h
SA_VERT_CENTER
@ SA_VERT_CENTER
Vertically center the text.
Definition: gfx_type.h:344
IsNewsTickerShown
bool IsNewsTickerShown()
Checks whether the news ticker is currently being used.
Definition: statusbar_gui.cpp:241
StatusBarWindow
Definition: statusbar_gui.cpp:58
TimeoutTimer::HasFired
bool HasFired() const
Check whether the timeout occurred.
Definition: timer.h:171
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:1040
PM_UNPAUSED
@ PM_UNPAUSED
A normal unpaused game.
Definition: openttd.h:69
gfx_func.h
WindowDesc
High level window description.
Definition: window_gui.h:153
WidgetID
int WidgetID
Widget ID.
Definition: window_type.h:18
TimeoutTimer::Reset
void Reset()
Reset the timer, so it will fire again after the timeout.
Definition: timer.h:140
ScaleGUITrad
int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:117
window_gui.h
PositionStatusbar
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
Definition: window.cpp:3385
ShowCompanyFinances
void ShowCompanyFinances(CompanyID company)
Open the finances window of a company.
Definition: company_gui.cpp:544
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition: widget_type.h:1088
WWT_PUSHBTN
@ WWT_PUSHBTN
Normal push-button (no toggle button) with custom drawing.
Definition: widget_type.h:109
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:308
SBI_SAVELOAD_FINISH
@ SBI_SAVELOAD_FINISH
finished saving
Definition: statusbar_gui.h:16
tilehighlight_func.h
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition: gfx_type.h:203
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1747
_toolbar_width
uint _toolbar_width
Width of the toolbar, shared by statusbar.
Definition: toolbar_gui.cpp:70
WF_WHITE_BORDER
@ WF_WHITE_BORDER
Window white border counter bit mask.
Definition: window_gui.h:230
SBI_NEWS_DELETED
@ SBI_NEWS_DELETED
abort current news display (active news were deleted)
Definition: statusbar_gui.h:19
CompanyProperties::money
Money money
Money owned by the company.
Definition: company_base.h:80
_pause_mode
PauseMode _pause_mode
The current pause mode.
Definition: gfx.cpp:49
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
SA_FORCE
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
Definition: gfx_type.h:350
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1260
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:50
safeguards.h
WID_S_RIGHT
@ WID_S_RIGHT
Right part; bank balance.
Definition: statusbar_widget.h:17
timer.h
Window::flags
WindowFlags flags
Window flags.
Definition: window_gui.h:294
StatusBarWindow::TICKER_STOP
static const int TICKER_STOP
scrolling is finished when counter reaches this value
Definition: statusbar_gui.cpp:62
NewsItem::string_id
StringID string_id
Message text.
Definition: news_type.h:131
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:1003
sprites.h
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
TimerGameConst< struct Calendar >::MAX_YEAR
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
Definition: timer_game_common.h:173
WDF_NO_CLOSE
@ WDF_NO_CLOSE
This window can't be interactively closed.
Definition: window_gui.h:200
CenterBounds
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
Definition: gfx_func.h:166
SBI_SAVELOAD_START
@ SBI_SAVELOAD_START
started saving
Definition: statusbar_gui.h:15
stdafx.h
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:296
SBI_SHOW_REMINDER
@ SBI_SHOW_REMINDER
show a reminder (dot on the right side of the statusbar)
Definition: statusbar_gui.h:18
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:45
SA_HOR_CENTER
@ SA_HOR_CENTER
Horizontally center the text.
Definition: gfx_type.h:339
FillDrawPixelInfo
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Definition: gfx.cpp:1567
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition: gfx.cpp:937
string_func.h
StatusBarWindow::ticker_scroll_interval
IntervalTimer< TimerWindow > ticker_scroll_interval
Move information on the ticker slowly from one side to the other.
Definition: statusbar_gui.cpp:205
Pool::PoolItem<&_company_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition: pool_type.hpp:388
TimeoutTimer< TimerWindow >
strings_func.h
TimerGame< struct Calendar >::DateAtStartOfYear
static constexpr Date DateAtStartOfYear(Year year)
Calculate the date of the first day of a given year.
Definition: timer_game_common.h:88
DifficultySettings::infinite_money
bool infinite_money
whether spending money despite negative balance is allowed
Definition: settings_type.h:117
SetDParamMaxValue
void SetDParamMaxValue(size_t n, uint64_t max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
Definition: strings.cpp:127
StatusBarWindow::OnInvalidateData
void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true) override
Some data on this window has become invalid.
Definition: statusbar_gui.cpp:179
SetDParam
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings.cpp:104
COMPANY_SPECTATOR
@ COMPANY_SPECTATOR
The client is spectating.
Definition: company_type.h:35
geometry_func.hpp
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:52
ShowLastNewsMessage
void ShowLastNewsMessage()
Show previous news item.
Definition: news_gui.cpp:1055
AutoRestoreBackup
Class to backup a specific variable and restore it upon destruction of this object to prevent stack v...
Definition: backup_type.hpp:153
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
Definition: strings.cpp:327
news_gui.h
company_func.h
PM_PAUSED_LINK_GRAPH
@ PM_PAUSED_LINK_GRAPH
A game paused due to the link graph schedule lagging.
Definition: openttd.h:76
SA_LEFT
@ SA_LEFT
Left align the text.
Definition: gfx_type.h:338
window_func.h
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition: fontcache.cpp:78
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1099
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition: window_gui.h:140
WID_S_MIDDLE
@ WID_S_MIDDLE
Middle part; current news or company name or *** SAVING *** or *** PAUSED ***.
Definition: statusbar_widget.h:16
DrawString
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:654
timer_window.h
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition: timer_game_calendar.h:34
Window
Data structure for an opened window.
Definition: window_gui.h:267
SVS_REPLACE_TAB_CR_NL_WITH_SPACE
@ SVS_REPLACE_TAB_CR_NL_WITH_SPACE
Replace tabs ('\t'), carriage returns ('\r') and newlines (' ') with spaces.
Definition: string_type.h:54
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:328
WC_STATUS_BAR
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
Definition: window_type.h:64
StatusBarWindow::COUNTER_STEP
static const int COUNTER_STEP
this is subtracted from active counters every tick
Definition: statusbar_gui.cpp:63
SetDataTip
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1164
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:75
Company
Definition: company_base.h:129
CLRBITS
#define CLRBITS(x, y)
Clears several bits in a variable.
Definition: bitmath_func.hpp:166
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3483
ShowStatusBar
void ShowStatusBar()
Show our status bar.
Definition: statusbar_gui.cpp:250
WID_S_LEFT
@ WID_S_LEFT
Left part of the statusbar; date is shown there.
Definition: statusbar_widget.h:15
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition: strings_type.h:24
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:56
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:848
SBI_SHOW_TICKER
@ SBI_SHOW_TICKER
start scrolling news
Definition: statusbar_gui.h:17
DrawPixelInfo
Data about how and where to blit pixels.
Definition: gfx_type.h:151
TimeoutTimer::Abort
void Abort()
Abort the timer so it doesn't fire if it hasn't yet.
Definition: timer.h:161
news_func.h
Window::FindWindowPlacementAndResize
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
Resize window towards the default size.
Definition: window.cpp:1421
backup_type.hpp