]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h
Salome HOME
Start potring to the VTK OpenGL2 backend.
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_MaterialPropertiesDlg.h
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 , bool  = true, bool  = false,const int  = Standard  );
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   void                  SetEditCurrentArgument();
76   void                  SelectionIntoArgument();
77
78 private:
79   typedef struct
80   {
81     QCheckBox*        enabled;
82     QLabel*           label;
83     QtxColorButton*   color;
84     QtxDoubleSpinBox* front_coef;
85     QtxDoubleSpinBox* back_coef;
86   } Reflection;
87
88   GEOMToolsGUI_MaterialList* myMaterials;
89   QCheckBox*                 myPhysical;
90   QList<Reflection>          myReflection;
91   QtxDoubleSpinBox*          myFrontShininess;  
92   QtxDoubleSpinBox*          myBackShininess;
93   QLabel*                    myColorLab;
94   QtxColorButton*            myColor;
95   QPushButton*               myAddButton;
96   QPushButton*               myDelButton;
97   Material_ResourceMgr       myResourceMgr;
98   Material_Model             myCurrentModel;
99   bool                       myShowSelWidget;
100   QLineEdit*                 myLineEditCurArg;
101   QPushButton*               myPushBtn;
102 };
103
104 class GEOMToolsGUI_MaterialList : public QListWidget
105 {
106 Q_OBJECT
107 public:
108   GEOMToolsGUI_MaterialList( QWidget* parent );
109 protected:
110   void contextMenuEvent( QContextMenuEvent* e );
111 signals:
112   void contextMenu( QContextMenuEvent* );
113 };
114
115 #endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H