The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
mp::gamebrowser Class Reference

#include <multiplayer_lobby.hpp>

Inheritance diagram for mp::gamebrowser:
Inheritance graph

Classes

struct  game_item
 

Public Member Functions

 gamebrowser (CVideo &video, const config &map_hashes)
 
void scroll (unsigned int pos)
 
void handle_event (const SDL_Event &event)
 
void set_inner_location (const SDL_Rect &rect)
 
void set_item_height (unsigned int height)
 
void populate_game_item (game_item &, const config &, const config &, const std::vector< std::string > &)
 
void populate_game_item_campaign_or_scenario_info (game_item &, const config &, const config &, bool &)
 
void populate_game_item_map_info (game_item &, const config &, const config &, bool &)
 
void populate_game_item_era_info (game_item &, const config &, const config &, bool &)
 
void populate_game_item_mod_info (game_item &, const config &, const config &, bool &)
 
void populate_game_item_addons_installed (game_item &, const config &, const std::vector< std::string > &)
 
void set_game_items (const config &cfg, const config &game_config, const std::vector< std::string > &installed_addons)
 
void draw ()
 
void draw_contents ()
 
void draw_row (const size_t row_index, const SDL_Rect &rect, ROW_TYPE type)
 
SDL_Rect get_item_rect (size_t index) const
 
bool empty () const
 
bool selection_is_joinable () const
 
bool selection_is_observable () const
 
bool selection_needs_content () const
 
bool selection_needs_addons () const
 
bool selection_in_joinable_state () const
 
bool selection_in_observable_state () const
 
ADDON_REQ selection_addon_outcome () const
 
const std::vector
< required_addon > * 
selection_addon_requirements () const
 
bool selected () const
 
void reset_selection ()
 
int selection () const
 
game_item selected_game ()
 
void select_game (const std::string &id)
 
bool game_matches_filter (const game_item &i, const config &cfg)
 
- Public Member Functions inherited from gui::menu
 menu (CVideo &video, const std::vector< std::string > &items, bool click_selects=false, int max_height=-1, int max_width=-1, const sorter *sorter_obj=nullptr, style *menu_style=nullptr, const bool auto_join=true)
 
 ~menu ()
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
int selection () const
 
void move_selection (size_t id)
 
void move_selection_keeping_viewport (size_t id)
 
void reset_selection ()
 
const itemget_item (int index) const
 
const itemget_selected_item () const
 
void change_item (int pos1, int pos2, const std::string &str)
 
virtual void erase_item (size_t index)
 
void set_heading (const std::vector< std::string > &heading)
 
virtual void set_items (const std::vector< std::string > &items, bool strip_spaces=true, bool keep_viewport=false)
 Set new items to show and redraw/recalculate everything. More...
 
void set_max_height (const int new_max_height)
 Set a new max height for this menu. More...
 
void set_max_width (const int new_max_width)
 
int get_max_height ()
 
int get_max_width ()
 
size_t number_of_items () const
 
int process ()
 
bool double_clicked ()
 
void set_click_selects (bool value)
 
void set_numeric_keypress_selection (bool value)
 
void scroll (unsigned int pos)
 
void set_sorter (sorter *s)
 
void sort_by (int column)
 
int get_sort_by ()
 
bool get_sort_reversed ()
 
- Public Member Functions inherited from gui::scrollarea
 scrollarea (CVideo &video, bool auto_join=true)
 Create a zone with automatic handling of scrollbar. More...
 
virtual void hide (bool value=true)
 
- Public Member Functions inherited from gui::widget
SDL_Rect const & location () const
 
virtual void set_location (SDL_Rect const &rect)
 
void set_location (int x, int y)
 
void set_width (int w)
 
void set_height (int h)
 
void set_measurements (int w, int h)
 
int width () const
 
int height () const
 
bool focus (const SDL_Event *event)
 
void set_focus (bool focus)
 
bool hidden () const
 
virtual void enable (bool new_val=true)
 
bool enabled () const
 
void set_clip_rect (const SDL_Rect &rect)
 
void set_volatile (bool val=true)
 
void set_dirty (bool dirty=true)
 
bool dirty () const
 
const std::stringid () const
 
void set_id (const std::string &id)
 
void set_help_string (const std::string &str)
 
void set_tooltip_string (const std::string &str)
 
virtual void process_tooltip_string (int mousex, int mousey)
 
