OpenTTD Source: src/statusbar_gui.cpp Source File

OpenTTD Source 15.3

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
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
39static bool DrawScrollingStatusText(const NewsItem &ni, int scroll_pos, int left, int right, int top, int bottom)
40{
41 /* Replace newlines and the likes with spaces. */
42 std::string message = StrMakeValid(ni.GetStatusText(), StringValidationSetting::ReplaceTabCrNlWithSpace);
43
44 DrawPixelInfo tmp_dpi;
45 if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true;
46
47 int width = GetStringBoundingBox(message).width;
48 int pos = (_current_text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
49
50 AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
51 DrawString(pos, INT16_MAX, 0, message, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE);
52
53 return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
54}
55
56 struct StatusBarWindow : Window {
57 bool saving = false;
58 int ticker_scroll = TICKER_STOP;
59
60 static const int TICKER_STOP = 1640;
61 static const int COUNTER_STEP = 2;
62 static constexpr auto REMINDER_START = std::chrono::milliseconds(1350);
63
64 StatusBarWindow(WindowDesc &desc) : Window(desc)
65 {
66 this->InitNested();
67 this->flags.Reset(WindowFlag::WhiteBorder);
68 PositionStatusbar(this);
69 }
70
71 Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
72 {
73 Point pt = { 0, _screen.height - sm_height };
74 return pt;
75 }
76
77 void FindWindowPlacementAndResize(int, int def_height, bool allow_resize) override
78 {
79 Window::FindWindowPlacementAndResize(_toolbar_width, def_height, allow_resize);
80 }
81
82 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
83 {
84 Dimension d;
85 switch (widget) {
86 case WID_S_LEFT:
87 d = GetStringBoundingBox(GetString(STR_JUST_DATE_LONG, GetParamMaxValue(TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR).base())));
88 break;
89
90 case WID_S_RIGHT: {
91 int64_t max_money = UINT32_MAX;
92 for (const Company *c : Company::Iterate()) max_money = std::max<int64_t>(c->money, max_money);
93 d = GetStringBoundingBox(GetString(STR_JUST_CURRENCY_LONG, 100LL * max_money));
94 break;
95 }
96
97 default:
98 return;
99 }
100
101 d.width += padding.width;
102 d.height += padding.height;
103 size = maxdim(d, size);
104 }
105
106 void DrawWidget(const Rect &r, WidgetID widget) const override
107 {
108 Rect tr = r.Shrink(WidgetDimensions::scaled.framerect, RectPadding::zero);
109 tr.top = CentreBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL));
110 switch (widget) {
111 case WID_S_LEFT:
112 /* Draw the date */
113 DrawString(tr, GetString(STR_JUST_DATE_LONG, TimerGameCalendar::date), TC_WHITE, SA_HOR_CENTER);
114 break;
115
116 case WID_S_RIGHT: {
117 if (_local_company == COMPANY_SPECTATOR) {
118 DrawString(tr, STR_STATUSBAR_SPECTATOR, TC_FROMSTRING, SA_HOR_CENTER);
119 } else if (_settings_game.difficulty.infinite_money) {
120 DrawString(tr, STR_STATUSBAR_INFINITE_MONEY, TC_FROMSTRING, SA_HOR_CENTER);
121 } else {
122 /* Draw company money, if any */
123 const Company *c = Company::GetIfValid(_local_company);
124 if (c != nullptr) {
125 DrawString(tr, GetString(STR_JUST_CURRENCY_LONG, c->money), TC_WHITE, SA_HOR_CENTER);
126 }
127 }
128 break;
129 }
130
131 case WID_S_MIDDLE:
132 /* Draw status bar */
133 if (this->saving) { // true when saving is active
134 DrawString(tr, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER | SA_VERT_CENTER);
135 } else if (_do_autosave) {
136 DrawString(tr, STR_STATUSBAR_AUTOSAVE, TC_FROMSTRING, SA_HOR_CENTER);
137 } else if (_pause_mode.Any()) {
138 StringID msg = _pause_mode.Test(PauseMode::LinkGraph) ? STR_STATUSBAR_PAUSED_LINK_GRAPH : STR_STATUSBAR_PAUSED;
139 DrawString(tr, msg, TC_FROMSTRING, SA_HOR_CENTER);
140 } else if (this->ticker_scroll < TICKER_STOP && GetStatusbarNews() != nullptr && !GetStatusbarNews()->headline.empty()) {
141 /* Draw the scrolling news text */
142 if (!DrawScrollingStatusText(*GetStatusbarNews(), ScaleGUITrad(this->ticker_scroll), tr.left, tr.right, tr.top, tr.bottom)) {
143 InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED);
144 if (Company::IsValidID(_local_company)) {
145 /* This is the default text */
146 DrawString(tr, GetString(STR_STATUSBAR_COMPANY_NAME, _local_company), TC_FROMSTRING, SA_HOR_CENTER);
147 }
148 }
149 } else {
150 if (Company::IsValidID(_local_company)) {
151 /* This is the default text */
152 DrawString(tr, GetString(STR_STATUSBAR_COMPANY_NAME, _local_company), TC_FROMSTRING, SA_HOR_CENTER);
153 }
154 }
155
156 if (!this->reminder_timeout.HasFired()) {
157 Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
158 DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, tr.right - icon_size.width, CentreBounds(r.top, r.bottom, icon_size.height));
159 }
160 break;
161 }
162 }
163
169 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
170 {
171 if (!gui_scope) return;
172 switch (data) {
173 default: NOT_REACHED();
174 case SBI_SAVELOAD_START: this->saving = true; break;
175 case SBI_SAVELOAD_FINISH: this->saving = false; break;
176 case SBI_SHOW_TICKER: this->ticker_scroll = 0; break;
177 case SBI_SHOW_REMINDER: this->reminder_timeout.Reset(); break;
178 case SBI_NEWS_DELETED:
179 this->ticker_scroll = TICKER_STOP; // reset ticker ...
180 this->reminder_timeout.Abort(); // ... and reminder
181 break;
182 }
183 }
184
185 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
186 {
187 switch (widget) {
188 case WID_S_MIDDLE: ShowLastNewsMessage(); break;
189 case WID_S_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break;
190 default: ResetObjectToPlace();
191 }
192 }
193
195 const IntervalTimer<TimerWindow> ticker_scroll_interval = {std::chrono::milliseconds(15), [this](uint count) {
196 if (_pause_mode.Any()) return;
197
198 if (this->ticker_scroll < TICKER_STOP) {
199 this->ticker_scroll += count;
200 this->SetWidgetDirty(WID_S_MIDDLE);
201 }
202 }};
203
204 TimeoutTimer<TimerWindow> reminder_timeout = {REMINDER_START, [this]() {
205 this->SetWidgetDirty(WID_S_MIDDLE);
206 }};
207
208 const IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::DAY, TimerGameCalendar::Priority::NONE}, [this](auto) {
209 this->SetWidgetDirty(WID_S_LEFT);
210 }};
211};
212
213static constexpr std::initializer_list<NWidgetPart> _nested_main_status_widgets = {
214 NWidget(NWID_HORIZONTAL),
215 NWidget(WWT_PANEL, COLOUR_GREY, WID_S_LEFT), SetMinimalSize(140, 12), EndContainer(),
216 NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(40, 12), SetToolTip(STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0),
217 NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_RIGHT), SetMinimalSize(140, 12),
218 EndContainer(),
219};
220
221static WindowDesc _main_status_desc(
222 WDP_MANUAL, {}, 0, 0,
223 WC_STATUS_BAR, WC_NONE,
224 {WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
225 _nested_main_status_widgets
226);
227
231 bool IsNewsTickerShown()
232{
233 const StatusBarWindow *w = dynamic_cast<StatusBarWindow*>(FindWindowById(WC_STATUS_BAR, 0));
234 return w != nullptr && w->ticker_scroll < StatusBarWindow::TICKER_STOP;
235}
236
240 void ShowStatusBar()
241{
242 new StatusBarWindow(_main_status_desc);
243}
backup_type.hpp
Class for backupping variables and making sure they are restored later.
BaseBitSet::Test
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Definition base_bitset_type.hpp:141
BaseBitSet::Reset
constexpr Timpl & Reset()
Reset all bits.
Definition base_bitset_type.hpp:83
BaseBitSet::Any
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
Definition base_bitset_type.hpp:170
IntervalTimer
An interval timer will fire every interval, and will continue to fire until it is deleted.
Definition timer.h:76
TimeoutTimer
A timeout timer will fire once after the interval.
Definition timer.h:116
TimeoutTimer::Reset
void Reset()
Reset the timer, so it will fire again after the timeout.
Definition timer.h:140
TimeoutTimer::HasFired
bool HasFired() const
Check whether the timeout occurred.
Definition timer.h:171
TimeoutTimer::Abort
void Abort()
Abort the timer so it doesn't fire if it hasn't yet.
Definition timer.h:161
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition timer_game_calendar.h:33
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
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
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:30
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition company_cmd.cpp:55
company_func.h
Functions related to companies.
ShowCompanyFinances
void ShowCompanyFinances(CompanyID company)
Open the finances window of a company.
Definition company_gui.cpp:569
company_gui.h
GUI Functions related to companies.
COMPANY_SPECTATOR
static constexpr CompanyID COMPANY_SPECTATOR
The client is spectating.
Definition company_type.h:21
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition fontcache.cpp:87
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition geometry_func.cpp:22
geometry_func.hpp
Geometry functions.
CentreBounds
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
Definition geometry_type.hpp:26
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition gfx.cpp:968
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition gfx.cpp:897
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:668
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:1034
_pause_mode
PauseModes _pause_mode
The current pause mode.
Definition gfx.cpp:50
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:1568
gfx_func.h
Functions related to the gfx engine.
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:249
SA_LEFT
@ SA_LEFT
Left align the text.
Definition gfx_type.h:388
SA_HOR_CENTER
@ SA_HOR_CENTER
Horizontally center the text.
Definition gfx_type.h:389
SA_FORCE
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
Definition gfx_type.h:400
SA_VERT_CENTER
@ SA_VERT_CENTER
Vertically center the text.
Definition gfx_type.h:394
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
SetToolTip
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
Definition widget_type.h:1321
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
news_func.h
Functions related to news.
GetStatusbarNews
const NewsItem * GetStatusbarNews()
Get pointer to the current status bar news item.
Definition news_gui.cpp:70
ShowLastNewsMessage
void ShowLastNewsMessage()
Show previous news item.
Definition news_gui.cpp:1138
news_gui.h
GUI functions related to the news.
PauseMode::LinkGraph
@ LinkGraph
A game paused due to the link graph schedule lagging.
safeguards.h
A number of safeguards to prevent using unsafe methods.
_do_autosave
bool _do_autosave
are we doing an autosave at the moment?
Definition saveload.cpp:84
saveload.h
Functions/types related to saving and loading games.
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
sprites.h
This file contains all sprite-related enums and defines.
ShowStatusBar
void ShowStatusBar()
Show our status bar.
Definition statusbar_gui.cpp:240
IsNewsTickerShown
bool IsNewsTickerShown()
Checks whether the news ticker is currently being used.
Definition statusbar_gui.cpp:231
statusbar_gui.h
Functions, definitions and such used only by the GUI.
SBI_SHOW_REMINDER
@ SBI_SHOW_REMINDER
show a reminder (dot on the right side of the statusbar)
Definition statusbar_gui.h:18
SBI_SAVELOAD_FINISH
@ SBI_SAVELOAD_FINISH
finished saving
Definition statusbar_gui.h:16
SBI_SHOW_TICKER
@ SBI_SHOW_TICKER
start scrolling news
Definition statusbar_gui.h:17
SBI_SAVELOAD_START
@ SBI_SAVELOAD_START
started saving
Definition statusbar_gui.h:15
SBI_NEWS_DELETED
@ SBI_NEWS_DELETED
abort current news display (active news were deleted)
Definition statusbar_gui.h:19
statusbar_widget.h
Types related to the statusbar widgets.
WID_S_LEFT
@ WID_S_LEFT
Left part of the statusbar; date is shown there.
Definition statusbar_widget.h:15
WID_S_MIDDLE
@ WID_S_MIDDLE
Middle part; current news or company name or *** SAVING *** or *** PAUSED ***.
Definition statusbar_widget.h:16
WID_S_RIGHT
@ WID_S_RIGHT
Right part; bank balance.
Definition statusbar_widget.h:17
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
StrMakeValid
static void StrMakeValid(Builder &builder, StringConsumer &consumer, StringValidationSettings settings)
Copies the valid (UTF-8) characters from consumer to the builder.
Definition string.cpp:119
string_func.h
Functions related to low-level strings.
StringValidationSetting::ReplaceTabCrNlWithSpace
@ ReplaceTabCrNlWithSpace
Replace tabs ('\t'), carriage returns ('\r') and newlines (' ') with spaces.
GetParamMaxValue
uint64_t GetParamMaxValue(uint64_t max_value, uint min_count, FontSize size)
Get some number that is suitable for string size computations.
Definition strings.cpp:236
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Definition strings.cpp:424
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
strings_func.h
Functions related to OTTD's strings.
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition strings_type.h:27
AutoRestoreBackup
Class to backup a specific variable and restore it upon destruction of this object to prevent stack v...
Definition backup_type.hpp:150
CompanyProperties::money
Money money
Money owned by the company.
Definition company_base.h:84
Company
Definition company_base.h:127
Coord2D< int >
DifficultySettings::infinite_money
bool infinite_money
whether spending money despite negative balance is allowed
Definition settings_type.h:143
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition geometry_type.hpp:56
DrawPixelInfo
Data about how and where to blit pixels.
Definition gfx_type.h:157
GameSettings::difficulty
DifficultySettings difficulty
settings related to the difficulty
Definition settings_type.h:633
NewsItem
Information about a single item of news.
Definition news_type.h:137
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:436
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition pool_type.hpp:376
Pool::PoolItem<&_company_pool >::GetIfValid
static Titem * GetIfValid(auto index)
Returns Titem with given index.
Definition pool_type.hpp:398
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition geometry_type.hpp:101
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition geometry_type.hpp:124
StatusBarWindow
Definition statusbar_gui.cpp:56
StatusBarWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition statusbar_gui.cpp:106
StatusBarWindow::FindWindowPlacementAndResize
void FindWindowPlacementAndResize(int, int def_height, bool allow_resize) override
Resize window towards the default size.
Definition statusbar_gui.cpp:77
StatusBarWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition statusbar_gui.cpp:185
StatusBarWindow::UpdateWidgetSize
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
Definition statusbar_gui.cpp:82
StatusBarWindow::ticker_scroll_interval
const IntervalTimer< TimerWindow > ticker_scroll_interval
Move information on the ticker slowly from one side to the other.
Definition statusbar_gui.cpp:195
StatusBarWindow::TICKER_STOP
static const int TICKER_STOP
scrolling is finished when counter reaches this value
Definition statusbar_gui.cpp:60
StatusBarWindow::OnInitialPosition
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Compute the initial position of the window.
Definition statusbar_gui.cpp:71
StatusBarWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition statusbar_gui.cpp:169
StatusBarWindow::COUNTER_STEP
static const int COUNTER_STEP
this is subtracted from active counters every tick
Definition statusbar_gui.cpp:61
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:62
WindowDesc
High level window description.
Definition window_gui.h:168
Window
Data structure for an opened window.
Definition window_gui.h:274
Window::SetWidgetDirty
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
Definition window.cpp:558
Window::resize
ResizeInfo resize
Resize information.
Definition window_gui.h:315
Window::FindWindowPlacementAndResize
virtual void FindWindowPlacementAndResize(int def_width, int def_height, bool allow_resize)
Resize window towards the default size.
Definition window.cpp:1476
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition window.cpp:1823
Window::flags
WindowFlags flags
Window flags.
Definition window_gui.h:301
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition window_gui.h:303
tilehighlight_func.h
Functions related to tile highlights.
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition viewport.cpp:3573
timer.h
Definition of Interval and OneShot timers.
timer_game_calendar.h
Definition of the game-calendar-timer.
timer_window.h
Definition of the Window system.
_toolbar_width
uint _toolbar_width
Width of the toolbar, shared by statusbar.
Definition toolbar_gui.cpp:80
toolbar_gui.h
Stuff related to the (main) toolbar.
ScaleGUITrad
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition widget.cpp:49
WWT_PUSHBTN
@ WWT_PUSHBTN
Normal push-button (no toggle button) with custom drawing.
Definition widget_type.h:104
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
PositionStatusbar
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
Definition window.cpp:3479
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:3297
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition window.cpp:1153
window_func.h
Window functions not directly related to making/drawing windows.
window_gui.h
Functions, definitions and such used only by the GUI.
WindowDefaultFlag::NoClose
@ NoClose
This window can't be interactively closed.
WindowDefaultFlag::NoFocus
@ NoFocus
This window won't get focus/make any other window lose focus when click.
WindowFlag::WhiteBorder
@ WhiteBorder
Window white border counter bit mask.
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition window_gui.h:143
WidgetID
int WidgetID
Widget ID.
Definition window_type.h:20
WC_STATUS_BAR
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
Definition window_type.h:69
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50
zoom_func.h
Functions related to zooming.