Salome HOME
Initial commit
[modules/jobmanager.git] / src / salomegui / BL_SalomeGui.cxx
1 //  Copyright (C) 2009 CEA/DEN, EDF R&D
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.
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 #include "BL_SalomeGui.hxx"
20
21 BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager"), 
22                              SalomeApp_Module("JobManager"), 
23                              LightApp_Module("JobManager")
24 {
25   DEBTRACE("Creating BL::SalomeGui");
26   _gengui = NULL;
27 }
28
29 BL::SalomeGui::~SalomeGui()
30 {
31   DEBTRACE("Destroying BL::SalomeGui");
32 }
33
34 void 
35 BL::SalomeGui::initialize(CAM_Application* app)
36 {
37    DEBTRACE("Entering in initialize");
38    SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV...
39    BL::MainWindows_SALOME::initialize(getApp());
40
41    _gengui = new BL::GenericGui(this);
42    _gengui->createActions();
43    _gengui->createMenus();
44    _gengui->updateButtonsStates();
45 }
46
47 bool 
48 BL::SalomeGui::activateModule(SUIT_Study* theStudy)
49 {
50   DEBTRACE("Entering in BL::SalomeGui::activateModule");
51
52   bool bOk = SalomeApp_Module::activateModule(theStudy);
53   setMenuShown(true);
54
55   _gengui->showDockWidgets(true);
56   return bOk;
57 }
58
59 void 
60 BL::SalomeGui::windows(QMap<int, int>& theMap) const
61 {
62   DEBTRACE("Entering in BL::SalomeGui::windows");
63   theMap.clear();
64   theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
65 }
66
67 bool 
68 BL::SalomeGui::deactivateModule(SUIT_Study* theStudy)
69 {
70   DEBTRACE("Entering in BL::SalomeGui::deactivateModule");
71
72   setMenuShown(false);
73   _gengui->showDockWidgets(false);
74   bool bOk = SalomeApp_Module::deactivateModule(theStudy);
75   return bOk;
76 }
77
78 // --- Export the module
79 extern "C"
80 {
81   CAM_Module* createModule()
82   {
83     return new BL::SalomeGui();
84   }
85 }