]> SALOME platform Git repositories - plugins/xtplugin.git/blob - src/XTPluginGUI.cxx
Salome HOME
Increment version: 7.4.0
[plugins/xtplugin.git] / src / XTPluginGUI.cxx
1 // Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // internal includes
21 #include "XTPluginGUI.h"
22 #include "XTPlugin_ImportDlg.h"
23
24 // GUI includes
25 #include <SUIT_Desktop.h>
26 #include <SUIT_MessageBox.h>
27 #include <SalomeApp_Application.h>
28 #include <SALOME_ListIteratorOfListIO.hxx>
29 #include <LightApp_SelectionMgr.h>
30
31 // GEOM includes
32 #include <GeometryGUI.h>
33
34 //=======================================================================
35 // function : XTPluginGUI()
36 // purpose  : Constructor
37 //=======================================================================
38 XTPluginGUI::XTPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
39 {
40 }
41
42 //=======================================================================
43 // function : ~XTPluginGUI
44 // purpose  : Destructor
45 //=======================================================================
46 XTPluginGUI::~XTPluginGUI()
47 {
48 }
49
50 //=======================================================================
51 // function : OnGUIEvent()
52 // purpose  : 
53 //=======================================================================
54 bool XTPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
55 {
56   switch ( theCommandID ) {
57   case 1:
58     return OnGUIEvent("Import_XT", parent);
59   default:
60     return OnGUIEvent("", parent);
61   }
62   return false;
63 }
64
65 //=======================================================================
66 // function : OnGUIEvent()
67 // purpose  :
68 //=======================================================================
69 bool XTPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
70 {
71   SalomeApp_Application* app = getGeometryGUI()->getApp();
72   if (!app) return false;
73
74   getGeometryGUI()->EmitSignalDeactivateDialog();
75
76   SUIT_FileDlg* dialog = NULL;
77   if (theCommandID == "Import_XT") {
78     dialog = new XTPlugin_ImportDlg( parent );
79     if (dialog != NULL)
80       dialog->show();
81     if( dialog->exec() == QDialog::Accepted )
82       delete dialog;
83   }
84   else {
85     app->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
86   }
87
88   return true;
89 }
90
91 //=====================================================================================
92 // EXPORTED METHODS
93 //=====================================================================================
94 extern "C"
95 {
96 #ifdef WIN32
97     __declspec( dllexport )
98 #endif
99   GEOMGUI* GetLibGUI( GeometryGUI* parent )
100   {
101     return new XTPluginGUI( parent );
102   }
103 }