Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SALOMEAPP_NOTEBOOKDLG_H
00025 #define SALOMEAPP_NOTEBOOKDLG_H
00026
00027 #include "SalomeApp.h"
00028
00029 #include "SALOMEDSClient_ClientFactory.hxx"
00030 #include CORBA_SERVER_HEADER(SALOMEDS)
00031
00032 #include <QDialog>
00033 #include <QTableWidget>
00034 #include <QList>
00035
00036 class QWidget;
00037 class QPushButton;
00038 class QTableWidgetItem;
00039 class NoteBook_Table;
00040
00041 struct NoteBoox_Variable
00042 {
00043 NoteBoox_Variable() {}
00044 NoteBoox_Variable( const QString& theName, const QString& theValue )
00045 {
00046 Name = theName;
00047 Value = theValue;
00048 }
00049 QString Name;
00050 QString Value;
00051 };
00052
00053 typedef QMap< int, NoteBoox_Variable > VariableMap;
00054
00055 class SALOMEAPP_EXPORT NoteBook_TableRow : public QWidget
00056 {
00057 public:
00058 NoteBook_TableRow(int, NoteBook_Table* parentTable, QWidget* parent=0 );
00059 virtual ~NoteBook_TableRow();
00060
00061 int GetIndex() const { return myIndex; }
00062
00063 void AddToTable(QTableWidget *theTable);
00064
00065 void SetName(const QString theName);
00066 void SetValue(const QString theValue);
00067
00068 QString GetValue() const;
00069 QString GetName() const;
00070
00071 bool CheckName();
00072 bool CheckValue();
00073
00074 QTableWidgetItem* GetVariableItem();
00075 QTableWidgetItem* GetNameItem();
00076 QTableWidgetItem* GetHeaderItem();
00077
00078 static bool IsRealValue(const QString theValue, double* theResult = 0);
00079 static bool IsIntegerValue(const QString theValue, int* theResult = 0);
00080 static bool IsBooleanValue(const QString theValue, bool* theResult = 0);
00081 bool IsValidStringValue(const QString theName);
00082
00083 private:
00084 int myIndex;
00085 NoteBook_Table* myParentTable;
00086 QTableWidgetItem* myRowHeader;
00087 QTableWidgetItem* myVariableName;
00088 QTableWidgetItem* myVariableValue;
00089 };
00090
00091 class SALOMEAPP_EXPORT NoteBook_Table : public QTableWidget
00092 {
00093 Q_OBJECT
00094 public:
00095 NoteBook_Table(QWidget * parent = 0);
00096 virtual ~NoteBook_Table();
00097
00098 void Init(_PTR(Study) theStudy);
00099 static QString Variable2String(const std::string& theVarName,
00100 _PTR(Study) theStudy);
00101
00102 bool IsValid() const;
00103
00104 void AddRow( const QString& theName = QString::null, const QString& theValue = QString::null );
00105 void AddEmptyRow();
00106 NoteBook_TableRow* GetRowByItem(const QTableWidgetItem* theItem) const;
00107 bool IsLastRow(const NoteBook_TableRow* aRow) const;
00108
00109 void RemoveSelected();
00110
00111 void SetProcessItemChangedSignalFlag(const bool enable);
00112 bool GetProcessItemChangedSignalFlag()const;
00113
00114 bool IsUniqueName(const NoteBook_TableRow* theRow) const;
00115 QList<NoteBook_TableRow*> GetRows() const;
00116
00117 const bool IsModified() const { return myIsModified; }
00118 const QList<int>& GetRemovedRows() const { return myRemovedRows; }
00119 const VariableMap& GetVariableMap() const { return myVariableMap; }
00120 const VariableMap& GetVariableMapRef() const { return myVariableMapRef; }
00121 void RenamberRowItems();
00122
00123 void ResetMaps();
00124
00125 QList<NoteBook_TableRow*> myRows;
00126
00127 public slots:
00128 void onItemChanged(QTableWidgetItem* theItem);
00129
00130 private:
00131 int getUniqueIndex() const;
00132
00133 private:
00134 bool isProcessItemChangedSignal;
00135
00136 bool myIsModified;
00137 QList<int> myRemovedRows;
00138 VariableMap myVariableMapRef;
00139 VariableMap myVariableMap;
00140
00141 _PTR(Study) myStudy;
00142 };
00143
00144 class SALOMEAPP_EXPORT SalomeApp_NoteBookDlg : public QDialog
00145 {
00146 Q_OBJECT
00147 public:
00148 SalomeApp_NoteBookDlg(QWidget * parent , _PTR(Study) theStudy);
00149 virtual ~SalomeApp_NoteBookDlg();
00150
00151 void Init(_PTR(Study) theStudy);
00152
00153 public slots:
00154 void onOK();
00155 void onApply();
00156 void onCancel();
00157 void onRemove();
00158 void onUpdateStudy();
00159 void onHelp();
00160
00161 protected:
00162 bool updateStudy();
00163 void clearStudy();
00164
00165 private:
00166 NoteBook_Table* myTable;
00167 QPushButton* myRemoveButton;
00168 QPushButton* myUpdateStudyBtn;
00169 QPushButton* myOkBtn;
00170 QPushButton* myApplyBtn;
00171 QPushButton* myCancelBtn;
00172 QPushButton* myHelpBtn;
00173
00174 _PTR(Study) myStudy;
00175 };
00176
00177 #endif //SALOMEAPP_NOTEBOOKDLG_H