The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
walker_tree_node.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 
20 
21 namespace gui2
22 {
23 
24 class tree_view_node;
25 
26 namespace iteration
27 {
28 
29 /** A walker for a @ref gui2::tree_view_node. */
30 class tree_node : public walker_base
31 {
32 public:
33  /**
34  * Constructor.
35  *
36  * @param node The tree view node which the walker is attached to.
37  * @param children The node's children.
38  */
40 
41  /** Inherited from @ref gui2::iteration::walker_base. */
42  virtual state_t next(const level level);
43 
44  /** Inherited from @ref gui2::iteration::walker_base. */
45  virtual bool at_end(const level level) const;
46 
47  /** Inherited from @ref gui2::iteration::walker_base. */
48  virtual gui2::widget* get(const level level);
49 
50 private:
51  /** The children of the node which the walker is attached to. */
53 
54  /**
55  * The node which the walker is attached to.
56  *
57  * This variable is used to track whether the @ref
58  * gui2::iteration::walker_base::widget level has been visited.
59  */
61 
62  /**
63  * The iterator to the children of @ref node_.
64  *
65  * This variable is used to track where the @ref
66  * gui2::iteration::walker_base::child level visiting is.
67  */
69 };
70 
71 } // namespace iteration
72 
73 } // namespace gui2
std::vector< std::unique_ptr< tree_view_node >> node_children_vector
level
The level to walk at.
Definition: walker.hpp:34
Base class for all widgets.
Definition: widget.hpp:48
tree_node(gui2::tree_view_node &node, tree_view_node::node_children_vector &children)
Constructor.
Generic file dialog.
Definition: field-fwd.hpp:22
gui2::widget * widget_
The node which the walker is attached to.
A walker for a gui2::tree_view_node.
state_t
The state of the walker.
Definition: walker.hpp:48
The walker abstract base class.
Definition: walker.hpp:26
virtual state_t next(const level level)
Inherited from gui2::iteration::walker_base.
virtual bool at_end(const level level) const
Inherited from gui2::iteration::walker_base.
tree_view_node::node_children_vector & children_
The children of the node which the walker is attached to.
std::string::const_iterator iterator
Definition: tokenizer.hpp:24
tree_view_node::node_children_vector::iterator itor_
The iterator to the children of node_.