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