Salome HOME
0021514: EDF GEOM: Partition failure. A fix by PKV.
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_MaterialPropertiesDlg.h
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File   : GEOMToolsGUI_MaterialPropertiesDlg.h
21 // Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
22 //
23 #ifndef GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
24 #define GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
25
26 #include "GEOM_ToolsGUI.hxx"
27
28 #include <QtxDialog.h>
29 #include <QFrame>
30 #include <QMap>
31
32 class QCheckBox;
33 class QGroupBox;
34 class QLabel;
35 class QListWidget;
36 class QListWidgetItem;
37 class QPushButton;
38 class QSpinBox;
39 class QTabWidget;
40
41 class QtxColorButton;
42 class QtxDoubleSpinBox;
43
44 class Material_Model;
45 class Material_ResourceMgr;
46
47 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog
48 {
49   Q_OBJECT
50
51   enum { Current, Default, Global, User };
52   enum { TypeRole = Qt::UserRole + 123, NameRole  };
53
54   //! Enumeration of viewer types
55   typedef enum {
56     OCC,  //!< OCC viewer
57     VTK  //!< VTK viewer
58   } ViewerType;
59
60 public:
61   GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
62   ~GEOMToolsGUI_MaterialPropertiesDlg();  
63
64   void                  accept();
65
66   bool                  eventFilter( QObject*, QEvent* );
67
68 private:
69   Material_ResourceMgr* resourceMgr();
70
71   void                  fromModel( Material_Model* );
72   void                  toModel( Material_Model* ) const;
73   void                  toFrontModel( Material_Model* ) const;
74   void                  toBackModel( Material_Model* ) const;
75   
76   QString               findUniqueName( const QString&,
77                                         QListWidgetItem* = 0,
78                                         bool = false );
79
80   bool                  isFrontTabActive() const;
81
82 signals:
83   void                  materialChanged();
84   void                  changed();
85
86 private slots:
87
88   void                  onApply();
89   void                  onHelp();
90
91   void                  onBackMaterialChecked( bool );
92   void                  onCurrentTabChanged( int );
93   void                  onMaterialChanged();
94   void                  onChanged();
95   void                  onItemChanged( QListWidgetItem* );
96   void                  onReflectionTypeToggled( bool );
97
98 private:
99   
100   Material_ResourceMgr* myResMgr;
101
102   QCheckBox*            myBackMaterialCheck;
103
104   //! Current material model for front material
105   Material_Model*       myCurrentModelF;
106
107   //! Current material model for back material
108   Material_Model*       myCurrentModelB;
109
110   QListWidget*          myMaterialList;
111   int                   myMaterialListFId;
112   int                   myMaterialListBId;
113
114   QTabWidget*           myMaterialTab;
115   QWidget*              myMaterialBWidget;
116   bool                  myIsBTabWasActivated;
117
118   //! Controls defining front material properties
119   QGroupBox*            myAmbientGroupF;
120   QtxColorButton*       myAmbientColorF;
121   QtxDoubleSpinBox*     myAmbientCoefntF;
122
123   QGroupBox*            myDiffuseGroupF;
124   QtxColorButton*       myDiffuseColorF;
125   QtxDoubleSpinBox*     myDiffuseCoefntF;
126
127   QGroupBox*            mySpecularGroupF;
128   QtxColorButton*       mySpecularColorF;
129   QtxDoubleSpinBox*     mySpecularCoefntF;
130
131   QGroupBox*            myEmissionGroupF;
132   QtxColorButton*       myEmissionColorF;
133   QtxDoubleSpinBox*     myEmissionCoefntF;
134
135   QtxDoubleSpinBox*     myShininessF;
136
137   //! Controls defining back material properties
138   QGroupBox*            myAmbientGroupB;
139   QtxColorButton*       myAmbientColorB;
140   QtxDoubleSpinBox*     myAmbientCoefntB;
141
142   QGroupBox*            myDiffuseGroupB;
143   QtxColorButton*       myDiffuseColorB;
144   QtxDoubleSpinBox*     myDiffuseCoefntB;
145
146   QGroupBox*            mySpecularGroupB;
147   QtxColorButton*       mySpecularColorB;
148   QtxDoubleSpinBox*     mySpecularCoefntB;
149
150   QGroupBox*            myEmissionGroupB;
151   QtxColorButton*       myEmissionColorB;
152   QtxDoubleSpinBox*     myEmissionCoefntB;
153
154   QtxDoubleSpinBox*     myShininessB;
155
156   QString               myHelpFileName;
157
158   ViewerType            myViewerType;
159   
160 };
161
162 #endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H