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