The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
gui2::implementation::placer_vertical_list Class Reference

The placement class for a vertical list. More...

#include <vertical_list.hpp>

Inheritance diagram for gui2::implementation::placer_vertical_list:

Public Member Functions

 placer_vertical_list (const unsigned maximum_columns)
 
virtual void initialize ()
 Initialises the placer. More...
 
virtual void add_item (const point &size)
 Adds a item to be placed. More...
 
virtual point get_size () const
 Gets the required size of all items. More...
 
virtual point get_origin (const unsigned index) const
 Gets the origin for an item. More...
 
- Public Member Functions inherited from gui2::placer_base
virtual ~placer_base ()
 

Private Attributes

unsigned maximum_columns_
 The maximum number of columns to use. More...
 
std::vector< std::pair< int, int > > rows_
 Holds the row sizes. More...
 
std::vector< int > columns_
 Holds the widths of the columns. More...
 
unsigned row_
 The row to add an item to. More...
 
unsigned column_
 The column to add an item to. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from gui2::placer_base
static placer_basebuild (const grow_direction::type grow_dir, const unsigned parallel_items)
 Builder function. More...
 

Detailed Description

The placement class for a vertical list.

See placer_base for more information.

Definition at line 38 of file vertical_list.hpp.

Constructor & Destructor Documentation

◆ placer_vertical_list()

gui2::implementation::placer_vertical_list::placer_vertical_list ( const unsigned  maximum_columns)
explicit

Definition at line 31 of file vertical_list.cpp.

References maximum_columns_.

Member Function Documentation

◆ add_item()

void gui2::implementation::placer_vertical_list::add_item ( const point size)
virtual

Adds a item to be placed.

Parameters
sizeThe required size for the item.

Implements gui2::placer_base.

Definition at line 50 of file vertical_list.cpp.

References column_, columns_, maximum_columns_, row_, rows_, and utf8::size().

◆ get_origin()

point gui2::implementation::placer_vertical_list::get_origin ( const unsigned  index) const
virtual

Gets the origin for an item.

Parameters
indexThe index of the item whose origin to return. The index is the index of the call to add_item().
Returns
The origin where to place the widget.

Implements gui2::placer_base.

Definition at line 77 of file vertical_list.cpp.

References columns_, utf8::index(), maximum_columns_, draw::point(), and rows_.

◆ get_size()

point gui2::implementation::placer_vertical_list::get_size ( ) const
virtual

Gets the required size of all items.

Returns
The required size.

Implements gui2::placer_base.

Definition at line 70 of file vertical_list.cpp.

References columns_, draw::point(), and rows_.

◆ initialize()

void gui2::implementation::placer_vertical_list::initialize ( )
virtual

Initialises the placer.

When the placement needs to be calculated the state often needs to be reset, items are placed, removed or changed visibility causing the old placement to be invalid.

Implements gui2::placer_base.

Definition at line 41 of file vertical_list.cpp.

References column_, columns_, draw::fill(), row_, and rows_.

Member Data Documentation

◆ column_

unsigned gui2::implementation::placer_vertical_list::column_
private

The column to add an item to.

Definition at line 84 of file vertical_list.hpp.

Referenced by add_item(), and initialize().

◆ columns_

std::vector<int> gui2::implementation::placer_vertical_list::columns_
private

Holds the widths of the columns.

Definition at line 78 of file vertical_list.hpp.

Referenced by add_item(), get_origin(), get_size(), and initialize().

◆ maximum_columns_

unsigned gui2::implementation::placer_vertical_list::maximum_columns_
private

The maximum number of columns to use.

This value is determined by the parallel_items parameter of placer_base::build).

Definition at line 66 of file vertical_list.hpp.

Referenced by add_item(), get_origin(), and placer_vertical_list().

◆ row_

unsigned gui2::implementation::placer_vertical_list::row_
private

The row to add an item to.

Definition at line 81 of file vertical_list.hpp.

Referenced by add_item(), and initialize().

◆ rows_

std::vector<std::pair<int, int> > gui2::implementation::placer_vertical_list::rows_
private

Holds the row sizes.

The pair contains the following values:

  • first The origin of a row.
  • second The height of a row.

Definition at line 75 of file vertical_list.hpp.

Referenced by add_item(), get_origin(), get_size(), and initialize().


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