24 #ifndef __CTreeViewMgr_h__ 25 #define __CTreeViewMgr_h__ 28 #include "ITreeViewMgr.h" 29 #include "IControlView.h" 32 #include "KeyValuePair.h" 50 virtual void ChangeRoot( bool16 widgetHeightIsConstant );
57 virtual void NodeChanged(
const NodeID& nodeChanged, bool16 childrenChangedAlso, int32 message = 0 );
62 virtual void ExpandNode(
const NodeID& nodeToExpand, bool16 expandAllDescendants = kFalse );
63 virtual void CollapseNode(
const NodeID& nodeToCollapse, bool16 collapseAllDescendants = kFalse );
65 virtual void HandleScroll( int32 amount, bool16 scrollVertical );
76 virtual void Purge(int32 level);
78 virtual void ClearTree(bool16 clearExpandedNodeList);
81 enum { kAbove = 1, kBelow = -1 };
83 static void PurgeMemory(int32 level,
void *refPtr);
84 virtual void ArrangeWidgets();
89 enum { kNodeChangedMsgNotSet = 0, kNodeChangedMsgChangeAll = -1 };
95 bool IsPurgeAllowed()
const 96 {
return (fAllowPurge == 0); }
99 bool16 ExpandNodeRecurse(
const NodeID& nodeToExpand, bool16 expandAllDescendants = kFalse);
100 bool16 CollapseNodeRecurse(
const NodeID& nodeToCollapse, bool16 collapseAllDescendants = kFalse );
101 void PlaceWidgets( );
104 virtual void ScrollHorizontal( int32 amount, bool16 forceRedraw = kTrue );
105 virtual void ScrollVertical( int32 amount, bool16 forceRedraw = kTrue );
106 virtual void AdjustTreeScrollerSize(
PMPoint scrollerSize );
108 void AdjustScrollValue(bool16 vertical = kTrue);
109 PMReal AdjustScrollerPosition( );
117 bool16 AncestorsAreExpanded(
const NodeID& node);
118 bool16 IsAncestor(
const NodeID& possibleAncestor,
const NodeID& possibleDescendant)
const;
119 typedef enum { kNodeAdded, kNodeChanged, kNodeDeleted } ChangeType;
120 PMReal GetNewScrollerWidth(
const PMReal& sizeOfChangingNode,
const NodeIDList* changingNodes, ChangeType typeOfChange );
121 void ExpandToShowNode(
const NodeID& scrollToNode );
122 virtual void MoveScroller(
const PMPoint& moveTo );
124 TreeNode* GetTreePtrFromNodeID(
const NodeID& node, bool16 buildTreeToIncludeNode = kFalse )
const;
125 void SetRepositionWidgetsFlag( bool16 reposition );
128 void TestTree(
const NodeID& node);
129 void CheckNode(
const NodeID& node,
const char *calledFrom, int32 i = -1)
const;
131 inline void TestTree(
const NodeID& ) {}
132 inline void CheckNode(
const NodeID& ,
const char *, int32 = -1)
const {}
136 void CheckWidgetPtrs( )
const;
138 inline void CheckWidgetPtrs( )
const {}
145 int32 fVThumbScrollIncrement;
151 bool16 fDisplayRootNode;
155 bool16 fRepositionWidgetsFlag;
156 bool16 fSomeNodesChangedFlag;
157 bool16 fDirtyScrollerSize;
158 bool16 fCheckForReentry;
172 TreeNode(
const NodeID& nodeID);
174 TreeNode(
IPMStream* stream, TreeNode* parent );
176 void Delete( bool16 deselect = kTrue );
178 TreeNode* AddChild( int32 childIndex,
const NodeID& node, bool16 ignoreExpandedState = kFalse);
179 void AddChild( int32 childIndex, TreeNode* node );
181 TreeNode* RemoveChild( int32 childIndex );
182 TreeNode* GetParent( )
const {
return fParent; }
186 bool16 IsExpanded()
const {
return fFlags & kExpanded; }
188 enum { kInvalidSize = -1 };
189 virtual const PMPoint& GetSize()
const;
190 const PMPoint& GetFamilySize()
const;
191 void DirtyFamilySize();
193 const PMReal& GetIndent()
const;
194 void SetIndent(
const PMReal& newIndent) { fIndent = newIndent; }
196 void PlaceWidgets(
const PMRect& viewableArea );
198 PMReal GetVerticalPosition( )
const;
200 void ClearWidgets( bool16 recursive = kFalse);
201 void RemoveFromLookup( bool16 recursive = kFalse );
203 bool16 HasSubTree()
const {
return fChildren.size() > 0; }
205 const NodeID& GetNodeID()
const {
return fNodeID; }
206 void ReconcileTreeChanges( bool16 includeEntireHier = kTrue );
208 void DirtyWidgetData(int32 messageToWidgetMgr = kNodeChangedMsgNotSet);
209 void RecursiveDirtyWidgetData( int32 messageToWidgetMgr = kNodeChangedMsgNotSet );
210 bool16 IsWidgetDataDirty()
const {
return fFlags & kDirtyWidgetData; }
211 void ReapplyWidgetData( );
214 void CheckWidgetPtrs( )
const;
224 enum { kExpanded = 1, kDirtyFamilySize = 2, kDirtyWidgetData = 4, kDirtySize = 8 };
225 mutable int16 fFlags;
235 class RootTreeNode :
public TreeNode
241 const PMPoint& GetSize()
const;
242 CTreeViewMgr* GetTreeViewMgr()
const {
return fTreeViewMgr; }
251 friend class CheckReentryUtility;
254 mutable std::map<NodeID, TreeNode*> fNodeToTreeLookup;