- Public Member Functions inherited from events::sdl_handler
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 

Protected Member Functions

unsigned int row_height () const
 
- Protected Member Functions inherited from gui::menu
bool item_ends_with_image (const std::string &item) const
 
void set_inner_location (const SDL_Rect &rect)
 
bool requires_event_focus (const SDL_Event *event=nullptr) const
 
const std::vector< int > & column_widths () const
 
int hit (int x, int y) const
 
std::pair< int, inthit_cell (int x, int y) const
 
int hit_column (int x) const
 
int hit_heading (int x, int y) const
 
void invalidate_row (size_t id)
 
void invalidate_row_pos (size_t pos)
 
void invalidate_heading ()
 
- Protected Member Functions inherited from gui::scrollarea
virtual sdl_handler_vector handler_members ()
 
virtual void update_location (SDL_Rect const &rect)
 
virtual void process_event ()
 
SDL_Rect inner_location () const
 
unsigned scrollbar_width () const
 
unsigned get_position () const
 
unsigned get_max_position () const
 
void set_position (unsigned pos)
 
void adjust_position (unsigned pos)
 
void move_position (int dep)
 
void set_shown_size (unsigned h)
 
void set_full_size (unsigned h)
 
void set_scroll_rate (unsigned r)
 
bool has_scrollbar () const
 
- Protected Member Functions inherited from gui::widget
 widget (widget const &o)
 
 widget (CVideo &video, const bool auto_join=true)
 
virtual ~widget ()
 
void bg_register (SDL_Rect const &rect)
 
void bg_restore () const
 
void bg_restore (SDL_Rect const &rect) const
 
void bg_update ()
 
void bg_cancel ()
 
CVideovideo () const
 
const SDL_Rect * clip_rect () const
 
virtual sdl_handler_vector member_handlers ()
 
virtual void handle_window_event (SDL_Event const &event)
 
bool mouse_locked () const
 
void aquire_mouse_lock ()
 
void free_mouse_lock ()
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 

Private Attributes

image::locator gold_icon_locator_
 
image::locator xp_icon_locator_
 
image::locator map_size_icon_locator_
 
image::locator vision_icon_locator_
 
image::locator time_limit_icon_locator_
 
image::locator observer_icon_locator_
 
image::locator no_observer_icon_locator_
 
image::locator shuffle_sides_icon_locator_
 
const configmap_hashes_
 
unsigned int item_height_
 
int margin_
 
int minimap_size_
 
int h_padding_
 
int h_padding_image_to_text_
 
int header_height_
 
size_t selected_
 
std::pair< size_t, size_t > visible_range_
 
std::vector< game_itemgames_
 
std::vector< size_t > redraw_items_
 
std::vector< intwidths_
 
bool double_clicked_
 
bool ignore_next_doubleclick_
 
bool last_was_doubleclick_
 

Additional Inherited Members

- Public Types inherited from gui::menu
enum  ROW_TYPE { NORMAL_ROW, SELECTED_ROW, HEADING_ROW }
 
- Static Public Attributes inherited from gui::menu
static styledefault_style = menu::bluebg_style
 
static style simple_style
 
static imgsel_style bluebg_style
 
- Protected Attributes inherited from gui::menu
stylestyle_
 
bool silent_
 
- Protected Attributes inherited from gui::widget
bool focus_
 

Detailed Description

Definition at line 45 of file multiplayer_lobby.hpp.

Constructor & Destructor Documentation

mp::gamebrowser::gamebrowser ( CVideo video,
const config map_hashes 
)

Definition at line 65 of file multiplayer_lobby.cpp.

References gui::menu::set_numeric_keypress_selection().

Member Function Documentation

void mp::gamebrowser::draw ( )
virtual
void mp::gamebrowser::draw_contents ( )
virtual
void mp::gamebrowser::draw_row ( const size_t  row_index,
const SDL_Rect &  rect,
ROW_TYPE  type 
)
virtual

Reimplemented from gui::menu.

Definition at line 151 of file multiplayer_lobby.cpp.

