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

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

#include <horizontal_list.hpp>

Inheritance diagram for gui2::implementation::tplacer_horizontal_list:
Inheritance graph

Public Member Functions

 tplacer_horizontal_list (const unsigned maximum_rows)
 
virtual void initialise ()
 Initialises the placer. More...
 
virtual void add_item (const tpoint &size)
 Adds a item to be placed. More...
 
virtual tpoint get_size () const
 Gets the required size of all items. More...
 
virtual tpoint get_origin (const unsigned index) const
 Gets the origin for an item. More...
 
- Public Member Functions inherited from gui2::tplacer_
virtual MAKE_ENUM(tgrow_direction,(horizontal,"horizontal")(vertical,"vertical"))
public 
~tplacer_ ()
 The direction the placer should grow towards. More...
 

Private Attributes

unsigned maximum_rows_
 The maximum number of rows to use. More...
 
std::vector< introws_
 Holds the heights of the rows. More...
 
std::vector< std::pair< int,
int > > 
columns_
 Holds the column sizes. More...
 
unsigned row_
 The row to add an item to. More...
 
unsigned column_
 The column to add an item to. More...
 

Detailed Description

The placement class for a horizontal list.

See tplacer_ for more information.

Definition at line 38 of file horizontal_list.hpp.

Constructor & Destructor Documentation

gui2::implementation::tplacer_horizontal_list::tplacer_horizontal_list ( const unsigned  maximum_rows)
explicit

Definition at line 30 of file horizontal_list.cpp.

References maximum_rows_.

Member Function Documentation

void gui2::implementation::tplacer_horizontal_list::add_item ( const tpoint size)
virtual

Adds a item to be placed.

Parameters
sizeThe required size for the item.

Implements gui2::tplacer_.

Definition at line 49 of file horizontal_list.cpp.

References column_, columns_, maximum_rows_, row_, rows_, gui2::tpoint::x, and gui2::tpoint::y.

tpoint gui2::implementation::tplacer_horizontal_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::tplacer_.

Definition at line 76 of file horizontal_list.cpp.

References columns_, maximum_rows_, and rows_.

tpoint gui2::implementation::tplacer_horizontal_list::get_size ( ) const
virtual

Gets the required size of all items.

Returns
The required size.

Implements gui2::tplacer_.

Definition at line 69 of file horizontal_list.cpp.

References columns_, and rows_.

void gui2::implementation::tplacer_horizontal_list::initialise ( )
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::tplacer_.

Definition at line 40 of file horizontal_list.cpp.

References column_, columns_, row_, and rows_.

Member Data Documentation

unsigned gui2::implementation::tplacer_horizontal_list::column_
private

The column to add an item to.

Definition at line 85 of file horizontal_list.hpp.

Referenced by add_item(), and initialise().

std::vector<std::pair<int, int> > gui2::implementation::tplacer_horizontal_list::columns_
private

Holds the column sizes.

The pair contains the following values:

  • first The origin of a column.
  • second The width of a column.

Definition at line 79 of file horizontal_list.hpp.

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

unsigned gui2::implementation::tplacer_horizontal_list::maximum_rows_
private

The maximum number of rows to use.

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

Definition at line 67 of file horizontal_list.hpp.

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

unsigned gui2::implementation::tplacer_horizontal_list::row_
private

The row to add an item to.

Definition at line 82 of file horizontal_list.hpp.

Referenced by add_item(), and initialise().

std::vector<int> gui2::implementation::tplacer_horizontal_list::rows_
private

Holds the heights of the rows.

Definition at line 70 of file horizontal_list.hpp.

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


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