Back to index

salome-geom  6.5.0
GEOMToolsGUI_MaterialPropertiesDlg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File   : GEOMToolsGUI_MaterialPropertiesDlg.h
00021 // Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
00022 //
00023 #ifndef GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
00024 #define GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H
00025 
00026 #include "GEOM_ToolsGUI.hxx"
00027 
00028 #include <QListWidget>
00029 #include <QtxDialog.h>
00030 #include "Material_Model.h"
00031 #include "Material_ResourceMgr.h"
00032 
00033 class QCheckBox;
00034 class QLabel;
00035 class QPushButton;
00036 class QtxDoubleSpinBox;
00037 class QtxColorButton;
00038 class GEOMToolsGUI_MaterialList;
00039 
00040 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog
00041 {
00042   Q_OBJECT
00043 
00044   enum { Current, Global, User };
00045   enum { TypeRole = Qt::UserRole + 123, NameRole  };
00046 
00047 public:
00048   GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
00049   ~GEOMToolsGUI_MaterialPropertiesDlg();  
00050 
00051   void                  accept();
00052 
00053   bool                  eventFilter( QObject*, QEvent* );
00054 
00055 private:
00056   void                  updateState();
00057   void                  toModel( Material_Model& ) const;
00058   void                  fromModel( const Material_Model& );
00059   QString               findUniqueName( const QString&,
00060                                    QListWidgetItem* = 0,
00061                                    bool = false );
00062 
00063 signals:
00064   void                  changed();
00065 
00066 private slots:
00067   void                  onChanged();
00068   void                  onMaterialChanged();
00069   void                  onItemChanged( QListWidgetItem* );
00070   void                  onContextMenu( QContextMenuEvent* );
00071   void                  onDeleteMaterial();
00072   void                  onAddMaterial();
00073   void                  onApply();
00074   void                  onHelp();
00075 
00076 private:
00077   typedef struct
00078   {
00079     QLabel*           label;
00080     QtxColorButton*   color;
00081     QtxDoubleSpinBox* coef;
00082     QCheckBox*        enabled;
00083   } Reflection;
00084 
00085   GEOMToolsGUI_MaterialList* myMaterials;
00086   QCheckBox*                 myPhysical;
00087   QList<Reflection>          myReflection;
00088   QtxDoubleSpinBox*          myShininess;
00089   QLabel*                    myColorLab;
00090   QtxColorButton*            myColor;
00091   QPushButton*               myAddButton;
00092   QPushButton*               myDelButton;
00093   Material_ResourceMgr       myResourceMgr;
00094   Material_Model             myCurrentModel;
00095 };
00096 
00097 class GEOMToolsGUI_MaterialList : public QListWidget
00098 {
00099 Q_OBJECT
00100 public:
00101   GEOMToolsGUI_MaterialList( QWidget* parent );
00102 protected:
00103   void contextMenuEvent( QContextMenuEvent* e );
00104 signals:
00105   void contextMenu( QContextMenuEvent* );
00106 };
00107 
00108 #endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H