Salome HOME
Bugs 16640, 19050: Improve selection mechanism in GEOM dialog boxes.
[modules/geom.git] / src / BooleanGUI / BooleanGUI.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : BooleanGUI.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
24 //
25
26 #include "BooleanGUI.h"
27 #include "BooleanGUI_Dialog.h"
28
29 #include <GeometryGUI.h>
30 #include <SUIT_Desktop.h>
31
32 //=======================================================================
33 // function : BooleanGUI()
34 // purpose  : Constructor
35 //=======================================================================
36 BooleanGUI::BooleanGUI( GeometryGUI* parent ) 
37   : GEOMGUI( parent )
38 {
39 }
40
41 //=======================================================================
42 // function : ~BooleanGUI()
43 // purpose  : Destructor
44 //=======================================================================
45 BooleanGUI::~BooleanGUI()
46 {
47 }
48
49
50 //=======================================================================
51 // function : OnGUIEvent()
52 // purpose  : 
53 //=======================================================================
54 bool BooleanGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
55 {
56   getGeometryGUI()->EmitSignalDeactivateDialog();
57
58   int anOperation = 0;  
59   if      ( theCommandID == 5011 )
60     anOperation = FUSE;
61   else if ( theCommandID == 5012 )
62     anOperation = COMMON;
63   else if ( theCommandID == 5013 )
64     anOperation = CUT;
65   else if ( theCommandID == 5014 )
66     anOperation = SECTION;
67   else
68     return false;
69
70   QDialog* aDlg = new BooleanGUI_Dialog( anOperation, getGeometryGUI(), parent );
71   aDlg->show();
72
73   return true;
74 }
75
76 //=====================================================================================
77 // EXPORTED METHODS
78 //=====================================================================================
79 extern "C"
80 {
81 #ifdef WIN32
82   __declspec( dllexport )
83 #endif
84   GEOMGUI* GetLibGUI( GeometryGUI* parent )
85   {
86     return new BooleanGUI( parent );
87   }
88 }