Isis 3 Programmer Reference
AbstractTreeItem.h
1 #ifndef AbstractTreeItem_H
2 #define AbstractTreeItem_H
3 
4 #include <QObject>
5 
6 class QFontMetrics;
7 template< typename T > class QList;
8 class QString;
9 class QVariant;
10 
11 
12 namespace Isis {
13  class ControlPoint;
14  class ControlMeasure;
15 
31  class AbstractTreeItem : public QObject {
32 
33  Q_OBJECT
34 
35  public:
36  enum InternalPointerType {
37  None,
38  Point,
39  Measure,
40  ImageAndNet,
41  };
42 
43 
44  public:
46  virtual ~AbstractTreeItem();
47 
48  AbstractTreeItem *parent() const;
49  void setParent(AbstractTreeItem *newParent);
50 
51  int row() const;
52 
53  // These methods are designed to be implemented either by
54  // AbstractParentItem or AbstractLeafItem.
55  virtual void addChild(AbstractTreeItem *child) = 0;
56  virtual QList< AbstractTreeItem * > getChildren() const = 0;
57  virtual AbstractTreeItem *childAt(int row) const = 0;
58  virtual int childCount() const = 0;
59  virtual AbstractTreeItem *getFirstVisibleChild() const = 0;
60  virtual AbstractTreeItem *getLastVisibleChild() const = 0;
61  virtual int indexOf(AbstractTreeItem *child) const = 0;
62  virtual void setFirstVisibleChild(AbstractTreeItem *child) = 0;
63  virtual void setLastVisibleChild(AbstractTreeItem *child) = 0;
64 
65  // These methods are designed to be implemented either by
66  // AbstractPointItem, AbstractMeasureItem, AbstractSerialItem,
67  // or AbstractNullDataItem.
68  virtual QVariant getData() const = 0;
69  virtual QVariant getData(QString columnTitle) const = 0;
70  virtual void setData(QString const &columnTitle,
71  QString const &newData) = 0;
72  virtual bool isDataEditable(QString columnTitle) const = 0;
73  virtual void deleteSource() = 0;
74  virtual InternalPointerType getPointerType() const = 0;
75  virtual void *getPointer() const = 0;
76 
77  // There are things that every AbstractTreeItem can do.
78  virtual QString getFormattedData() const;
79  virtual QString getFormattedData(QString columnTitle) const;
80 
81  virtual bool hasMeasure(ControlMeasure *) const;
82  virtual bool hasImage(QString imageSerial) const;
83  virtual bool hasPoint(ControlPoint *) const;
84 
85  virtual AbstractTreeItem *getNextVisiblePeer() const;
86  virtual void setNextVisiblePeer(AbstractTreeItem *next);
87 
88  virtual void setExpanded(bool newState);
89  virtual bool isExpanded() const;
90 
91  virtual void setSelected(bool newState);
92  virtual void setSelectable(bool newSelectable);
93  virtual bool isSelected() const;
94  virtual bool isSelectable() const;
95 
96  virtual void setVisible(bool newState);
97  virtual bool isVisible() const;
98 
99  virtual int getDataWidth() const;
100  virtual int getDepth() const;
101 
102  virtual void setLastVisibleFilteredItem(AbstractTreeItem *item);
103  virtual const AbstractTreeItem *getLastVisibleFilteredItem() const;
104 
105  protected slots:
106  virtual void sourceDeleted() = 0;
107 
108  protected:
109  virtual void calcDataWidth(int avgCharWidth);
110  static double catchNull(QString);
111  static QString catchNull(QVariant);
112 
113 
114  // disable copying of this class
115  private:
117  AbstractTreeItem &operator=(AbstractTreeItem const &);
118 
119 
120  private:
121  AbstractTreeItem *m_nextVisibleItem;
122  AbstractTreeItem *m_parentItem;
123  bool m_expanded;
124  bool m_selectable;
125  bool m_selected;
126  bool m_visible;
127  int m_dataWidth;
128  };
129 }
130 
131 #endif
A single control point.
Definition: ControlPoint.h:369
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
a control measurement
Base class for an item in the tree.