Salome HOME
Update copyright
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_QuadrangleParamWdg.cxx
1 // Copyright (C) 2007-2011  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 //  File   : StdMeshersGUI_QuadrangleParamWdg.cxx
20 //  Author : Open CASCADE S.A.S. (jfa)
21 //  SMESH includes
22
23 #include "StdMeshersGUI_QuadrangleParamWdg.h"
24
25 #include "SMESHGUI.h"
26
27 #include "SUIT_ResourceMgr.h"
28
29 // Qt includes
30 #include <QButtonGroup>
31 #include <QRadioButton>
32 #include <QLabel>
33 #include <QGridLayout>
34
35 // IDL includes
36 #include <SALOMEconfig.h>
37 #include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis)
38
39 #define SPACING 6
40 #define MARGIN 0
41
42 //================================================================================
43 // function : Constructor
44 // purpose  :
45 //================================================================================
46 StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent)
47   : QWidget(parent),
48     myType(0)
49 {
50   myType = new QButtonGroup (this);
51
52   QGridLayout* typeLay = new QGridLayout( this );
53
54   typeLay->setMargin(MARGIN);
55   typeLay->setSpacing(SPACING);
56
57   QString aTypeKey ("SMESH_QUAD_TYPE_%1");
58   QString aPictKey ("ICON_StdMeshers_Quadrangle_Params_%1");
59
60   int itype = 0;
61   for (; itype < int(StdMeshers::QUAD_NB_TYPES); itype++) {
62     QRadioButton* rbi = new QRadioButton (tr(aTypeKey.arg(itype).toLatin1()), this);
63     QPixmap pmi (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aPictKey.arg(itype).toLatin1())));
64     QLabel* pli = new QLabel (this);
65     pli->setPixmap(pmi);
66     typeLay->addWidget(rbi, itype, 0, 1, 1);
67     typeLay->addWidget(pli, itype, 1, 1, 1);
68     myType->addButton(rbi, itype);
69   }
70   myType->button(0)->setChecked(true);
71
72   setLayout(typeLay);
73   setMinimumWidth(300);
74 }
75
76 //================================================================================
77 // function : Destructor
78 // purpose  :
79 //================================================================================
80 StdMeshersGUI_QuadrangleParamWdg::~StdMeshersGUI_QuadrangleParamWdg()
81 {
82 }
83
84 //=================================================================================
85 // function : SetType
86 // purpose  :
87 //=================================================================================
88 void StdMeshersGUI_QuadrangleParamWdg::SetType (int theType)
89 {
90   myType->button(theType)->setChecked(true);
91 }
92
93 //=================================================================================
94 // function : GetType
95 // purpose  :
96 //=================================================================================
97 int StdMeshersGUI_QuadrangleParamWdg::GetType()
98 {
99   return myType->checkedId();
100 }