Salome HOME
Copyrights update 2015.
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_QuadrangleParamWdg.h
1 // Copyright (C) 2007-2015  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 //  File   : StdMeshersGUI_QuadrangleParamWdg.h
20 //  Author : Open CASCADE S.A.S. (jfa)
21
22 #ifndef STDMESHERSGUI_QUADRANGLEPARAMWDG_H
23 #define STDMESHERSGUI_QUADRANGLEPARAMWDG_H
24
25 // SMESH includes
26 #include "SMESH_StdMeshersGUI.hxx"
27 #include "StdMeshersGUI_StdHypothesisCreator.h"
28
29 #include <SALOME_InteractiveObject.hxx>
30
31 // Qt includes
32 #include <QWidget>
33 #include <QItemDelegate>
34
35
36 class QButtonGroup;
37 class QLineEdit;
38 class QListWidget;
39 class QPushButton;
40 class QTabWidget;
41 class QTreeWidget;
42 class StdMeshersGUI_QuadrangleParamWdg;
43 class StdMeshersGUI_SubShapeSelectorWdg;
44
45 //================================================================================
46 /*!
47  * \brief Quadrangle Parameters Creator
48  */
49 class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamCreator : public StdMeshersGUI_StdHypothesisCreator
50 {
51   Q_OBJECT
52
53     class ItemDelegate;
54
55  public:
56   StdMeshersGUI_QuadrangleParamCreator( const QString& aHypType );
57
58   //virtual bool     checkParams( QString& ) const;
59   virtual QString  helpPage() const;
60
61  protected:
62   virtual QFrame*  buildFrame();
63   virtual void     retrieveParams() const;
64   virtual QString  storeParams() const;
65
66  private slots:
67
68   void onTypeChanged(int type);
69   void onAddShape();
70   void onRemoveShape();
71   void onAddPoint();
72   void onRemovePoint();
73   void onSelectionChanged();
74   void onTabChanged(int);
75
76  private:
77
78   QLineEdit*                         myName;
79   StdMeshersGUI_QuadrangleParamWdg*  myTypeWdg;
80   StdMeshersGUI_SubShapeSelectorWdg* myVertexSelWdg;
81   QListWidget*                       myShapesList;
82   QPushButton*                       myAddShapeBut;
83   QTreeWidget*                       myCoordsTreeWdg;
84   QTabWidget*                        myTabs;
85   Handle(SALOME_InteractiveObject)   mySelectedShapeIO;
86 };
87
88 //================================================================================
89 /*!
90  * \brief Transition type widget
91  */
92 class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget
93 {
94   Q_OBJECT
95
96     public:
97   StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0);
98   ~StdMeshersGUI_QuadrangleParamWdg();
99
100   void SetType (int theType);
101   int  GetType ();
102
103   GEOM::ListOfGO*     GetShapes();
104   SMESH::nodes_array* GetPoints();
105   void                Set( GEOM::ListOfGO_var shapes, SMESH::nodes_array_var points );
106
107  signals:
108
109   void typeChanged(int);
110
111  private:
112   QButtonGroup* myType; // Quadranle preference, Triangle preference, Reduced
113 };
114
115 //================================================================================
116 /*!
117  * \brief Item delegate for a tree widget
118  */
119 class StdMeshersGUI_QuadrangleParamCreator::ItemDelegate : public QItemDelegate
120 {
121   Q_OBJECT
122 public:
123   ItemDelegate( QObject* );
124   QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
125 };
126
127 #endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H