The Battle for Wesnoth  1.19.0-dev
walker_scrollbar_container.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2024
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 
21 
22 namespace gui2::iteration
23 {
24 
25 /** A walker for a @ref gui2::container_base. */
27 {
28 public:
29  /**
30  * Constructor.
31  *
32  * @param container The grid which the walker is attached to.
33  */
35 
36  /** Inherited from @ref gui2::iteration::walker_base. */
37  virtual state_t next(const level level);
38 
39  /** Inherited from @ref gui2::iteration::walker_base. */
40  virtual bool at_end(const level level) const;
41 
42  /** Inherited from @ref gui2::iteration::walker_base. */
43  virtual gui2::widget* get(const level level);
44 
45 private:
46  /** The container which the walker is attached to. */
48 
49  /**
50  * The widget which the walker is attached to.
51  *
52  * This variable is used to track whether the
53  * gui2::iteration::walker_base::widget level has been visited.
54  */
56 
57  /**
58  * Whether the grid has been yielded
59  *
60  * This variable is used to track whether the
61  * gui2::iteration::walker_base::internal level has been visited.
62  */
63  bool entered_grid = false, in_grid = false, entered_children = false;
64 
65  /**
66  * The iterator to the children of @ref container_.
67  *
68  * This variable is used to track where the
69  * gui2::iteration::walker_base::child level and
70  * gui2::iteration::walker_base::internal level visiting is.
71  */
73 };
74 
75 } // namespace gui2::iteration
Iterator for the child items.
Definition: grid.hpp:438
A walker for a gui2::container_base.
A walker for a gui2::container_base.
virtual state_t next(const level level)
Inherited from gui2::iteration::walker_base.
gui2::grid::iterator itor_
The iterator to the children of container_.
virtual bool at_end(const level level) const
Inherited from gui2::iteration::walker_base.
virtual gui2::widget * get(const level level)
Inherited from gui2::iteration::walker_base.
gui2::widget * widget_
The widget which the walker is attached to.
scrollbar_container(gui2::scrollbar_container &container)
Constructor.
bool entered_grid
Whether the grid has been yielded.
gui2::scrollbar_container & container_
The container which the walker is attached to.
The walker abstract base class.
Definition: walker.hpp:28
level
The level to walk at.
Definition: walker.hpp:35
state_t
The state of the walker.
Definition: walker.hpp:49
Base class for creating containers with one or two scrollbar(s).
Base class for all widgets.
Definition: widget.hpp:53