1 // Copyright (C) 2016-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifndef __YDFXGUISEQINIT_HXX__
22 #define __YDFXGUISEQINIT_HXX__
24 #include "ydfxwidgetsExport.hxx"
29 #include <QPushButton>
37 class YACSEvalYFXWrap;
38 class YACSEvalInputPort;
40 class YDFXGUIDoubleVectHolder
43 YDFXWIDGETS_EXPORT YDFXGUIDoubleVectHolder() { }
44 YDFXWIDGETS_EXPORT virtual bool executeScript(int& sz) = 0;
45 YDFXWIDGETS_EXPORT void applyOnInput(YACSEvalInputPort *inp) const;
47 std::vector<double> _vect;
50 class YDFXGUISeqSetterP : public QPushButton, public YDFXGUIDoubleVectHolder
54 YDFXWIDGETS_EXPORT YDFXGUISeqSetterP(QWidget *parent=0);
55 YDFXWIDGETS_EXPORT void loadState(const QString& state);
56 YDFXWIDGETS_EXPORT QString saveState() const;
57 YDFXWIDGETS_EXPORT bool executeScript(int& sz);
58 YDFXWIDGETS_EXPORT void enterEvent(QEvent *event);
59 YDFXWIDGETS_EXPORT void leaveEvent(QEvent *event);
60 YDFXWIDGETS_EXPORT void paintEvent(QPaintEvent *event);
62 YDFXWIDGETS_EXPORT void selectAFile();
64 void problemDetected(const QString& msg);
70 class YDFXGUISeqSetterT : public QTextEdit, public YDFXGUIDoubleVectHolder
74 YDFXWIDGETS_EXPORT YDFXGUISeqSetterT(QWidget *parent=0):QTextEdit(parent) { }
75 YDFXWIDGETS_EXPORT void loadState(const QString& state);
76 YDFXWIDGETS_EXPORT QString saveState() const;
77 YDFXWIDGETS_EXPORT bool executeScript(int& sz);
79 void problemDetected(const QString& msg);
82 class YDFXGUICombo : public QComboBox
85 YDFXWIDGETS_EXPORT YDFXGUICombo(QWidget *parent);
86 YDFXWIDGETS_EXPORT QString getName();
87 YDFXWIDGETS_EXPORT void enterEvent(QEvent *event);
88 YDFXWIDGETS_EXPORT void leaveEvent(QEvent *event);
89 YDFXWIDGETS_EXPORT void paintEvent(QPaintEvent *event);
94 class YDFXGUISeqSetter : public QWidget
98 YDFXWIDGETS_EXPORT YDFXGUISeqSetter(QWidget *parent, const QString& name);
99 YDFXWIDGETS_EXPORT int loadState(const QString& state);
100 YDFXWIDGETS_EXPORT QString saveState() const;
101 YDFXWIDGETS_EXPORT QSize sizeHint() const;
102 YDFXWIDGETS_EXPORT QSize minimumSizeHint() const;
103 YDFXWIDGETS_EXPORT bool checkOK(int& sz);
104 YDFXWIDGETS_EXPORT void applyOnInput(YACSEvalInputPort *inp);
106 YDFXWIDGETS_EXPORT void typeOfAssignmentChanged(int newType);
108 void problemDetected(const QString& msg);
110 YDFXGUISeqSetterT *_textEdit;
111 YDFXGUISeqSetterP *_push;
117 class YDFXGUISeqLine : public QWidget
121 YDFXWIDGETS_EXPORT YDFXGUISeqLine(QWidget *parent, YACSEvalInputPort *inp);
122 YDFXWIDGETS_EXPORT void loadState(const QMap<QString,QString>& state);
123 YDFXWIDGETS_EXPORT void saveState(QMap<QString,QString>& state) const;
124 YDFXWIDGETS_EXPORT QString getName() const;
125 YDFXWIDGETS_EXPORT int getPositionOfCombo() const;
126 YDFXWIDGETS_EXPORT bool checkOK(int& sz);
127 YDFXWIDGETS_EXPORT void connectToStatus(YDFXGUIStatus *status);
128 YDFXWIDGETS_EXPORT YDFXGUISeqSetter *setter() { return _setter; }
129 YDFXWIDGETS_EXPORT void applyOnInput();
131 void typeOfAssignmentChanged(int newType);
133 YDFXGUICombo *_combo;
134 YDFXGUISeqSetter *_setter;
135 YACSEvalInputPort *_inp;
138 class YDFXGUIStatus : public QWidget
142 YDFXWIDGETS_EXPORT YDFXGUIStatus(QWidget *parent);
143 YDFXWIDGETS_EXPORT void paintEvent(QPaintEvent *event);
144 YDFXWIDGETS_EXPORT QSize sizeHint() const;
145 YDFXWIDGETS_EXPORT QSize minimumSizeHint() const;
147 YDFXWIDGETS_EXPORT void declareOK(bool);
148 YDFXWIDGETS_EXPORT void displayInfo(const QString& txt);
150 static const char OK_STR[];
155 class YDFXGUISeqInitEff : public QWidget
159 YDFXWIDGETS_EXPORT YDFXGUISeqInitEff(QWidget *parent, YACSEvalYFXWrap *efx);
160 YDFXWIDGETS_EXPORT void loadState(const QMap<QString,QString>& state);
161 YDFXWIDGETS_EXPORT QMap<QString,QString> saveState() const;
162 YDFXWIDGETS_EXPORT void connectToStatus(YDFXGUIStatus *status);
164 YDFXWIDGETS_EXPORT void assignButtonClicked();
165 YDFXWIDGETS_EXPORT void applyOnEFX();
167 void configurationIsOK(bool);
169 bool checkConsistency(int& sz);
171 std::vector<YDFXGUISeqLine *> _lines;
174 class YDFXGUISeqInit : public QWidget
178 YDFXWIDGETS_EXPORT YDFXGUISeqInit(QWidget *parent, YACSEvalYFXWrap *efx);
179 YDFXWIDGETS_EXPORT void loadState(const QMap<QString,QString>& state);
180 YDFXWIDGETS_EXPORT QMap<QString,QString> saveState() const;
182 void assignButtonClicked();
184 YDFXGUISeqInitEff *_zeWidget;