The Battle for Wesnoth  1.17.0-dev
walker_grid.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 #include "gui/widgets/grid.hpp"
21 
22 namespace gui2
23 {
24 
25 namespace iteration
26 {
27 
28 /** A walker for a @ref gui2::grid. */
29 class grid : public walker_base
30 {
31 public:
32  /**
33  * Constructor.
34  *
35  * @param grid The grid which the walker is attached to.
36  */
37  explicit grid(gui2::grid& grid);
38 
39  /** Inherited from @ref gui2::iteration::walker_base. */
40  virtual state_t next(const level level);
41 
42  /** Inherited from @ref gui2::iteration::walker_base. */
43  virtual bool at_end(const level level) const;
44 
45  /** Inherited from @ref gui2::iteration::walker_base. */
46  virtual gui2::widget* get(const level level);
47 
48 private:
49  /** The grid which the walker is attached to. */
51 
52  /**
53  * The grid which the walker is attached to.
54  *
55  * This variable is used to track whether the
56  * gui2::iteration::walker_base::widget level has been visited.
57  */
59 
60  /**
61  * The iterator to the children of @ref grid_.
62  *
63  * This variable is used to track where the
64  * gui2::iteration::walker_base::child level visiting is.
65  */
67 };
68 
69 } // namespace iteration
70 
71 } // namespace gui2
virtual bool at_end(const level level) const
Inherited from gui2::iteration::walker_base.
Definition: walker_grid.cpp:60
gui2::grid & grid_
The grid which the walker is attached to.
Definition: walker_grid.hpp:50
level
The level to walk at.
Definition: walker.hpp:35
Base class for all widgets.
Definition: widget.hpp:49
Generic file dialog.
Definition: field-fwd.hpp:23
Base container class.
Definition: grid.hpp:31
gui2::widget * widget_
The grid which the walker is attached to.
Definition: walker_grid.hpp:58
state_t
The state of the walker.
Definition: walker.hpp:49
gui2::grid::iterator itor_
The iterator to the children of grid_.
Definition: walker_grid.hpp:66
The walker abstract base class.
Definition: walker.hpp:27
Iterator for the child items.
Definition: grid.hpp:441
A walker for a gui2::grid.
Definition: walker_grid.hpp:29
virtual state_t next(const level level)
Inherited from gui2::iteration::walker_base.
Definition: walker_grid.cpp:33
grid(gui2::grid &grid)
Constructor.
Definition: walker_grid.cpp:28