InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CTreeViewController.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 __CTreeViewController__
25 #define __CTreeViewController__
26 
27 #include "ITreeViewController.h"
28 #include "HelperInterface.h"
29 #include "K2Vector.h"
30 #include "PMPoint.h"
31 #include "CTreeViewMgr.h"
32 #include "NodeID.h"
33 
34 //----------------------------------------------------------------------------------------
35 // Class Info
36 //----------------------------------------------------------------------------------------
37 
38 //----------------------------------------------------------------------------------------
39 // Class CTreeViewController
40 //----------------------------------------------------------------------------------------
42 {
43 public:
46 
47  enum { eAllowNoSelection = 0, eAllowSingleSelection = 1, eAllowMultipleSelection };
48 
49  // ----- Item selection -----
50  virtual void ProcessSelectionRules(IEvent* event, UID node,bool16 notifyOfChange);
51  // Handles a click on the given node to determine how it affects the selection
52 
53  virtual void DeselectAll( bool16 notifyOfChange = kTrue, bool16 changeHilite = kTrue );
54  // Deselect all elements.
55 
56  virtual SelectCode Select( const NodeID& node, bool16 notifyOfChange = kTrue, bool16 changeHilite = kTrue );
57  // Select the element at the given position in the list.
58  virtual void Deselect( const NodeID& node, bool16 notifyOfChange = kTrue, bool16 changeHilite = kTrue );
59  // Deselect the element at the given position in the list.
60 
61  virtual bool16 AllowsSelection( ) const;
62  // returns kTrue if this tree allows nodes to be selected
63  // returns kFalse if no nodes are selectable
64 
65  virtual NodeID GetMasterItem() const { return fFirstSelected; }
66 
67  void ReadWrite(IPMStream *s, ImplementationID prop);
68 protected:
69  virtual void NotifyOfChange(bool16 notifyOfChange, int32 changeMessage);
70  virtual void ChangeHilite( const NodeID& nodeToHilite, bool16 hilite );
71 
72 
73 
74  // Override these functions if you hold the selection in something other than
75  // fSelectedNodes and fFirstSelected. XMLStructureTVController is an example of this.
76 
77  // This will add or remove the given node from the selection
78  virtual void UpdateSelection(const NodeID&, bool16 select);
79 
80  // This will deselect all
81  virtual void ClearSelection(bool8 notifyOfSelectionChange = true);
82  virtual bool16 IsSelected( const NodeID& item ) const;
83  // Return true if the item with index is selected.
84  // selectedItems is sorted
85  virtual void GetSelectedItems( NodeIDList& selectedItems) const;
86 
87  virtual void GetSelectedItemsDisplayOrder( NodeIDList& selectedItems) const;
88 
89  virtual bool16 IgnoreIfNodeIsSelected() const { return kTrue; }
90 
91 
92 protected:
93  NodeIDList fSelectedNodes; // sorted list by NodeID
94  NodeID fFirstSelected;
95  int16 fNumSelectableItems;
96  bool16 fAllowMultipleParents;
97  bool16 fAllowDiscontiguousSelection;
98 
99 
100 
101 };
102 
103 #endif //__CTreeViewController__