Salome HOME
d361dde5eec3da4e9d3241dd03bde4401942b6e1
[modules/geom.git] / src / BuildGUI / BuildGUI.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : BooleanGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "BuildGUI.h"
30
31 #include "SALOMEGUI_QtCatchCorbaException.hxx"
32 #include "QAD_Desktop.h"
33
34 #include "BuildGUI_EdgeDlg.h"       // Method EDGE
35 #include "BuildGUI_WireDlg.h"       // Method WIRE
36 #include "BuildGUI_FaceDlg.h"       // Method FACE
37 #include "BuildGUI_ShellDlg.h"      // Method SHELL
38 #include "BuildGUI_SolidDlg.h"      // Method SOLID
39 #include "BuildGUI_CompoundDlg.h"   // Method COMPOUND
40
41 BuildGUI* BuildGUI::myGUIObject = 0;
42
43 //=======================================================================
44 // function : GetBuildGUI()
45 // purpose  : Get the only BuildGUI object [ static ]
46 //=======================================================================
47 BuildGUI* BuildGUI::GetBuildGUI()
48 {
49   if ( myGUIObject == 0 ) 
50     myGUIObject = new BuildGUI();
51
52   return myGUIObject;
53 }
54
55 //=======================================================================
56 // function : BuildGUI()
57 // purpose  : Constructor
58 //=======================================================================
59 BuildGUI::BuildGUI()
60 : GEOMGUI()
61 {
62 }
63
64
65 //=======================================================================
66 // function : ~BuildGUI()
67 // purpose  : Destructor
68 //=======================================================================
69 BuildGUI::~BuildGUI()
70 {
71 }
72
73
74 //=======================================================================
75 // function : OnGUIEvent()
76 // purpose  : 
77 //=======================================================================
78 bool BuildGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
79 {
80   GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
81   
82   SALOME_Selection* Sel = SALOME_Selection::Selection(
83     QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
84
85   QDialog* aDlg = NULL;
86
87   switch ( theCommandID )
88   {
89     case 4081: aDlg = new BuildGUI_EdgeDlg    ( parent, "", Sel ); break;
90     case 4082: aDlg = new BuildGUI_WireDlg    ( parent, "", Sel ); break;
91     case 4083: aDlg = new BuildGUI_FaceDlg    ( parent, "", Sel ); break;
92     case 4084: aDlg = new BuildGUI_ShellDlg   ( parent, "", Sel ); break;
93     case 4085: aDlg = new BuildGUI_SolidDlg   ( parent, "", Sel ); break;
94     case 4086: aDlg = new BuildGUI_CompoundDlg( parent, "", Sel ); break;
95     
96     default: parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break;
97   }
98   
99   if ( aDlg != NULL )
100     aDlg->show();
101   
102   return true;
103 }
104
105 //=====================================================================================
106 // EXPORTED METHODS
107 //=====================================================================================
108 extern "C"
109 {
110   GEOMGUI* GetLibGUI()
111   {
112     return BuildGUI::GetBuildGUI();
113   }
114 }