Salome HOME
Porting to Qt4.
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI.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 //
23 //
24 //  File   : PrimitiveGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29
30 #include "PrimitiveGUI.h"
31 #include "GeometryGUI.h"
32
33 #include "SUIT_Desktop.h"
34
35 #include "SalomeApp_Application.h"
36
37 #include "PrimitiveGUI_BoxDlg.h"      // Method BOX
38 #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER
39 #include "PrimitiveGUI_SphereDlg.h"   // Method SPHERE
40 #include "PrimitiveGUI_TorusDlg.h"    // Method TORUS
41 #include "PrimitiveGUI_ConeDlg.h"     // Method CONE
42
43 using namespace std;
44
45 //=======================================================================
46 // function : PrimitiveGUI()
47 // purpose  : Constructor
48 //=======================================================================
49 PrimitiveGUI::PrimitiveGUI(GeometryGUI* parent) : GEOMGUI(parent)
50 {
51 }
52
53 //=======================================================================
54 // function : ~PrimitiveGUI
55 // purpose  : Destructor
56 //=======================================================================
57 PrimitiveGUI::~PrimitiveGUI()
58 {
59 }
60
61
62 //=======================================================================
63 // function : OnGUIEvent()
64 // purpose  : 
65 //=======================================================================
66 bool PrimitiveGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
67 {
68   SalomeApp_Application* app = getGeometryGUI()->getApp();
69   if (!app) return false;
70
71   getGeometryGUI()->EmitSignalDeactivateDialog();
72
73   QDialog* aDlg = NULL;
74
75   switch (theCommandID)
76   {
77     case 4021: // BOX
78         aDlg = new PrimitiveGUI_BoxDlg(getGeometryGUI(), parent, "");
79         break;
80     case 4022: // CYLINDER
81         aDlg = new PrimitiveGUI_CylinderDlg(getGeometryGUI(), parent, "");
82         break;
83     case 4023: // SPHERE
84         aDlg = new PrimitiveGUI_SphereDlg(getGeometryGUI(), parent, "");
85         break;
86     case 4024: // TORUS
87         aDlg = new PrimitiveGUI_TorusDlg(getGeometryGUI(), parent, "");
88         break;
89     case 4025: // CONE
90         aDlg = new PrimitiveGUI_ConeDlg(getGeometryGUI(), parent, "");
91         break;
92     default:
93         app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
94         break;
95     }
96
97   if (aDlg != NULL)
98     aDlg->show();
99
100   return true;
101 }
102
103
104 //=====================================================================================
105 // EXPORTED METHODS
106 //=====================================================================================
107 extern "C"
108 {
109 #ifdef WNT
110         __declspec( dllexport )
111 #endif
112   GEOMGUI* GetLibGUI( GeometryGUI* parent )
113   {
114     return new PrimitiveGUI( parent );
115   }
116 }