33 int get_policy()
const;
35 bool stop_on_success()
const;
37 bool stop_on_failure()
const;
39 void set_policy(
int _policy);
41 int get_focused_child()
const;
43 void set_focused_child(
int _focused_child);
45 bool get_active()
const;
47 void set_active(
bool _active);
53 node* n =
dynamic_cast<node*
>(instance);
67 pinstance->set_focused_child(i);
80 virtual bool on_enter_node(
base_ptr b);
82 virtual bool on_leave_node(
base_ptr b);
84 virtual bool on_enter_children(
group_ptr g);
86 virtual bool on_leave_children(
group_ptr g);
88 virtual bool on_enter_parent(
node_ptr n);
90 virtual bool on_leave_parent(
node_ptr n);
106 std::string visit_order;
107 bool stop_if_not_implemented;
109 template <
typename TCH>
110 bool traverse_tmp_1(
base_ptr dest,
base_ptr src,
bool& force_termination, TCH& tch);
112 template <
typename TCH>
117 const std::string& _visit_order =
"pnc",
119 bool _stop_if_not_implemented =
false);
131 #include <cgv/config/lib_end.h>
unsigned int get_nr_children() const
return the number of children
Definition: group.cxx:31
virtual data::ref_ptr< group, true > get_group()
cast upward to group
Definition: base.cxx:55
@ TP_STOP_ON_FAILURE
this is an optional flag for traversals with methods that return a bool. If the returned bool is true...
Definition: traverser.h:19
traverser & set_strategy(TraverseStrategy _strategy)
set a different traverse strategy
class used to traverse a tree structure
Definition: traverser.h:102
traverser & set_visit_order(const std::string &_visit_order)
set a different visiting order of node, children and parent
nodes should inherit from this policy class to allow selective tree traversals
Definition: traverser.h:24
@ TP_FIRST_FOCUS
traverse only the focused child
Definition: traverser.h:16
bool grab_focus(X *instance)
try to grab the focus in the path of this node to the root of the tree
Definition: traverser.h:52
bool empty() const
check if pointer is not yet set
Definition: ref_ptr.h:230
TraverseStrategy
not yet implemented
Definition: traverser.h:95
node_ptr get_parent() const
return the parent node
Definition: node.cxx:13
@ TP_STOP_ON_SUCCESS
like previous but change focus to the child, where traversal succeeded
Definition: traverser.h:18
base_ptr get_child(unsigned int i) const
return the i-th child
Definition: group.cxx:37
interface of a handler for traverse callbacks
Definition: traverser.h:77
T * get_interface()
use dynamic type cast to check for the given interface
Definition: base.h:95
TraversePolicy
different traversal policies
Definition: traverser.h:13
@ TP_ONLY_FOCUS
traverse all children
Definition: traverser.h:15
the cgv namespace
Definition: vr_calib.cxx:9
@ TP_AUTO_FOCUS
first traverse focused and then the remaining children
Definition: traverser.h:17