InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CTreeViewMgr Class Reference
Inheritance diagram for CTreeViewMgr:
ITreeViewMgrIPMUnknown

Public Types

enum  { kAbove = 1, kBelow = -1 }
 
enum  { kNodeChangedMsgNotSet = 0, kNodeChangedMsgChangeAll = -1 }
 
- Public Types inherited from ITreeViewMgr
enum  { kDefaultIID = IID_ITREEVIEWMGR }
 
enum  ScrollWhere { eScrollToTop, eScrollToMiddle, eScrollIntoView, eScrollToShowChildren }
 

Public Member Functions

 CTreeViewMgr (IPMUnknown *boss)
 
virtual void ChangeRoot (bool16 widgetHeightIsConstant)
 
virtual void NodeAdded (const NodeID &nodeAdded)
 
virtual void NodesAdded (const NodeIDList &nodesAdded)
 
virtual void BeforeNodeDeleted (const NodeID &nodeDeleted)
 
virtual void BeforeNodesDeleted (NodeIDList &nodesDeleted)
 
virtual void NodeMoved (const NodeID &nodeMoved, const NodeID &oldParent)
 
virtual void NodeChanged (const NodeID &nodeChanged, bool16 childrenChangedAlso, int32 message=0)
 
virtual void ScrollToNode (const NodeID &nodeDeleted, ScrollWhere whereToScroll)
 
virtual bool16 IsNodeExpanded (const NodeID &nodeInQuestion) const
 
virtual bool16 IsNodeExpanded (IControlView *widget) const
 
virtual void ExpandNode (const NodeID &nodeToExpand, bool16 expandAllDescendants=kFalse)
 
virtual void CollapseNode (const NodeID &nodeToCollapse, bool16 collapseAllDescendants=kFalse)
 
virtual void HandleScroll (int32 amount, bool16 scrollVertical)
 
virtual void HandleResize ()
 
virtual void ScrollUp ()
 
virtual void ScrollDown ()
 
virtual NodeID_rv Search (const PMString &partialNodeName) const
 
virtual NodeID_rv Search (const NodeID &nodeToSearch) const
 
virtual IControlViewQueryWidgetFromNode (const NodeID &node) const
 
virtual void Purge (int32 level)
 
virtual void ClearTree (bool16 clearExpandedNodeList)
 
virtual void ReadWrite (IPMStream *s, ImplementationID prop)
 
virtual void ArrangeWidgets ()
 
virtual void RefreshSubTree (const NodeID &subTreeRoot, bool16 includeEntireHier)
 
virtual PMRect GetViewableArea ()
 
virtual PMPoint GetSizeNeededWihtoutScrollbar ()
 
void AllowPurge ()
 
void DisallowPurge ()
 
bool IsPurgeAllowed () const
 
virtual void ScrollVerticalAbsoluteAmount (int32 amount, bool16 forceRedraw=kTrue)
 

Static Public Member Functions

static int32 AboveOrBelow (ITreeViewHierarchyAdapter *adapter, const NodeID &referenceNode, const NodeID &nodeInQuestion)
 
static void PurgeMemory (int32 level, void *refPtr)
 

Protected Types

enum  ChangeType { kNodeAdded, kNodeChanged, kNodeDeleted }
 

Protected Member Functions

bool16 ExpandNodeRecurse (const NodeID &nodeToExpand, bool16 expandAllDescendants=kFalse)
 
bool16 CollapseNodeRecurse (const NodeID &nodeToCollapse, bool16 collapseAllDescendants=kFalse)
 
void PlaceWidgets ()
 
void DeselectNode (const NodeID &nodeToDeselect, ITreeViewController *controller, const ITreeViewHierarchyAdapter *adapter, bool16 notifyOfChange=kTrue)
 
virtual void ScrollHorizontal (int32 amount, bool16 forceRedraw=kTrue)
 
virtual void ScrollVertical (int32 amount, bool16 forceRedraw=kTrue)
 
virtual void AdjustTreeScrollerSize (PMPoint scrollerSize)
 
virtual PMReal AdjustScrollIncrements (WidgetID whichScrollBar, const PMReal &scrollerTop, const PMReal &scrollerBottom, const PMReal &viewSize)
 
void AdjustScrollValue (bool16 vertical=kTrue)
 
PMReal AdjustScrollerPosition ()
 
IControlViewQueryWidgetForNode (const NodeID &node)
 
IControlViewQueryCachedWidget (WidgetID typeOfWidget)
 