References _(), mp::gamebrowser::game_item::addons_outcome, font::BAD_COLOR, CVideo::blit_surface(), font::DISABLED_COLOR, mp::gamebrowser::game_item::era_and_mod_info, games_, image::get_image(), font::get_rendered_text(), mp::gamebrowser::game_item::gold, gold_icon_locator_, font::GOOD_COLOR, font::GRAY_COLOR, h_padding_, h_padding_image_to_text_, mp::gamebrowser::game_item::have_all_mods, mp::gamebrowser::game_item::have_era, mp::gamebrowser::game_item::have_scenario, font::make_text_ellipsis(), mp::gamebrowser::game_item::map_data, mp::gamebrowser::game_item::map_info, mp::gamebrowser::game_item::map_info_size, map_size_icon_locator_, margin_, mp::gamebrowser::game_item::mini_map, minimap_size_, mp::gamebrowser::game_item::name, mp::NEED_DOWNLOAD, no_observer_icon_locator_, font::NORMAL_COLOR, observer_icon_locator_, mp::gamebrowser::game_item::observers, mp::gamebrowser::game_item::reloaded, mp::SATISFIED, mp::gamebrowser::game_item::shuffle_sides, shuffle_sides_icon_locator_, font::SIZE_NORMAL, font::SIZE_PLUS, mp::gamebrowser::game_item::started, mp::gamebrowser::game_item::status, mp::gamebrowser::game_item::time_limit, time_limit_icon_locator_, mp::gamebrowser::game_item::use_map_settings, mp::gamebrowser::game_item::vacant_slots, mp::gamebrowser::game_item::verified, gui::widget::video(), mp::gamebrowser::game_item::vision, vision_icon_locator_, mp::gamebrowser::game_item::xp, xp_icon_locator_, and font::YELLOW_COLOR.

bool mp::gamebrowser::empty ( ) const
inline
bool mp::gamebrowser::game_matches_filter ( const game_item i,
const config cfg 
)
SDL_Rect mp::gamebrowser::get_item_rect ( size_t  index) const
void mp::gamebrowser::handle_event ( const SDL_Event &  event)
virtual
void mp::gamebrowser::populate_game_item ( gamebrowser::game_item item,
const config game,
const config game_config,
const std::vector< std::string > &  installed_addons 
)
void mp::gamebrowser::populate_game_item_addons_installed ( gamebrowser::game_item item,
const config game,
const std::vector< std::string > &  installed_addons 
)
void mp::gamebrowser::populate_game_item_campaign_or_scenario_info ( gamebrowser::game_item item,
const config game,
const config game_config,
bool &  verified 
)
void mp::gamebrowser::populate_game_item_era_info ( gamebrowser::game_item item,
const config game,
const config game_config,
bool &  verified 
)
void mp::gamebrowser::populate_game_item_map_info ( gamebrowser::game_item item,
const config game,
const config game_config,
bool &  verified 
)
void mp::gamebrowser::populate_game_item_mod_info ( gamebrowser::game_item item,
const config game,
const config game_config,
bool &  verified 
)
void mp::gamebrowser::reset_selection ( )
inline

Definition at line 151 of file multiplayer_lobby.hpp.

References double_clicked_.

Referenced by mp::lobby::process_event_impl().

unsigned int mp::gamebrowser::row_height ( ) const
inlineprotected
void mp::gamebrowser::scroll ( unsigned int  pos)
virtual
void mp::gamebrowser::select_game ( const std::string id)
bool mp::gamebrowser::selected ( ) const
inline

Definition at line 150 of file multiplayer_lobby.hpp.

References double_clicked_, and empty().

Referenced by mp::lobby::process_event_impl().

game_item mp::gamebrowser::selected_game ( )
inline

Definition at line 153 of file multiplayer_lobby.hpp.

References games_, and selected_.

Referenced by mp::lobby::process_event_impl(), and set_game_items().

int mp::gamebrowser::selection ( ) const
inline

Definition at line 152 of file multiplayer_lobby.hpp.

References selected_.

Referenced by mp::lobby::process_event_impl().

ADDON_REQ mp::gamebrowser::selection_addon_outcome ( ) const
inline

Definition at line 146 of file multiplayer_lobby.hpp.

References empty(), games_, mp::SATISFIED, and selected_.

Referenced by mp::lobby::process_event_impl().

const std::vector<required_addon>* mp::gamebrowser::selection_addon_requirements ( ) const
inline

Definition at line 148 of file multiplayer_lobby.hpp.

References empty(), games_, and selected_.

Referenced by mp::lobby::process_event_impl().

bool mp::gamebrowser::selection_in_joinable_state ( ) const
inline

Definition at line 140 of file multiplayer_lobby.hpp.

