OpenTTD Source 20261112-master-gbcbec5e63f
network_content_gui.h
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
9
10#ifndef NETWORK_CONTENT_GUI_H
11#define NETWORK_CONTENT_GUI_H
12
13#include "network_content.h"
14#include "../window_gui.h"
15
18protected:
19 uint64_t total_bytes = 0;
20 uint64_t downloaded_bytes = 0;
21 uint total_files = 0;
23
24 uint32_t cur_id = UINT32_MAX;
25 std::string name{};
26
27public:
33
34 void Close([[maybe_unused]] int data = 0) override;
35 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override;
36 void DrawWidget(const Rect &r, WidgetID widget) const override;
37 void OnDownloadProgress(const ContentInfo &ci, int64_t bytes) override;
38};
39
41
42#endif /* NETWORK_CONTENT_GUI_H */
uint32_t cur_id
The current ID of the downloaded file.
BaseNetworkContentDownloadStatusWindow(WindowDesc &desc)
Create the window with the given description.
void OnDownloadProgress(const ContentInfo &ci, int64_t bytes) override
We have progress in the download of a file.
uint total_files
Number of files to download.
uint64_t total_bytes
Number of bytes to download.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
std::string name
The current name of the downloaded file.
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.
uint64_t downloaded_bytes
Number of bytes downloaded.
uint downloaded_files
Number of files downloaded.
#define Rect
Macro that prevents name conflicts between included headers.
Part of the network protocol handling content distribution.
void BuildContentTypeStringList()
Build array of all strings corresponding to the content types.
Callbacks for notifying others about incoming data.
Container for all important information about a piece of content.
Dimensions (a width and height) of a rectangle in 2D.
High level window description.
Definition window_gui.h:171
ResizeInfo resize
Resize information.
Definition window_gui.h:313
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition window.cpp:1879
Functions, definitions and such used only by the GUI.
int WidgetID
Widget ID.
Definition window_type.h:21