The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
vertical_list.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * Placement helper for the vertical list.
18  */
19 
20 #ifndef GUI_AUXILIARY_PLACER_VERTICAL_LIST_HPP_INCLUDED
21 #define GUI_AUXILIARY_PLACER_VERTICAL_LIST_HPP_INCLUDED
22 
23 #include "gui/core/placer.hpp"
24 
25 #include <vector>
26 
27 namespace gui2
28 {
29 
30 namespace implementation
31 {
32 
33 /**
34  * The placement class for a vertical list.
35  *
36  * See @ref tplacer_ for more information.
37  */
39 {
40 public:
41  /***** ***** Constructor, destructor, assignment. ***** *****/
42 
43  explicit tplacer_vertical_list(const unsigned maximum_columns);
44 
45 
46  /***** ***** Inherited operations. ***** *****/
47 
48  virtual void initialise();
49 
50  virtual void add_item(const tpoint& size);
51 
52  virtual tpoint get_size() const;
53 
54  virtual tpoint get_origin(const unsigned index) const;
55 
56 
57  /***** ***** Members. ***** *****/
58 
59 private:
60  /**
61  * The maximum number of columns to use.
62  *
63  * This value is determined by the @p parallel_items parameter of
64  * @ref tplacer_::build).
65  */
66  unsigned maximum_columns_;
67 
68  /**
69  * Holds the row sizes
70  *
71  * The pair contains the following values:
72  * * first The origin of a row.
73  * * second The height of a row.
74  */
75  std::vector<std::pair<int, int> > rows_;
76 
77  /** Holds the widths of the columns. */
78  std::vector<int> columns_;
79 
80  /** The row to add an item to. */
81  unsigned row_;
82 
83  /** The column to add an item to. */
84  unsigned column_;
85 };
86 
87 } // namespace implementation
88 
89 } // namespace gui2
90 
91 #endif
virtual tpoint get_origin(const unsigned index) const
Gets the origin for an item.
Base class for the placement helper.
tplacer_vertical_list(const unsigned maximum_columns)
std::vector< int > columns_
Holds the widths of the columns.
Base class for the placement helper.
Definition: placer.hpp:52
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
virtual tpoint get_size() const
Gets the required size of all items.
unsigned maximum_columns_
The maximum number of columns to use.
GLuint index
Definition: glew.h:1782
Holds a 2D point.
Definition: point.hpp:24
The placement class for a vertical list.
std::vector< std::pair< int, int > > rows_
Holds the row sizes.
unsigned row_
The row to add an item to.
GLsizeiptr size
Definition: glew.h:1649
virtual void initialise()
Initialises the placer.
virtual void add_item(const tpoint &size)
Adds a item to be placed.
unsigned column_
The column to add an item to.
Contains the implementation details for lexical_cast and shouldn't be used directly.