void AdjustHorizSize (IControlView *widget)
 
void DisposeWidget (IControlView *)
 
void DeleteWidget (IControlView *widget)
 
NodeID_rv GetNodeIDFromInterface (IControlView *widget) const
 
bool16 AncestorsAreExpanded (const NodeID &node)
 
bool16 IsAncestor (const NodeID &possibleAncestor, const NodeID &possibleDescendant) const
 
PMReal GetNewScrollerWidth (const PMReal &sizeOfChangingNode, const NodeIDList *changingNodes, ChangeType typeOfChange)
 
void ExpandToShowNode (const NodeID &scrollToNode)
 
virtual void MoveScroller (const PMPoint &moveTo)
 
TreeNodeGetTreePtrFromNodeID (const NodeID &node, bool16 buildTreeToIncludeNode=kFalse) const
 
void SetRepositionWidgetsFlag (bool16 reposition)
 
void TestTree (const NodeID &)
 
void CheckNode (const NodeID &, const char *, int32=-1) const
 
void CheckWidgetPtrs () const
 

Protected Attributes

IControlViewfTreeScrollerView
 
IControlViewfVScrollBarView
 
IControlViewfHScrollBarView
 
int32 fVThumbScrollIncrement
 

Friends

class TreeNodeTraverser
 
class TreeNodeHelper
 
class TreeNode
 
class CheckReentryUtility
 

Member Function Documentation

virtual void CTreeViewMgr::BeforeNodeDeleted (const NodeIDnodeDeleted)
virtual

This must be called before the object is actually deleted, so we can get it's size

Parameters
nodeDeleted

Implements ITreeViewMgr.

virtual void CTreeViewMgr::BeforeNodesDeleted (NodeIDListnodesDeleted)
virtual

Call this method before a collection of nodes are to be removed from the tree. This method has a K2Vector parameter that is non-const, because the nodes in this collection will be sorted after use

Parameters
nodesDeletednodes about to be deleted,
Postcondition
the nodesDeleted vector will be sorted

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ChangeRoot (bool16 widgetHeightIsConstant)
virtual

Call this method to initialize the tree, using the ITreeViewHierarchyAdapter. Call this if you want the tree to repopulate it's widgets. Node expansion will be preserved unless the root node is different. If you don't want node expansion preserved, you must call ClearTree(kTrue) before calling ChangeRoot()

Debug version of ChangeRoot() which had a test parameter has been removed. To get the Tree validation, use the test menu item Test > UI > Enable TreeView Validation to turn on TreeView debugging code. Enabling this will help you find bugs in your NodeID and ITreeViewHierarchyAdapter implementations.

Parameters
widgetHeightIsConstantif all of the widgets that will be created in your tree will have the same height, set widgetHeightIsConstant to kTrue to improve performance

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ClearTree (bool16 clearExpandedNodeList)
virtual

Call this to remove all the widgets. This is the same as calling ChangeRoot() when the TreeViewHierarchy will return nil for QueryRootNode(). It makes the tree empty and breaks the connection between the tree and it's root You need to call ChangeRoot() again for a new connection to be established. By default, the list of expanded nodes will not be cleared. To clear the list of expanded nodes, set clearExpandedNodeList to kTrue.

Implements ITreeViewMgr.

virtual void CTreeViewMgr::CollapseNode (const NodeIDnodeToCollapse,
bool16 collapseAllDescendants = kFalse 
)
virtual

Method to collapse given node and optionally collapse all the descendants

Parameters
nodeToCollapsespecifies node that is to be collapsed
collapseAllDescendantskFalse if only immediate children to be collapsed, kTrue if all descendants to be collapsed

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ExpandNode (const NodeIDnodeToExpand,
bool16 expandAllDescendants = kFalse 
)
virtual

Method to expand node and optionally all its descendants.

Parameters
nodeToExpandspecifies node that is to be expanded
expandAllDescendantskTrue if all descendants are to be expanded also, kFalse to restrict expansion to immediate children

Implements ITreeViewMgr.

virtual PMPoint CTreeViewMgr::GetSizeNeededWihtoutScrollbar ()
virtual

Returns a rectangle that specify the size needed for whole tree to draw without scrollbar

Implements ITreeViewMgr.

virtual PMRect CTreeViewMgr::GetViewableArea ()
virtual

Returns a rectangle in scroller coordinates that represents the viewable area on the scrollable canvas.

Implements ITreeViewMgr.

