InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CTreeBasedListBoxController.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Tom Taylor
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 __CTreeBasedListBoxController__
25 #define __CTreeBasedListBoxController__
26 
27 #ifdef ID_DEPRECATED // listboxes will disappear from a future version of InDesign. Please use TreeViews instead.
28 
29 #include "IPMUnknown.h"
30 #include "IListBoxController.h"
31 #include "NodeID.h"
32 #include "HelperInterface.h"
33 #include "IEvent.h"
34 
35 #ifdef WIDGET_BUILD
36 #endif
37 
38 class CTreeBasedListBoxController : public IListBoxController
39 {
40 public:
41  CTreeBasedListBoxController(IPMUnknown* boss);
42  virtual ~CTreeBasedListBoxController();
43 
44  // ----- ListBox Use -----
45 
46  virtual void SetClickItem(int32 itemNumber);
47  // set the item number of the last item clicked on
48  virtual int32 GetClickItem() const;
49  // return the item number of the last item clicked, or -1 for no item
50  virtual int32 Search(const PMString& subString) const;
51  // Search first looks through all the items of the list looking for
52  // an item that has a name that begins with "subString." If such an
53  // item is found, the index of the item is returned. If no item is found,
54  // this function then looks for an item that has a name that *contains*
55  // "subString." If such an item is found, the index of the item is
56  // returned. If no item is found, Search returns -1.
57  virtual PMString GetNthItemString(int32 n) const;
58  // Given a list index, return the name of it. Used by Search function for typeahead.
59  // By default returns empty string, so typeahead if off by default.
60 
61  virtual void Select(int32 index, bool16 invalidate, bool16 notifyOfChange);
62  virtual void SelectAll(bool16 invalidate, bool16 notifyOfChange);
63  virtual void Deselect(int32 index, bool16 invalidate, bool16 notifyOfChange);
64  virtual void DeselectAll(bool16 invalidate, bool16 notifyOfChange);
65  virtual bool16 IsSelected(int32 index) const;
66  virtual int32 GetSelected() const;
67  virtual void GetSelected(K2Vector<int32>& multipleSelection) const;
68 
69  virtual void SetMasterItem(int32 itemNumber);
70  virtual int32 GetMasterItem() const;
71 
72  // ----- ListBox Use -----
73 
74  virtual int32 FindRowHit(const PMPoint& clickPoint);
75  // Give a point, FindRowHit returns the list row under the point
76 
77  virtual eListBoxPart ClickedWhichPart(const PMPoint& clickPoint);
78 
79  virtual eScrollDirection CheckScrollDirection(eScrollDirection direction);
80  virtual eScrollDirection CheckDragScroll(const PMPoint& where);
81 
82  virtual void GetVisibleItemBounds(int32 item, PMRect& newBounds);
83 
84  virtual void ScrollList(const eScrollDirection direction);
85  virtual void ScrollItemIntoView(int32 itemNumber);
86 
87  virtual int32 GetFirstVisibleItem() const;
88  virtual int32 GetMaximumVisibleItems() const;
89  virtual void SetSelected( const K2Vector<int32>& vecIndices, bool16 bInvalidate = kTrue, bool16 bNotify = kTrue );
90  virtual void ProcessSelectionRules(IEvent* event, int32 index);
91 
92  virtual void GetCheckedItems(K2Vector<int32>& checkedItems) const;
93  virtual void SetCheckedItems( const K2Vector<int32>& vecIndices, bool16 bInvalidate = kTrue, bool16 bNotify = kTrue);
94 
95 protected:
96  virtual void NotifyOfChange(bool16 invalidate, bool16 notifyOfChange, int32 changeMessage);
97  virtual bool16 IsMultiselect(void);
98  virtual NodeID_rv GetNodeID(int32 index) const;
99  virtual bool16 GetListBoxMetrics(
100  PMRect &bounds,
101  PMRect &visibleRect,
102  int32 &numItems,
103  int32 &numVisible,
104  bool16 includePartiallyVisible,
105  int32 &topIndex,
106  int32 &cellWidth,
107  int32 &cellHeight
108  ) const;
109 private:
110  int32 fClickItem;
111  int32 fMasterItem;
112 
113 
114 };
115 
116 
117 #endif
118 
119 #endif