1 // Copyright (C) 2008 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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 // File: SalomeApp_NoteBookDlg.h
20 // Author : Roman NIKOLAEV, Open CASCADE S.A.S.
23 #ifndef SALOMEAPP_NOTEBOOKDLG_H
24 #define SALOMEAPP_NOTEBOOKDLG_H
26 #include "SalomeApp.h"
28 #include "SALOMEDSClient_ClientFactory.hxx"
29 #include CORBA_SERVER_HEADER(SALOMEDS)
32 #include <QTableWidget>
37 class QTableWidgetItem;
39 struct NoteBoox_Variable
41 NoteBoox_Variable() {}
42 NoteBoox_Variable( const QString& theName, const QString& theValue )
51 typedef QMap< int, NoteBoox_Variable > VariableMap;
53 class SALOMEAPP_EXPORT NoteBook_TableRow : public QWidget
56 NoteBook_TableRow(int, QWidget* parent=0);
57 virtual ~NoteBook_TableRow();
59 int GetIndex() const { return myIndex; }
61 void AddToTable(QTableWidget *theTable);
63 void SetName(const QString theName);
64 void SetValue(const QString theValue);
66 QString GetValue() const;
67 QString GetName() const;
72 QTableWidgetItem* GetVariableItem();
73 QTableWidgetItem* GetNameItem();
74 QTableWidgetItem* GetHeaderItem();
76 static bool IsRealValue(const QString theValue, double* theResult = 0);
77 static bool IsIntegerValue(const QString theValue, int* theResult = 0);
78 static bool IsBooleanValue(const QString theValue, bool* theResult = 0);
82 QTableWidgetItem* myRowHeader;
83 QTableWidgetItem* myVariableName;
84 QTableWidgetItem* myVariableValue;
87 class SALOMEAPP_EXPORT NoteBook_Table : public QTableWidget
91 NoteBook_Table(QWidget * parent = 0);
92 virtual ~NoteBook_Table();
94 void Init(_PTR(Study) theStudy);
95 static QString Variable2String(const std::string& theVarName,
96 _PTR(Study) theStudy);
100 void AddRow( const QString& theName = QString::null, const QString& theValue = QString::null );
102 NoteBook_TableRow* GetRowByItem(const QTableWidgetItem* theItem) const;
103 bool IsLastRow(const NoteBook_TableRow* aRow) const;
105 void RemoveSelected();
107 void SetProcessItemChangedSignalFlag(const bool enable);
108 bool GetProcessItemChangedSignalFlag()const;
110 bool IsUniqueName(const NoteBook_TableRow* theRow) const;
111 QList<NoteBook_TableRow*> GetRows() const;
113 const bool IsModified() const { return myIsModified; }
114 const QList<int>& GetRemovedRows() const { return myRemovedRows; }
115 const VariableMap& GetVariableMap() const { return myVariableMap; }
116 const VariableMap& GetVariableMapRef() const { return myVariableMapRef; }
117 void RenamberRowItems();
122 void onItemChanged(QTableWidgetItem* theItem);
125 int getUniqueIndex() const;
128 bool isProcessItemChangedSignal;
129 QList<NoteBook_TableRow*> myRows;
132 QList<int> myRemovedRows;
133 VariableMap myVariableMapRef;
134 VariableMap myVariableMap;
139 class SALOMEAPP_EXPORT SalomeApp_NoteBookDlg : public QDialog
143 SalomeApp_NoteBookDlg(QWidget * parent , _PTR(Study) theStudy);
144 virtual ~SalomeApp_NoteBookDlg();
146 void Init(_PTR(Study) theStudy);
153 void onUpdateStudy();
161 NoteBook_Table* myTable;
162 QPushButton* myRemoveButton;
163 QPushButton* myUpdateStudyBtn;
164 QPushButton* myOkBtn;
165 QPushButton* myApplyBtn;
166 QPushButton* myCancelBtn;
167 QPushButton* myHelpBtn;
172 #endif //SALOMEAPP_NOTEBOOKDLG_H