Salome HOME
Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the...
[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 protected:
67   void                  keyPressEvent( QKeyEvent* );
68
69 private:
70   Material_ResourceMgr* resourceMgr();
71
72   void                  fromModel( Material_Model* );
73   void                  toModel( Material_Model* ) const;
74   void                  toFrontModel( Material_Model* ) const;
75   void                  toBackModel( Material_Model* ) const;
76   
77   QString               findUniqueName( const QString&,
78                                         QListWidgetItem* = 0,
79                                         bool = false );
80
81   bool                  isFrontTabActive() const;
82
83 signals:
84   void                  materialChanged();
85   void                  changed();
86
87 private slots:
88
89   void                  onApply();
90   void                  onHelp();
91
92   void                  onBackMaterialChecked( bool );
93   void                  onCurrentTabChanged( int );
94   void                  onMaterialChanged();
95   void                  onChanged();
96   void                  onItemChanged( QListWidgetItem* );
97   void                  onReflectionTypeToggled( bool );
98
99 private:
100   
101   Material_ResourceMgr* myResMgr;
102
103   QCheckBox*            myBackMaterialCheck;
104
105   //! Current material model for front material
106   Material_Model*       myCurrentModelF;
107
108   //! Current material model for back material
109   Material_Model*       myCurrentModelB;
110
111   QListWidget*          myMaterialList;
112   int                   myMaterialListFId;
113   int                   myMaterialListBId;
114
115   QTabWidget*           myMaterialTab;
116   QWidget*              myMaterialBWidget;
117   bool                  myIsBTabWasActivated;
118
119   //! Controls defining front material properties
120   QGroupBox*            myAmbientGroupF;
121   QtxColorButton*       myAmbientColorF;
122   QtxDoubleSpinBox*     myAmbientCoefntF;
123
124   QGroupBox*            myDiffuseGroupF;
125   QtxColorButton*       myDiffuseColorF;
126   QtxDoubleSpinBox*     myDiffuseCoefntF;
127
128   QGroupBox*            mySpecularGroupF;
129   QtxColorButton*       mySpecularColorF;
130   QtxDoubleSpinBox*     mySpecularCoefntF;
131
132   QGroupBox*            myEmissionGroupF;
133   QtxColorButton*       myEmissionColorF;
134   QtxDoubleSpinBox*     myEmissionCoefntF;
135
136   QtxDoubleSpinBox*     myShininessF;
137
138   //! Controls defining back material properties
139   QGroupBox*            myAmbientGroupB;
140   QtxColorButton*       myAmbientColorB;
141   QtxDoubleSpinBox*     myAmbientCoefntB;
142
143   QGroupBox*            myDiffuseGroupB;
144   QtxColorButton*       myDiffuseColorB;
145   QtxDoubleSpinBox*     myDiffuseCoefntB;
146
147   QGroupBox*            mySpecularGroupB;
148   QtxColorButton*       mySpecularColorB;
149   QtxDoubleSpinBox*     mySpecularCoefntB;
150
151   QGroupBox*            myEmissionGroupB;
152   QtxColorButton*       myEmissionColorB;
153   QtxDoubleSpinBox*     myEmissionCoefntB;
154
155   QtxDoubleSpinBox*     myShininessB;
156
157   QString               myHelpFileName;
158
159   ViewerType            myViewerType;
160   
161 };
162
163 #endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H