virtual void CTreeViewMgr::HandleResize ()
virtual

This is typically only called by the scroll bar event handler/ resize widget

Implements ITreeViewMgr.

virtual void CTreeViewMgr::HandleScroll (int32 amount,
bool16 up 
)
virtual

This is typically only called by the scroll bar event handler/ resize widget

Implements ITreeViewMgr.

virtual bool16 CTreeViewMgr::IsNodeExpanded (const NodeIDnodeInQuestion) const
virtual

Determine if given node is expanded.

Parameters
nodeInQuestionnode of interest
Returns
kTrue if node is expanded, kFalse otherwise

Implements ITreeViewMgr.

virtual bool16 CTreeViewMgr::IsNodeExpanded (IControlViewwidget) const
virtual

Determine if given node is expanded.

Parameters
widgetthe corresponding widget that is responsible for rendering a node
Returns
kTrue if node is expanded, kFalse otherwise

Implements ITreeViewMgr.

virtual void CTreeViewMgr::NodeAdded (const NodeIDnodeAdded)
virtual

This should be called after the node has been added

Parameters
nodeAdded

Implements ITreeViewMgr.

virtual void CTreeViewMgr::NodeChanged (const NodeIDnodeChanged,
bool16 childrenChangedAlso,
int32 message = 0 
)
virtual

This should only be called for a node whose height will not change. If the height could change call delete and then add

Parameters
nodeChanged
childrenChangedAlso
message

Implements ITreeViewMgr.

virtual void CTreeViewMgr::NodeMoved (const NodeIDnodeMoved,
const NodeIDoldParent 
)
virtual

This should be called when a node has moved to a new location. Do not call this if the height of the widget may have also changed. In that case, you'll have to use BeforeNodeDeleted and NodeAdded

Parameters
nodeMoved
oldParent

Implements ITreeViewMgr.

virtual void CTreeViewMgr::NodesAdded (const NodeIDListnodesAdded)
virtual

This should be called after a collection of nodes have been added

Parameters
nodesAdded

Implements ITreeViewMgr.

virtual IControlView* CTreeViewMgr::QueryWidgetFromNode (const NodeIDnode) const
virtual

Utility function to get the widget for a particular node. There is no guarantee that a widget will exist though. This call is rarely what you want. It will return nil in cases where the node in question is not visible in the tree, or when the tree has changed and the widgets have not yet been rearranged. Call NodeChanged() if you want to update data in a node. Typically, this is only called in response to mouse events.

Implements ITreeViewMgr.

virtual void CTreeViewMgr::RefreshSubTree (const NodeIDsubTreeRoot,
bool16 includeEntireHier 
)
virtual

When a subtree has changed significantly or when you aren't sure of the nodes added/removed, you can call this method to regenerate the tree below the specified node

Parameters
thenode at the top of the subtree you want refreshed
falsewill only fix up the imediate children ignoring all grandchildren

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ScrollDown ()
virtual

Would scroll down as if you had clicked in the scroll bar between the thumb and end buttons.

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ScrollToNode (const NodeIDscrollToNode,
ScrollWhere whereToScroll 
)
virtual

This allows a certain node to be scrolled into view, ancestors will be expanded to make node visible

Parameters
scrollToNode
whereToScroll

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ScrollUp ()
virtual

Would scroll up as if you had clicked in the scroll bar between the thumb and end buttons.

Implements ITreeViewMgr.

virtual void CTreeViewMgr::ScrollVerticalAbsoluteAmount (int32 amount,
bool16 forceRedraw = kTrue 
)
virtual

Scroll the tree view widget vertically with a specified amount in pixels

Implements ITreeViewMgr.

virtual NodeID_rv CTreeViewMgr::Search (const PMStringpartialNodeName) const
virtual

This method is used with typeahead to search for the first node in the tree that begins with 'partialNodeName'. TreeView must have ITreeViewTypeAhead interface for this to do anything useful

Parameters
searchthe tree for a node whose text representation starts with 'partialNodeName'
Returns
first node in the tree that begins with 'partialNodeName', or kInvalidNodeID if no match is found

Implements ITreeViewMgr.

virtual NodeID_rv CTreeViewMgr::Search (const NodeIDnodeToSearch) const
virtual

This method is used to determine if a node has been loaded in the tree widget.

Parameters
nodeToSearchsearch the tree for a node with this ID
Returns
the node, or kInvalidNodeID if no match is found

Implements ITreeViewMgr.