[9] | 1 | #ifndef XMLWIDGET_H
|
---|
| 2 | #define XMLWIDGET_H
|
---|
| 3 |
|
---|
| 4 | #include <QObject>
|
---|
| 5 | #include <stdint.h>
|
---|
| 6 | #include <qdom.h>
|
---|
| 7 | #include <QPalette>
|
---|
| 8 |
|
---|
| 9 | class QWidget;
|
---|
| 10 | class ConnectionLayout;
|
---|
| 11 |
|
---|
| 12 | class XmlWidget:public QObject
|
---|
| 13 | {
|
---|
| 14 | Q_OBJECT
|
---|
| 15 |
|
---|
| 16 | public:
|
---|
| 17 | XmlWidget(QString name,QString type,XmlWidget* parent);
|
---|
| 18 | ~XmlWidget();
|
---|
| 19 | QDomDocument XmlDoc(void);
|
---|
| 20 | void ParseXml(QDomElement to_parse);
|
---|
| 21 | void GetFullXml(QDomElement* doc);
|
---|
| 22 | void GetUpdateXml(QDomElement* doc);
|
---|
| 23 | void ResetAllChilds(void);
|
---|
| 24 | virtual bool IsUptodate(void){return true;};
|
---|
| 25 | void LoadXml(QDomElement to_parse);
|
---|
| 26 | void RenamedFrom(QString old_name);
|
---|
| 27 | QString Name(void);
|
---|
| 28 |
|
---|
| 29 | private:
|
---|
| 30 | QDomDocument document;
|
---|
| 31 | QDomElement write_elem;
|
---|
| 32 | XmlWidget* GetXmlWidget(QString name,QString type);
|
---|
| 33 | static void merge(QDomElement* from,QDomElement* into);
|
---|
| 34 | bool isExpandable;//true if we can receive extra frame for this widget (ex combobox, plots, layout)
|
---|
| 35 | bool isContainer;//true if it can contain other widget (ex layout), isExpandable is also true in this case
|
---|
| 36 | virtual void SetUptodate(void){};
|
---|
| 37 | virtual void Reset(void){};
|
---|
| 38 | XmlWidget* parent_widget;
|
---|
| 39 |
|
---|
| 40 | protected:
|
---|
| 41 | QList<XmlWidget*> *childs;
|
---|
| 42 | ConnectionLayout* connectionLayout(void);
|
---|
| 43 | QWidget* visible_widget;
|
---|
| 44 | QPalette red_pal,red_pal_greyed;
|
---|
| 45 | QPalette black_pal,black_pal_greyed;
|
---|
| 46 | void SetIsContainer(bool status);
|
---|
| 47 | void SetIsExpandable(bool status);
|
---|
| 48 | virtual void XmlEvent(QDomElement dom){};
|
---|
| 49 | virtual void LoadEvent(QDomElement dom){};
|
---|
| 50 | QDomElement* AddXmlChild(QString type);
|
---|
| 51 | void RemoveXmlChild(QDomElement* element);
|
---|
| 52 | void ClearDoc(void);
|
---|
| 53 | void SetValue(QString value);
|
---|
| 54 | void SetAttribute(const QString& name, const QString& value);
|
---|
| 55 | void SetAttribute(const QString& name, qlonglong value);
|
---|
| 56 | void SetAttribute(const QString& name, qulonglong value);
|
---|
| 57 | inline void SetAttribute(const QString& name, int value)
|
---|
| 58 | { SetAttribute(name, qlonglong(value)); }
|
---|
| 59 | inline void SetAttribute(const QString& name, uint value)
|
---|
| 60 | { SetAttribute(name, qulonglong(value)); }
|
---|
| 61 | void SetAttribute(const QString& name, float value);
|
---|
| 62 | void SetAttribute(const QString& name, double value);
|
---|
| 63 | void RemoveAttribute(const QString& name);
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | #endif // XMLWIDGET_H
|
---|