The Battle for Wesnoth  1.19.28+dev
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::lobby_player_list_helper Class Reference

#include <lobby_player_list_helper.hpp>

Classes

struct  sub_list
 

Public Member Functions

void init (window &w)
 
void update (const std::vector< mp::user_info > &user_info, int focused_game)
 Updates the tree contents based on the given user data. More...
 
 lobby_player_list_helper (decltype(user_callback) ucb, decltype(game_select_callback) gscb)
 
const mp::user_info * get_selected_info () const
 

Private Member Functions

void selected_node_changed ()
 Connected to the tree's modified signal; forwards to game_select_callback when a player is selected. More...
 

Private Attributes

std::array< sub_list, 3 > player_lists
 Main subsections of the player tree. More...
 
tree_view * tree
 The parent tree. More...
 
std::function< void(const mp::user_info *)> user_callback
 The double click callback bound to each player's tree node. More...
 
std::function< void(const mp::user_info *)> game_select_callback
 Called with the newly-selected player when the tree's selection changes to one. More...
 
std::map< const tree_view_node *, const mp::user_info * > info_map
 Node-to-info mappings for easy access. More...
 

Detailed Description

Definition at line 35 of file lobby_player_list_helper.hpp.

Constructor & Destructor Documentation

◆ lobby_player_list_helper()

gui2::lobby_player_list_helper::lobby_player_list_helper ( decltype(user_callback)  ucb,
decltype(game_select_callback)  gscb 
)
inline

Definition at line 75 of file lobby_player_list_helper.hpp.

Member Function Documentation

◆ get_selected_info()

const mp::user_info * gui2::lobby_player_list_helper::get_selected_info ( ) const

◆ init()

void gui2::lobby_player_list_helper::init ( window &  w)

◆ selected_node_changed()

void gui2::lobby_player_list_helper::selected_node_changed ( )
private

Connected to the tree's modified signal; forwards to game_select_callback when a player is selected.

Definition at line 186 of file lobby_player_list_helper.cpp.

References game_select_callback, info_map, gui2::tree_view::selected_item(), and tree.

Referenced by init().

◆ update()

void gui2::lobby_player_list_helper::update ( const std::vector< mp::user_info > &  user_info,
int  focused_game 
)

Member Data Documentation

◆ game_select_callback

std::function<void(const mp::user_info*)> gui2::lobby_player_list_helper::game_select_callback
private

Called with the newly-selected player when the tree's selection changes to one.

Definition at line 66 of file lobby_player_list_helper.hpp.

Referenced by selected_node_changed().

◆ info_map

std::map<const tree_view_node*, const mp::user_info*> gui2::lobby_player_list_helper::info_map
private

Node-to-info mappings for easy access.

Definition at line 69 of file lobby_player_list_helper.hpp.

Referenced by get_selected_info(), selected_node_changed(), and update().

◆ player_lists

std::array<sub_list, 3> gui2::lobby_player_list_helper::player_lists
private

Main subsections of the player tree.

This should never change at runtime so the number is hardcoded.

Definition at line 57 of file lobby_player_list_helper.hpp.

Referenced by init(), and update().

◆ tree

tree_view* gui2::lobby_player_list_helper::tree
private

The parent tree.

Definition at line 60 of file lobby_player_list_helper.hpp.

Referenced by get_selected_info(), init(), selected_node_changed(), and update().

◆ user_callback

std::function<void(const mp::user_info*)> gui2::lobby_player_list_helper::user_callback
private

The double click callback bound to each player's tree node.

Definition at line 63 of file lobby_player_list_helper.hpp.

Referenced by update().


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