References empty(), games_, and selected_.

Referenced by selection_is_joinable().

bool mp::gamebrowser::selection_in_observable_state ( ) const
inline

Definition at line 143 of file multiplayer_lobby.hpp.

References empty(), games_, preferences::is_authenticated(), and selected_.

Referenced by selection_is_observable().

bool mp::gamebrowser::selection_is_joinable ( ) const
inline
bool mp::gamebrowser::selection_is_observable ( ) const
inline
bool mp::gamebrowser::selection_needs_addons ( ) const
inline
bool mp::gamebrowser::selection_needs_content ( ) const
inline

Definition at line 134 of file multiplayer_lobby.hpp.

References empty(), games_, and selected_.

Referenced by selection_is_joinable(), and selection_is_observable().

void mp::gamebrowser::set_game_items ( const config cfg,
const config game_config,
const std::vector< std::string > &  installed_addons 
)
void mp::gamebrowser::set_inner_location ( const SDL_Rect &  rect)
virtual
void mp::gamebrowser::set_item_height ( unsigned int  height)

Member Data Documentation

bool mp::gamebrowser::double_clicked_
private

Definition at line 182 of file multiplayer_lobby.hpp.

Referenced by handle_event(), reset_selection(), and selected().

std::vector<game_item> mp::gamebrowser::games_
private
image::locator mp::gamebrowser::gold_icon_locator_
private

Definition at line 160 of file multiplayer_lobby.hpp.

Referenced by draw_row().

int mp::gamebrowser::h_padding_
private

Definition at line 174 of file multiplayer_lobby.hpp.

Referenced by draw_row().

int mp::gamebrowser::h_padding_image_to_text_
private

Definition at line 175 of file multiplayer_lobby.hpp.

Referenced by draw_row().

int mp::gamebrowser::header_height_
private

Definition at line 176 of file multiplayer_lobby.hpp.

bool mp::gamebrowser::ignore_next_doubleclick_
private

Definition at line 183 of file multiplayer_lobby.hpp.

Referenced by handle_event().

unsigned int mp::gamebrowser::item_height_
private

Definition at line 171 of file multiplayer_lobby.hpp.

Referenced by row_height(), and set_game_items().

bool mp::gamebrowser::last_was_doubleclick_
private

Definition at line 184 of file multiplayer_lobby.hpp.

Referenced by handle_event().

const config& mp::gamebrowser::map_hashes_
private

Definition at line 169 of file multiplayer_lobby.hpp.

Referenced by populate_game_item_campaign_or_scenario_info().

image::locator mp::gamebrowser::map_size_icon_locator_
private

Definition at line 162 of file multiplayer_lobby.hpp.

Referenced by draw_row().

int mp::gamebrowser::margin_
private

Definition at line 172 of file multiplayer_lobby.hpp.

Referenced by draw_contents(), and draw_row().

int mp::gamebrowser::minimap_size_
private

Definition at line 173 of file multiplayer_lobby.hpp.

Referenced by draw_row(), and populate_game_item_map_info().

image::locator mp::gamebrowser::no_observer_icon_locator_
private

Definition at line 166 of file multiplayer_lobby.hpp.

Referenced by draw_row().

image::locator mp::gamebrowser::observer_icon_locator_
private

Definition at line 165 of file multiplayer_lobby.hpp.

Referenced by draw_row().

std::vector<size_t> mp::gamebrowser::redraw_items_
private

Definition at line 180 of file multiplayer_lobby.hpp.

size_t mp::gamebrowser::selected_
private
image::locator mp::gamebrowser::shuffle_sides_icon_locator_
private

Definition at line 167 of file multiplayer_lobby.hpp.

Referenced by draw_row().

image::locator mp::gamebrowser::time_limit_icon_locator_
private

Definition at line 164 of file multiplayer_lobby.hpp.

Referenced by draw_row().

std::pair<size_t, size_t> mp::gamebrowser::visible_range_
private
image::locator mp::gamebrowser::vision_icon_locator_
private

Definition at line 163 of file multiplayer_lobby.hpp.

Referenced by draw_row().

std::vector<int> mp::gamebrowser::widths_
private

Definition at line 181 of file multiplayer_lobby.hpp.

image::locator mp::gamebrowser::xp_icon_locator_
private

Definition at line 161 of file multiplayer_lobby.hpp.

Referenced by draw_row().


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