USGS

Isis 3.0 Object Programmers' Reference

Home

ControlDisplayProperties.h
Go to the documentation of this file.
1 #ifndef ControlDisplayProperties_H
2 #define ControlDisplayProperties_H
3 
26 #include <QObject>
27 #include <QMetaType> // required since we're adding to QVariant
28 #include <QColor> // This is required since QColor is in a slot
29 
30 #include "DisplayProperties.h"
31 #include "XmlStackedHandler.h"
32 
33 class QAction;
34 class QXmlStreamWriter;
35 
36 namespace Isis {
37  class FileName;
38  class Project;
39  class Pvl;
40  class PvlObject;
41  class XmlStackedHandlerReader;
42 
74  Q_OBJECT
75  public:
79  enum Property {
81  None = 0,
83  Color = 1,
85  Selected = 2,
87  ShowLabel = 16,
88  };
89 
90 
91  ControlDisplayProperties(QString displayName, QObject *parent = NULL);
92  ControlDisplayProperties(XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
93  virtual ~ControlDisplayProperties();
94 
95 // void fromPvl(const PvlObject &pvl);
96 // PvlObject toPvl() const;
97 
98  void addSupport(Property prop);
99  bool supports(Property prop);
100 
101  QVariant getValue(Property prop) const;
102 
103  static QColor randomColor();
104 
105  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
106 
107  signals:
108  void propertyChanged(ControlDisplayProperties *);
109  void supportAdded(Property);
110 
111  public slots:
112  void setColor(QColor newColor);
113  void setShowLabel(bool);
114  void setSelected(bool);
115 
116  private slots:
117  void toggleShowLabel();
118 
119  private:
125  class XmlHandler : public XmlStackedHandler {
126  public:
127  XmlHandler(ControlDisplayProperties *displayProperties);
128 
129  virtual bool startElement(const QString &namespaceURI, const QString &localName,
130  const QString &qName, const QXmlAttributes &atts);
131 
132  virtual bool characters(const QString &ch);
133 
134  virtual bool endElement(const QString &namespaceURI, const QString &localName,
135  const QString &qName);
136 
137  private:
138  Q_DISABLE_COPY(XmlHandler);
139 
140  ControlDisplayProperties *m_displayProperties;
141  QString m_hexData;
142  };
143 
144  private:
147 
148  void setValue(Property prop, QVariant value);
150 
157 
163  };
164 }
165 
167 
168 #endif
169