Salome HOME
IMP 0021511: EDF 2153 GEOM: Choose to take units into account or not when importing...
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_MaterialPropertiesDlg.h
1 // Copyright (C) 2007-2012  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 <QListWidget>
29 #include <QtxDialog.h>
30 #include "Material_Model.h"
31 #include "Material_ResourceMgr.h"
32
33 class QCheckBox;
34 class QLabel;
35 class QPushButton;
36 class QtxDoubleSpinBox;
37 class QtxColorButton;
38 class GEOMToolsGUI_MaterialList;
39
40 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog
41 {
42   Q_OBJECT
43
44   enum { Current, Global, User };
45   enum { TypeRole = Qt::UserRole + 123, NameRole  };
46
47 public:
48   GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
49   ~GEOMToolsGUI_MaterialPropertiesDlg();  
50
51   void                  accept();
52
53   bool                  eventFilter( QObject*, QEvent* );
54
55 private:
56   void                  updateState();
57   void                  toModel( Material_Model& ) const;
58   void                  fromModel( const Material_Model& );
59   QString               findUniqueName( const QString&,
60                                         QListWidgetItem* = 0,
61                                         bool = false );
62
63 signals:
64   void                  changed();
65
66 private slots:
67   void                  onChanged();
68   void                  onMaterialChanged();
69   void                  onItemChanged( QListWidgetItem* );
70   void                  onContextMenu( QContextMenuEvent* );
71   void                  onDeleteMaterial();
72   void                  onAddMaterial();
73   void                  onApply();
74   void                  onHelp();
75
76 private:
77   typedef struct
78   {
79     QLabel*           label;
80     QtxColorButton*   color;
81     QtxDoubleSpinBox* coef;
82     QCheckBox*        enabled;
83   } Reflection;
84
85   GEOMToolsGUI_MaterialList* myMaterials;
86   QCheckBox*                 myPhysical;
87   QList<Reflection>          myReflection;
88   QtxDoubleSpinBox*          myShininess;
89   QLabel*                    myColorLab;
90   QtxColorButton*            myColor;
91   QPushButton*               myAddButton;
92   QPushButton*               myDelButton;
93   Material_ResourceMgr       myResourceMgr;
94   Material_Model             myCurrentModel;
95 };
96
97 class GEOMToolsGUI_MaterialList : public QListWidget
98 {
99 Q_OBJECT
100 public:
101   GEOMToolsGUI_MaterialList( QWidget* parent );
102 protected:
103   void contextMenuEvent( QContextMenuEvent* e );
104 signals:
105   void contextMenu( QContextMenuEvent* );
106 };
107
108 #endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H