Back to index

salome-smesh  6.5.0
StdMeshersGUI_QuadrangleParamWdg.cxx
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 //  File   : StdMeshersGUI_QuadrangleParamWdg.cxx
00020 //  Author : Open CASCADE S.A.S. (jfa)
00021 //  SMESH includes
00022 
00023 #include "StdMeshersGUI_QuadrangleParamWdg.h"
00024 
00025 #include "SMESHGUI.h"
00026 
00027 #include "SUIT_ResourceMgr.h"
00028 
00029 // Qt includes
00030 #include <QButtonGroup>
00031 #include <QRadioButton>
00032 #include <QLabel>
00033 #include <QGridLayout>
00034 
00035 // IDL includes
00036 #include <SALOMEconfig.h>
00037 #include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis)
00038 
00039 #define SPACING 6
00040 #define MARGIN 0
00041 
00042 //================================================================================
00043 // function : Constructor
00044 // purpose  :
00045 //================================================================================
00046 StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent)
00047   : QWidget(parent),
00048     myType(0)
00049 {
00050   myType = new QButtonGroup (this);
00051 
00052   QGridLayout* typeLay = new QGridLayout( this );
00053 
00054   typeLay->setMargin(MARGIN);
00055   typeLay->setSpacing(SPACING);
00056 
00057   QString aTypeKey ("SMESH_QUAD_TYPE_%1");
00058   QString aPictKey ("ICON_StdMeshers_Quadrangle_Params_%1");
00059 
00060   int itype = 0;
00061   for (; itype < int(StdMeshers::QUAD_NB_TYPES); itype++) {
00062     QRadioButton* rbi = new QRadioButton (tr(aTypeKey.arg(itype).toLatin1()), this);
00063     QPixmap pmi (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aPictKey.arg(itype).toLatin1())));
00064     QLabel* pli = new QLabel (this);
00065     pli->setPixmap(pmi);
00066     typeLay->addWidget(rbi, itype, 0, 1, 1);
00067     typeLay->addWidget(pli, itype, 1, 1, 1);
00068     myType->addButton(rbi, itype);
00069   }
00070   myType->button(0)->setChecked(true);
00071 
00072   setLayout(typeLay);
00073   setMinimumWidth(300);
00074 }
00075 
00076 //================================================================================
00077 // function : Destructor
00078 // purpose  :
00079 //================================================================================
00080 StdMeshersGUI_QuadrangleParamWdg::~StdMeshersGUI_QuadrangleParamWdg()
00081 {
00082 }
00083 
00084 //=================================================================================
00085 // function : SetType
00086 // purpose  :
00087 //=================================================================================
00088 void StdMeshersGUI_QuadrangleParamWdg::SetType (int theType)
00089 {
00090   myType->button(theType)->setChecked(true);
00091 }
00092 
00093 //=================================================================================
00094 // function : GetType
00095 // purpose  :
00096 //=================================================================================
00097 int StdMeshersGUI_QuadrangleParamWdg::GetType()
00098 {
00099   return myType->checkedId();
00100 }