Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

NetworkContentListWindow Class Reference

Window that lists the content that's at the content server. More...

Inheritance diagram for NetworkContentListWindow:
Window ContentCallback ZeroedMemoryAllocator

Public Member Functions

 NetworkContentListWindow (WindowDesc *desc, bool select_all)
 Create the content list window.
 ~NetworkContentListWindow ()
 Free everything we allocated.
virtual void UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
virtual void DrawWidget (const Rect &r, int widget) const
virtual void OnPaint ()
void DrawMatrix (const Rect &r) const
 Draw/fill the matrix with the list of content to download.
void DrawDetails (const Rect &r) const
 Helper function to draw the details part of this window.
virtual void OnClick (Point pt, int widget, int click_count)
virtual EventState OnKeyPress (WChar key, uint16 keycode)
virtual void OnEditboxChanged (int wid)
virtual void OnResize ()
virtual void OnReceiveContentInfo (const ContentInfo *rci)
 We received a content info.
virtual void OnDownloadComplete (ContentID cid)
 We have finished downloading a file.
virtual void OnConnect (bool success)
 Callback for when the connection has finished.
virtual void OnInvalidateData (int data=0, bool gui_scope=true)
 Some data on this window has become invalid.

Private Types

typedef GUIList< const
ContentInfo *, StringFilter & > 
GUIContentList
 List with content infos.

Private Member Functions

void OpenExternalSearch ()
 Search external websites for content.
void BuildContentList ()
 (Re)build the network game list as its amount has changed because an item has been added or deleted for example
void SortContentList ()
 Sort the content list.
void FilterContentList ()
 Filter the content list.
void ScrollToSelected ()
 Make sure that the currently selected content info is within the visible part of the matrix.

Static Private Member Functions

static void ExternalSearchDisclaimerCallback (Window *w, bool accepted)
 Callback function for disclaimer about entering external websites.
static int CDECL NameSorter (const ContentInfo *const *a, const ContentInfo *const *b)
 Sort content by name.
static int CDECL TypeSorter (const ContentInfo *const *a, const ContentInfo *const *b)
 Sort content by type.
static int CDECL StateSorter (const ContentInfo *const *a, const ContentInfo *const *b)
 Sort content by state.
static bool CDECL TagNameFilter (const ContentInfo *const *a, StringFilter &filter)
 Filter content by tags/name.

Private Attributes

GUIContentList content
 List with content.
bool auto_select
 Automatically select all content when the meta-data becomes available.
StringFilter string_filter
 Filter for content list.
QueryString filter_editbox
 Filter editbox;.
const ContentInfoselected
 The selected content info.
int list_pos
 Our position in the list.
uint filesize_sum
 The sum of all selected file sizes.
Scrollbarvscroll
 Cache of the vertical scrollbar.

Static Private Attributes

static const uint EDITBOX_MAX_SIZE = 50
 Maximum size of the editbox in characters.
static Listing last_sorting = {false, 1}
 The last sorting setting.
static Filtering last_filtering = {false, 0}
 The last filtering setting.
static
GUIContentList::SortFunction
*const 
sorter_funcs []
 Sorter functions.
static
GUIContentList::FilterFunction
*const 
filter_funcs []
 Filter functions.

Detailed Description

Window that lists the content that's at the content server.

Definition at line 284 of file network_content_gui.cpp.


Member Typedef Documentation

List with content infos.

Definition at line 286 of file network_content_gui.cpp.


Constructor & Destructor Documentation


Member Function Documentation

static int CDECL NetworkContentListWindow::NameSorter ( const ContentInfo *const *  a,
const ContentInfo *const *  b 
) [inline, static, private]

Sort content by name.

Definition at line 391 of file network_content_gui.cpp.

References strnatcmp().

Referenced by TypeSorter().

virtual void NetworkContentListWindow::OnConnect ( bool  success  )  [inline, virtual]

Callback for when the connection has finished.

Parameters:
success whether the connection was made or that we failed to make it

Reimplemented from ContentCallback.

Definition at line 890 of file network_content_gui.cpp.

References INVALID_STRING_ID, Window::InvalidateData(), ShowErrorMessage(), and WL_ERROR.

virtual void NetworkContentListWindow::OnDownloadComplete ( ContentID  cid  )  [inline, virtual]

We have finished downloading a file.

Parameters:
cid the ContentID of the downloaded file

Reimplemented from ContentCallback.

Definition at line 884 of file network_content_gui.cpp.

References content, GUIList< T, F >::ForceResort(), and Window::InvalidateData().

virtual void NetworkContentListWindow::OnInvalidateData ( int  data = 0,
bool  gui_scope = true 
) [inline, virtual]
virtual void NetworkContentListWindow::OnReceiveContentInfo ( const ContentInfo ci  )  [inline, virtual]
static int CDECL NetworkContentListWindow::StateSorter ( const ContentInfo *const *  a,
const ContentInfo *const *  b 
) [inline, static, private]

Sort content by state.

Definition at line 412 of file network_content_gui.cpp.

References TypeSorter().

static int CDECL NetworkContentListWindow::TypeSorter ( const ContentInfo *const *  a,
const ContentInfo *const *  b 
) [inline, static, private]

Sort content by type.

Definition at line 397 of file network_content_gui.cpp.

References CONTENT_TYPE_BASE_GRAPHICS, lastof, NameSorter(), and strnatcmp().

Referenced by StateSorter().


Field Documentation

Initial value:
 {
  &TagNameFilter,
}

Filter functions.

Definition at line 293 of file network_content_gui.cpp.

Referenced by NetworkContentListWindow().

Initial value:
 {
  &StateSorter,
  &TypeSorter,
  &NameSorter,
}

Sorter functions.

Definition at line 292 of file network_content_gui.cpp.

Referenced by NetworkContentListWindow().


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