Salome HOME
ENV: Windows porting
[modules/geom.git] / src / BlocksGUI / BlocksGUI.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  CEA
4 //
5 //  This library is free software; you can redistribute it and/or
6 //  modify it under the terms of the GNU Lesser General Public
7 //  License as published by the Free Software Foundation; either
8 //  version 2.1 of the License.
9 //
10 //  This library is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 //  Lesser General Public License for more details.
14 //
15 //  You should have received a copy of the GNU Lesser General Public
16 //  License along with this library; if not, write to the Free Software
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 //
19 //  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
20 //
21 //
22 //
23 //  File   : BooleanGUI.cxx
24 //  Author : Julia DOOVSKIKH
25 //  Module : GEOM
26 //  $Header$
27
28 #include "BlocksGUI.h"
29
30 #include "BlocksGUI_QuadFaceDlg.h"
31 #include "BlocksGUI_BlockDlg.h"
32 #include "BlocksGUI_TrsfDlg.h"
33 //#include "BlocksGUI_CheckMultiBlockDlg.h"
34 #include "BlocksGUI_ExplodeDlg.h"
35 #include "BlocksGUI_PropagateDlg.h"
36
37 #include "GeometryGUI.h"
38
39 #include "SUIT_Desktop.h"
40 #include "SUIT_MessageBox.h"
41 #include "SUIT_Session.h"
42
43 BlocksGUI* BlocksGUI::myGUIObject = 0;
44
45 //=======================================================================
46 // function : GetBlocksGUI()
47 // purpose  : Get the only BlocksGUI object [ static ]
48 //=======================================================================
49 BlocksGUI* BlocksGUI::GetBlocksGUI( GeometryGUI* parent )
50 {
51   if ( myGUIObject == 0 )
52     myGUIObject = new BlocksGUI( parent );
53
54   return myGUIObject;
55 }
56
57 //=======================================================================
58 // function : BlocksGUI()
59 // purpose  : Constructor
60 //=======================================================================
61 BlocksGUI::BlocksGUI( GeometryGUI* parent )
62      : GEOMGUI( parent )
63 {
64 }
65
66 //=======================================================================
67 // function : ~BlocksGUI()
68 // purpose  : Destructor
69 //=======================================================================
70 BlocksGUI::~BlocksGUI()
71 {
72 }
73
74 //=======================================================================
75 // function : OnGUIEvent()
76 // purpose  :
77 //=======================================================================
78 bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
79 {
80   getGeometryGUI()->EmitSignalDeactivateDialog();
81
82   QDialog* aDlg = NULL;
83
84   switch (theCommandID)
85   {
86     case 9999:
87       aDlg = new BlocksGUI_BlockDlg (parent);
88       break;
89
90     case 9998:
91       aDlg = new BlocksGUI_TrsfDlg (parent);
92       break;
93
94     case 9997:
95       aDlg = new BlocksGUI_QuadFaceDlg (parent);
96       break;
97
98     case 9996:
99 //      aDlg = new BlocksGUI_CheckMultiBlockDlg (parent, Sel);
100       SUIT_MessageBox::warn1 (parent,
101                               QObject::tr("WRN_WARNING"), 
102                               QObject::tr("WRN_NOT_IMPLEMENTED"),
103                               QObject::tr("BUT_OK"));
104       break;
105       
106     case 9995:
107       aDlg = new BlocksGUI_ExplodeDlg (parent);
108       break;
109     case 99991:
110       aDlg = new BlocksGUI_PropagateDlg (parent, "");
111       break;
112
113     default:
114       SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
115       break;
116   }
117
118   if (aDlg != NULL)
119     aDlg->show();
120
121   return true;
122 }
123
124 //=====================================================================================
125 // EXPORTED METHODS
126 //=====================================================================================
127 extern "C"
128 {
129 #ifdef WNT
130         __declspec( dllexport )
131 #endif
132   GEOMGUI* GetLibGUI( GeometryGUI* parent )
133   {
134     return BlocksGUI::GetBlocksGUI( parent );
135   }
136 }