OpenTTD Source  13.2.1
bootstrap_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 "base_media_base.h"
12 #include "blitter/factory.hpp"
13 
14 #if defined(WITH_FREETYPE) || defined(WITH_UNISCRIBE) || defined(WITH_COCOA)
15 
16 #include "core/geometry_func.hpp"
17 #include "error.h"
18 #include "fontcache.h"
19 #include "gfx_func.h"
20 #include "network/network.h"
22 #include "openttd.h"
23 #include "strings_func.h"
24 #include "video/video_driver.hpp"
25 #include "window_func.h"
26 
28 
29 #include "table/strings.h"
30 
31 #include "safeguards.h"
32 
34 static const struct NWidgetPart _background_widgets[] = {
35  NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1),
36 };
37 
42  WDP_MANUAL, nullptr, 0, 0,
44  0,
46 );
47 
49 class BootstrapBackground : public Window {
50 public:
52  {
53  this->InitNested(0);
55  ResizeWindow(this, _screen.width, _screen.height);
56  }
57 
58  void DrawWidget(const Rect &r, int widget) const override
59  {
60  GfxFillRect(r.left, r.top, r.right, r.bottom, 4, FILLRECT_OPAQUE);
61  GfxFillRect(r.left, r.top, r.right, r.bottom, 0, FILLRECT_CHECKER);
62  }
63 };
64 
68  NWidget(WWT_CAPTION, COLOUR_GREY, WID_BEM_CAPTION), SetDataTip(STR_MISSING_GRAPHICS_ERROR_TITLE, STR_NULL),
69  EndContainer(),
70  NWidget(WWT_PANEL, COLOUR_GREY),
73  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BEM_QUIT), SetDataTip(STR_MISSING_GRAPHICS_ERROR_QUIT, STR_NULL), SetFill(1, 0),
74  EndContainer(),
75  EndContainer(),
76 };
77 
80  WDP_CENTER, nullptr, 0, 0,
82  WDF_MODAL,
84 );
85 
87 class BootstrapErrorWindow : public Window {
88 public:
90  {
91  this->InitNested(1);
92  }
93 
94  void Close() override
95  {
96  _exit_game = true;
97  this->Window::Close();
98  }
99 
100  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
101  {
102  if (widget == WID_BEM_MESSAGE) {
103  *size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR);
104  size->height = GetStringHeight(STR_MISSING_GRAPHICS_ERROR, size->width - WidgetDimensions::scaled.frametext.Horizontal()) + WidgetDimensions::scaled.frametext.Vertical();
105  }
106  }
107 
108  void DrawWidget(const Rect &r, int widget) const override
109  {
110  if (widget == WID_BEM_MESSAGE) {
111  DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_ERROR, TC_FROMSTRING, SA_CENTER);
112  }
113  }
114 
115  void OnClick(Point pt, int widget, int click_count) override
116  {
117  if (widget == WID_BEM_QUIT) {
118  _exit_game = true;
119  }
120  }
121 };
122 
125  NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
126  NWidget(WWT_PANEL, COLOUR_GREY),
128  NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
129  NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
130  EndContainer(),
131  EndContainer(),
132 };
133 
136  WDP_CENTER, nullptr, 0, 0,
138  WDF_MODAL,
140 );
141 
142 
145 public:
148  {
149  }
150 
151  void Close() override
152  {
153  /* If we are not set to exit the game, it means the bootstrap failed. */
154  if (!_exit_game) {
155  new BootstrapErrorWindow();
156  }
158  }
159 
160  void OnDownloadComplete(ContentID cid) override
161  {
162  /* We have completed downloading. We can trigger finding the right set now. */
164 
165  /* And continue going into the menu. */
166  _game_mode = GM_MENU;
167 
168  /* _exit_game is used to break out of the outer video driver's MainLoop. */
169  _exit_game = true;
170  this->Close();
171  }
172 };
173 
177  NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
178  EndContainer(),
179  NWidget(WWT_PANEL, COLOUR_GREY),
182  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL),
183  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL),
184  EndContainer(),
185  EndContainer(),
186 };
187 
190  WDP_CENTER, nullptr, 0, 0,
192  0,
194 );
195 
199 
200 public:
203  {
206  }
207 
209  void Close() override
210  {
212  this->Window::Close();
213  }
214 
215  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
216  {
217  /* We cache the button size. This is safe as no reinit can happen here. */
218  if (this->button_size.width == 0) {
219  this->button_size = maxdim(GetStringBoundingBox(STR_MISSING_GRAPHICS_YES_DOWNLOAD), GetStringBoundingBox(STR_MISSING_GRAPHICS_NO_QUIT));
220  this->button_size.width += WidgetDimensions::scaled.frametext.Horizontal();
221  this->button_size.height += WidgetDimensions::scaled.frametext.Vertical();
222  }
223 
224  switch (widget) {
225  case WID_BAFD_QUESTION:
226  /* The question is twice as wide as the buttons, and determine the height based on the width. */
227  size->width = this->button_size.width * 2;
228  size->height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size->width - WidgetDimensions::scaled.frametext.Horizontal()) + WidgetDimensions::scaled.frametext.Vertical();
229  break;
230 
231  case WID_BAFD_YES:
232  case WID_BAFD_NO:
233  *size = this->button_size;
234  break;
235  }
236  }
237 
238  void DrawWidget(const Rect &r, int widget) const override
239  {
240  if (widget != 0) return;
241 
242  DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER);
243  }
244 
245  void OnClick(Point pt, int widget, int click_count) override
246  {
247  switch (widget) {
248  case WID_BAFD_YES:
249  /* We got permission to connect! Yay! */
251  break;
252 
253  case WID_BAFD_NO:
254  _exit_game = true;
255  break;
256 
257  default:
258  break;
259  }
260  }
261 
262  void OnConnect(bool success) override
263  {
264  /* Once connected, request the metadata. */
266  }
267 
268  void OnReceiveContentInfo(const ContentInfo *ci) override
269  {
270  /* And once the meta data is received, start downloading it. */
273  this->Close();
274  }
275 };
276 
277 #endif /* defined(WITH_FREETYPE) */
278 
286 {
287  if (BaseGraphics::GetUsedSet() != nullptr) return true;
288 
289  /* No user interface, bail out with an error. */
290  if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
291 
292  /* If there is no network or no non-sprite font, then there is nothing we can do. Go straight to failure. */
293 #if (defined(_WIN32) && defined(WITH_UNISCRIBE)) || (defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(__APPLE__))) || defined(WITH_COCOA)
294  if (!_network_available) goto failure;
295 
296  /* First tell the game we're bootstrapping. */
297  _game_mode = GM_BOOTSTRAP;
298 
299  /* Initialise the font cache. */
301  /* Next "force" finding a suitable non-sprite font as the local font is missing. */
302  CheckForMissingGlyphs(false);
303 
304  /* Initialise the palette. The biggest step is 'faking' some recolour sprites.
305  * This way the mauve and gray colours work and we can show the user interface. */
306  GfxInitPalettes();
307  static const int offsets[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0x04, 0x08 };
308  for (uint i = 0; i != 16; i++) {
309  for (int j = 0; j < 8; j++) {
310  _colour_gradient[i][j] = offsets[i] + j;
311  }
312  }
313 
314  /* Finally ask the question. */
315  new BootstrapBackground();
317 
318  /* Process the user events. */
320 
321  /* _exit_game is used to get out of the video driver's main loop.
322  * In case GM_BOOTSTRAP is still set we did not exit it via the
323  * "download complete" event, so it was a manual exit. Obey it. */
324  _exit_game = _game_mode == GM_BOOTSTRAP;
325  if (_exit_game) return false;
326 
327  /* Try to probe the graphics. Should work this time. */
328  if (!BaseGraphics::SetSet({})) goto failure;
329 
330  /* Finally we can continue heading for the menu. */
331  _game_mode = GM_MENU;
332  return true;
333 #endif
334 
335  /* Failure to get enough working to get a graphics set. */
336 failure:
337  usererror("Failed to find a graphics set. Please acquire a graphics set for OpenTTD. See section 1.4 of README.md.");
338  return false;
339 }
HandleBootstrap
bool HandleBootstrap()
Handle all procedures for bootstrapping OpenTTD without a base graphics set.
Definition: bootstrap_gui.cpp:285
ContentCallback
Callbacks for notifying others about incoming data.
Definition: network_content.h:28
factory.hpp
usererror
void CDECL usererror(const char *s,...)
Error handling for fatal user errors.
Definition: openttd.cpp:105
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1143
_bootstrap_errmsg_desc
static WindowDesc _bootstrap_errmsg_desc(WDP_CENTER, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, WDF_MODAL, _nested_bootstrap_errmsg_widgets, lengthof(_nested_bootstrap_errmsg_widgets))
Window description for the error window.
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition: geometry_type.hpp:92
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
BootstrapContentDownloadStatusWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: bootstrap_gui.cpp:151
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
BootstrapErrorWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: bootstrap_gui.cpp:108
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
_bootstrap_query_desc
static WindowDesc _bootstrap_query_desc(WDP_CENTER, nullptr, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, 0, _bootstrap_query_widgets, lengthof(_bootstrap_query_widgets))
The window description for the query.
FILLRECT_CHECKER
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
Definition: gfx_type.h:294
BootstrapAskForDownloadWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: bootstrap_gui.cpp:245
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:997
WC_BOOTSTRAP
@ WC_BOOTSTRAP
Bootstrap; Window numbers:
Definition: window_type.h:637
base_media_base.h
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
BaseNetworkContentDownloadStatusWindow
Base window for showing the download status of content.
Definition: network_content_gui.h:18
_colour_gradient
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Definition: gfx.cpp:55
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1814
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:975
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1111
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:890
DrawStringMultiLine
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition: gfx.cpp:789
BootstrapAskForDownloadWindow::BootstrapAskForDownloadWindow
BootstrapAskForDownloadWindow()
Start listening to the content client events.
Definition: bootstrap_gui.cpp:202
BootstrapAskForDownloadWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: bootstrap_gui.cpp:238
BootstrapContentDownloadStatusWindow::BootstrapContentDownloadStatusWindow
BootstrapContentDownloadStatusWindow()
Simple call the constructor of the superclass.
Definition: bootstrap_gui.cpp:147
gfx_func.h
WindowDesc
High level window description.
Definition: window_gui.h:102
ClientNetworkContentSocketHandler::RequestContentList
void RequestContentList(ContentType type)
Request the content list for the given type.
Definition: network_content.cpp:190
WC_CONFIRM_POPUP_QUERY
@ WC_CONFIRM_POPUP_QUERY
Popup with confirm question; Window numbers:
Definition: window_type.h:123
_nested_bootstrap_download_status_window_widgets
static const NWidgetPart _nested_bootstrap_download_status_window_widgets[]
Nested widgets for the download window.
Definition: bootstrap_gui.cpp:124
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:251
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1804
BootstrapAskForDownloadWindow::button_size
Dimension button_size
The dimension of the button.
Definition: bootstrap_gui.cpp:198
BootstrapContentDownloadStatusWindow::OnDownloadComplete
void OnDownloadComplete(ContentID cid) override
We have finished downloading a file.
Definition: bootstrap_gui.cpp:160
WF_WHITE_BORDER
@ WF_WHITE_BORDER
Window white border counter bit mask.
Definition: window_gui.h:176
_background_desc
static WindowDesc _background_desc(WDP_MANUAL, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, 0, _background_widgets, lengthof(_background_widgets))
Window description for the background window to prevent smearing.
BootstrapAskForDownloadWindow
The window for the query.
Definition: bootstrap_gui.cpp:197
BootstrapErrorWindow
The window for a failed bootstrap.
Definition: bootstrap_gui.cpp:87
ContentInfo
Container for all important information about a piece of content.
Definition: tcp_content_type.h:50
RectPadding::Horizontal
uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition: geometry_type.hpp:59
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
BootstrapErrorWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: bootstrap_gui.cpp:115
WID_BAFD_QUESTION
@ WID_BAFD_QUESTION
The question whether to download.
Definition: bootstrap_widget.h:27
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:141
safeguards.h
Window::flags
WindowFlags flags
Window flags.
Definition: window_gui.h:239
WID_BB_BACKGROUND
@ WID_BB_BACKGROUND
Background of the window.
Definition: bootstrap_widget.h:15
WID_NCDS_PROGRESS_BAR
@ WID_NCDS_PROGRESS_BAR
Simple progress bar.
Definition: network_content_widget.h:17
WDF_MODAL
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
Definition: window_gui.h:145
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
error.h
ClientNetworkContentSocketHandler::RemoveCallback
void RemoveCallback(ContentCallback *cb)
Remove a callback.
Definition: network_content.h:145
BootstrapErrorWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: bootstrap_gui.cpp:100
stdafx.h
_bootstrap_query_widgets
static const NWidgetPart _bootstrap_query_widgets[]
The widgets for the query.
Definition: bootstrap_gui.cpp:175
_background_widgets
static const struct NWidgetPart _background_widgets[]
Widgets for the background window to prevent smearing.
Definition: bootstrap_gui.cpp:34
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition: gfx.cpp:116
RectPadding::Vertical
uint Vertical() const
Get total vertical padding of RectPadding.
Definition: geometry_type.hpp:65
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition: video_driver.hpp:202
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:38
WID_BAFD_NO
@ WID_BAFD_NO
An negative answer to the question.
Definition: bootstrap_widget.h:29
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
bootstrap_widget.h
FILLRECT_OPAQUE
@ FILLRECT_OPAQUE
Fill rectangle with a single colour.
Definition: gfx_type.h:293
GetStringHeight
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Definition: gfx.cpp:715
_network_content_client
ClientNetworkContentSocketHandler _network_content_client
The client we use to connect to the server.
Definition: network_content.cpp:35
CONTENT_TYPE_BASE_GRAPHICS
@ CONTENT_TYPE_BASE_GRAPHICS
The content consists of base graphics.
Definition: tcp_content_type.h:18
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1096
BootstrapBackground
The background for the game.
Definition: bootstrap_gui.cpp:49
strings_func.h
WID_BEM_QUIT
@ WID_BEM_QUIT
Quit button.
Definition: bootstrap_widget.h:22
WID_BEM_CAPTION
@ WID_BEM_CAPTION
Caption of the window.
Definition: bootstrap_widget.h:20
WN_CONFIRM_POPUP_QUERY_BOOTSTRAP
@ WN_CONFIRM_POPUP_QUERY_BOOTSTRAP
Query popup confirm for bootstrap.
Definition: window_type.h:26
ClientNetworkContentSocketHandler::Connect
void Connect()
Connect with the content server.
Definition: network_content.cpp:792
video_driver.hpp
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1229
geometry_func.hpp
WID_NCDS_PROGRESS_TEXT
@ WID_NCDS_PROGRESS_TEXT
Text explaining what is happening.
Definition: network_content_widget.h:18
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1014
WC_NETWORK_STATUS_WINDOW
@ WC_NETWORK_STATUS_WINDOW
Network status window; Window numbers:
Definition: window_type.h:478
ContentID
ContentID
Unique identifier for the content.
Definition: tcp_content_type.h:45
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
network_content_gui.h
BaseMedia< GraphicsSet >::FindSets
static uint FindSets()
Do the scan for files.
Definition: base_media_base.h:189
ClientNetworkContentSocketHandler::Select
void Select(ContentID cid)
Select a specific content id.
Definition: network_content.cpp:868
openttd.h
WID_BEM_MESSAGE
@ WID_BEM_MESSAGE
Error message.
Definition: bootstrap_widget.h:21
BootstrapAskForDownloadWindow::OnConnect
void OnConnect(bool success) override
Callback for when the connection has finished.
Definition: bootstrap_gui.cpp:262
BootstrapErrorWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: bootstrap_gui.cpp:94
InitializeUnicodeGlyphMap
static void InitializeUnicodeGlyphMap()
Initialize the glyph map.
Definition: fontcache.h:169
ClientNetworkContentSocketHandler::AddCallback
void AddCallback(ContentCallback *cb)
Add a callback to this class.
Definition: network_content.h:143
network.h
window_func.h
CheckForMissingGlyphs
void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
Check whether the currently loaded language pack uses characters that the currently loaded font does ...
Definition: strings.cpp:2158
WID_BAFD_YES
@ WID_BAFD_YES
An affirmative answer to the question.
Definition: bootstrap_widget.h:28
SA_CENTER
@ SA_CENTER
Center both horizontally and vertically.
Definition: gfx_type.h:344
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:386
BootstrapBackground::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: bootstrap_gui.cpp:58
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition: window_gui.h:89
VideoDriver::MainLoop
virtual void MainLoop()=0
Perform the actual drawing.
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1191
BaseNetworkContentDownloadStatusWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: network_content_gui.cpp:110
fontcache.h
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1080
Window
Data structure for an opened window.
Definition: window_gui.h:213
BaseMedia< GraphicsSet >::GetUsedSet
static const GraphicsSet * GetUsedSet()
Return the used set.
Definition: base_media_func.h:357
WidgetDimensions::frametext
RectPadding frametext
Offsets within a text frame area.
Definition: window_gui.h:48
_bootstrap_download_status_window_desc
static WindowDesc _bootstrap_download_status_window_desc(WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, _nested_bootstrap_download_status_window_widgets, lengthof(_nested_bootstrap_download_status_window_widgets))
Window description for the download window.
_network_available
bool _network_available
is network mode available?
Definition: network.cpp:60
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
ContentInfo::id
ContentID id
Unique (server side) ID for the content.
Definition: tcp_content_type.h:62
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:69
BootstrapAskForDownloadWindow::Close
void Close() override
Stop listening to the content client events.
Definition: bootstrap_gui.cpp:209
CLRBITS
#define CLRBITS(x, y)
Clears several bits in a variable.
Definition: bitmath_func.hpp:166
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition: window_gui.h:91
BootstrapContentDownloadStatusWindow
Window for showing the download status of content.
Definition: bootstrap_gui.cpp:144
_nested_bootstrap_errmsg_widgets
static const NWidgetPart _nested_bootstrap_errmsg_widgets[]
Nested widgets for the error window.
Definition: bootstrap_gui.cpp:66
BootstrapAskForDownloadWindow::OnReceiveContentInfo
void OnReceiveContentInfo(const ContentInfo *ci) override
We received a content info.
Definition: bootstrap_gui.cpp:268
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Definition: window.cpp:2088
BootstrapAskForDownloadWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: bootstrap_gui.cpp:215
Window::Close
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1107
BaseMedia< GraphicsSet >::SetSet
static bool SetSet(const std::string &name)
Set the set to be used.
Definition: base_media_func.h:228