The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
walker_grid.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2017 by Mark de Wever <koraq@xs4all.nl>
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 #pragma once
16 
18 
19 #include "gui/widgets/grid.hpp"
20 
21 namespace gui2
22 {
23 
24 namespace iteration
25 {
26 
27 /** A walker for a @ref gui2::grid. */
28 class grid : public walker_base
29 {
30 public:
31  /**
32  * Constructor.
33  *
34  * @param grid The grid which the walker is attached to.
35  */
36  explicit grid(gui2::grid& grid);
37 
38  /** Inherited from @ref gui2::iteration::walker_base. */
39  virtual state_t next(const level level);
40 
41  /** Inherited from @ref gui2::iteration::walker_base. */
42  virtual bool at_end(const level level) const;
43 
44  /** Inherited from @ref gui2::iteration::walker_base. */
45  virtual gui2::widget* get(const level level);
46 
47 private:
48  /** The grid which the walker is attached to. */
50 
51  /**
52  * The grid which the walker is attached to.
53  *
54  * This variable is used to track whether the @ref
55  * gui2::iteration::walker_base::widget level has been visited.
56  */
58 
59  /**
60  * The iterator to the children of @ref grid_.
61  *
62  * This variable is used to track where the @ref
63  * gui2::iteration::walker_base::child level visiting is.
64  */
66 };
67 
68 } // namespace iteration
69 
70 } // namespace gui2
gui2::grid & grid_
The grid which the walker is attached to.
Definition: walker_grid.hpp:49
level
The level to walk at.
Definition: walker.hpp:34
Base class for all widgets.
Definition: widget.hpp:48
Generic file dialog.
Definition: text.hpp:37
Base container class.
Definition: grid.hpp:28
virtual bool at_end(const level level) const
Inherited from gui2::iteration::walker_base.
Definition: walker_grid.cpp:59
gui2::widget * widget_
The grid which the walker is attached to.
Definition: walker_grid.hpp:57
state_t
The state of the walker.
Definition: walker.hpp:48
gui2::grid::iterator itor_
The iterator to the children of grid_.
Definition: walker_grid.hpp:65
The walker abstract base class.
Definition: walker.hpp:26
Iterator for the child items.
Definition: grid.hpp:450
A walker for a gui2::grid.
Definition: walker_grid.hpp:28
virtual state_t next(const level level)
Inherited from gui2::iteration::walker_base.
Definition: walker_grid.cpp:32
grid(gui2::grid &grid)
Constructor.
Definition: walker_grid.cpp:27