Back to index

salome-geom  6.5.0
PrimitiveGUI.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // GEOM GEOMGUI : GUI for Geometry component
00024 // File   : PrimitiveGUI.cxx
00025 // Author : Damien COQUERET, Open CASCADE S.A.S.
00026 //
00027 #include "PrimitiveGUI.h"
00028 
00029 #include <GeometryGUI.h>
00030 #include "GeometryGUI_Operations.h"
00031 
00032 #include <SUIT_Desktop.h>
00033 #include <SalomeApp_Application.h>
00034 
00035 #include "PrimitiveGUI_BoxDlg.h"      // Method BOX
00036 #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER
00037 #include "PrimitiveGUI_SphereDlg.h"   // Method SPHERE
00038 #include "PrimitiveGUI_TorusDlg.h"    // Method TORUS
00039 #include "PrimitiveGUI_ConeDlg.h"     // Method CONE
00040 #include "PrimitiveGUI_FaceDlg.h"     // Method FACE
00041 #include "PrimitiveGUI_DiskDlg.h"     // Method DISK
00042 
00043 //=======================================================================
00044 // function : PrimitiveGUI()
00045 // purpose  : Constructor
00046 //=======================================================================
00047 PrimitiveGUI::PrimitiveGUI( GeometryGUI* parent ) : GEOMGUI( parent )
00048 {
00049 }
00050 
00051 //=======================================================================
00052 // function : ~PrimitiveGUI
00053 // purpose  : Destructor
00054 //=======================================================================
00055 PrimitiveGUI::~PrimitiveGUI()
00056 {
00057 }
00058 
00059 //=======================================================================
00060 // function : OnGUIEvent()
00061 // purpose  : 
00062 //=======================================================================
00063 bool PrimitiveGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
00064 {
00065   SalomeApp_Application* app = getGeometryGUI()->getApp();
00066   if ( !app ) return false;
00067 
00068   getGeometryGUI()->EmitSignalDeactivateDialog();
00069 
00070   QDialog* aDlg = NULL;
00071 
00072   switch ( theCommandID ) {
00073   case GEOMOp::OpBox:       // BOX
00074     aDlg = new PrimitiveGUI_BoxDlg( getGeometryGUI(), parent );
00075     break;
00076   case GEOMOp::OpCylinder:  // CYLINDER
00077     aDlg = new PrimitiveGUI_CylinderDlg( getGeometryGUI(), parent );
00078     break;
00079   case GEOMOp::OpSphere:    // SPHERE
00080     aDlg = new PrimitiveGUI_SphereDlg( getGeometryGUI(), parent );
00081     break;
00082   case GEOMOp::OpTorus:     // TORUS
00083     aDlg = new PrimitiveGUI_TorusDlg( getGeometryGUI(), parent );
00084     break;
00085   case GEOMOp::OpCone:      // CONE
00086     aDlg = new PrimitiveGUI_ConeDlg( getGeometryGUI(), parent);
00087     break;
00088   case GEOMOp::OpRectangle: // FACE
00089     aDlg = new PrimitiveGUI_FaceDlg( getGeometryGUI(), parent);
00090     break;
00091   case GEOMOp::OpDisk:      // DISK
00092     aDlg = new PrimitiveGUI_DiskDlg( getGeometryGUI(), parent);
00093     break;
00094   default:
00095     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
00096     break;
00097   }
00098 
00099   if ( aDlg != NULL )
00100     aDlg->show();
00101 
00102   return true;
00103 }
00104 
00105 //=====================================================================================
00106 // EXPORTED METHODS
00107 //=====================================================================================
00108 extern "C"
00109 {
00110 #ifdef WIN32
00111   __declspec( dllexport )
00112 #endif
00113   GEOMGUI* GetLibGUI( GeometryGUI* parent )
00114   {
00115     return new PrimitiveGUI( parent );
00116   }
00117 }