Salome HOME
Merge branch 'V9_9_BR'
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_QuadrangleParamWdg.h
1 // Copyright (C) 2007-2022  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   StdMeshersGUI_SubShapeSelectorWdg* myCornersSelWdg;
82   QListWidget*                       myShapesList;
83   QPushButton*                       myAddShapeBut;
84   QTreeWidget*                       myCoordsTreeWdg;
85   QTabWidget*                        myTabs;
86   Handle(SALOME_InteractiveObject)   mySelectedShapeIO;
87 };
88
89 //================================================================================
90 /*!
91  * \brief Transition type widget
92  */
93 class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget
94 {
95   Q_OBJECT
96
97     public:
98   StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0);
99   ~StdMeshersGUI_QuadrangleParamWdg();
100
101   void SetType (int theType);
102   int  GetType ();
103
104   GEOM::ListOfGO*     GetShapes();
105   SMESH::nodes_array* GetPoints();
106   void                Set( GEOM::ListOfGO_var shapes, SMESH::nodes_array_var points );
107
108  signals:
109
110   void typeChanged(int);
111
112  private:
113   QButtonGroup* myType; // Quadrangle preference, Triangle preference, Reduced
114 };
115
116 //================================================================================
117 /*!
118  * \brief Item delegate for a tree widget
119  */
120 class StdMeshersGUI_QuadrangleParamCreator::ItemDelegate : public QItemDelegate
121 {
122   Q_OBJECT
123 public:
124   ItemDelegate( QObject* );
125   QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
126 };
127
128 #endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H