NetworkContentDownloadStatusWindow Struct Reference

Window for showing the download status of content. More...

Inheritance diagram for NetworkContentDownloadStatusWindow:
Window ContentCallback ZeroedMemoryAllocator

Public Member Functions

 NetworkContentDownloadStatusWindow ()
 Create a new download window based on a list of content information with flags whether to download them or not.
 ~NetworkContentDownloadStatusWindow ()
 Free whatever we've allocated.
virtual void DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
virtual void OnClick (Point pt, int widget, int click_count)
 A click with the left mouse button has been made on the window.
virtual void OnDownloadProgress (const ContentInfo *ci, uint bytes)
 We have progress in the download of a file.

Private Attributes

ClientNetworkContentSocketHandlerconnection
 Our connection with the content server.
SmallVector< ContentType, 4 > receivedTypes
 Types we received so we can update their cache.
uint total_files
 Number of files to download.
uint downloaded_files
 Number of files downloaded.
uint total_bytes
 Number of bytes to download.
uint downloaded_bytes
 Number of bytes downloaded.
uint32 cur_id
 The current ID of the downloaded file.
char name [48]
 The current name of the downloaded file.

Detailed Description

Window for showing the download status of content.

Definition at line 57 of file network_content_gui.cpp.


Constructor & Destructor Documentation

NetworkContentDownloadStatusWindow::NetworkContentDownloadStatusWindow (  )  [inline]

Create a new download window based on a list of content information with flags whether to download them or not.

Parameters:
infos the list to search in

Definition at line 76 of file network_content_gui.cpp.

References _network_content_download_status_window_desc, ClientNetworkContentSocketHandler::AddCallback(), FindWindowById(), Window::InitNested(), Window::parent, total_bytes, and total_files.


Member Function Documentation

virtual void NetworkContentDownloadStatusWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]

Draw the contents of a nested widget.

Parameters:
r Rectangle occupied by the widget.
widget Number of the widget to draw.
Note:
This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 141 of file network_content_gui.cpp.

References downloaded_bytes, downloaded_files, DrawFrameRect(), DrawString(), DrawStringMultiLine(), FONT_HEIGHT_NORMAL, name, NCDSWW_BACKGROUND, SA_CENTER, SA_HOR_CENTER, SetDParam(), SetDParamStr(), StrEmpty(), total_bytes, and total_files.

virtual void NetworkContentDownloadStatusWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]

A click with the left mouse button has been made on the window.

Parameters:
pt the point inside the window that has been clicked.
widget the clicked widget.
click_count Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 170 of file network_content_gui.cpp.

References ClientNetworkContentSocketHandler::Close(), downloaded_bytes, NCDSWW_CANCELOK, and total_bytes.

virtual void NetworkContentDownloadStatusWindow::OnDownloadProgress ( const ContentInfo ci,
uint  bytes 
) [inline, virtual]

We have progress in the download of a file.

Parameters:
ci the content info of the file
bytes the number of bytes downloaded since the previous call

Reimplemented from ContentCallback.

Definition at line 178 of file network_content_gui.cpp.

References cur_id, downloaded_bytes, downloaded_files, ContentInfo::filename, ContentInfo::id, SmallVector< T, S >::Include(), lastof, name, NCDSWW_CANCELOK, receivedTypes, Window::SetDirty(), strecpy(), total_bytes, and ContentInfo::type.


The documentation for this struct was generated from the following file:

Generated on Fri Mar 4 21:38:03 2011 for OpenTTD by  doxygen 1.6.1