InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TreeNodeTraverser.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Matt Joss
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __TreeNodeTraverser__
25 #define __TreeNodeTraverser__
26 
27 #include "ITreeViewMgr.h"
28 #include "K2Stack.h"
29 #include "K2Vector.h"
30 #include "NodeID.h"
31 
32 class ITreeViewMgr;
33 
34 // This is a help class used by the TreeNodeTraverser class. It really has no use on its own.
36 {
37  public:
38  typedef base_type data_type;
39  TreeNodeHelper(const ITreeViewMgr* treeMgr, const NodeID& node, bool16 expandedNodesOnly, bool16 reverse = kFalse, int32 index = -1);
40  ~TreeNodeHelper();
41 
42  NodeID GetNextNode(const ITreeViewMgr* treeMgr);
43  const NodeID& GetNode() const;
44 
45  private:
46  NodeID fNode;
47  int32 fIndex;
48  bool16 fReverse;
49  bool16 fExpandedOnly;
50 };
51 
52 
53 //========================================================================================
54 // CLASS TreeNodeTraverser
55 //========================================================================================
56 
78 {
79 // ----- Constructors/desctructors
80 public:
81  enum Direction { eForward, eReverse };
82 
90  TreeNodeTraverser(const NodeID& from, const ITreeViewMgr* treeMgr, bool16 expandedNodesOnly, Direction direction = eForward);
94  virtual ~TreeNodeTraverser();
95 
102  virtual NodeID Next();
103 
112  virtual bool16 Completed() const;
113 
114  private:
115  void ClearStack();
116 
117  NodeID fCurrentNode;
118  bool16 fExpandedNodesOnly;
119  Direction fDirection;
121  const ITreeViewMgr* fTreeMgr;
122 };
123 
124 
125 #endif