Salome HOME
Initial commit
[modules/jobmanager.git] / src / wrappers / BL_MainWindows_SALOME.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_MainWindows_SALOME.hxx"
20
21 BL::MainWindows_SALOME::MainWindows_SALOME(const QString & module_name) :
22   SalomeApp_Module(module_name),
23   LightApp_Module(module_name)
24 {
25   DEBTRACE("Creating BL::MainWindows_SALOME");
26   _actionId = 190;
27 }
28
29 void 
30 BL::MainWindows_SALOME::initialize(SalomeApp_Application * appli)
31 {
32   DEBTRACE("Initialize BL::MainWindows_SALOME");
33   BL_ASSERT(appli);
34
35   _appli = appli;
36   _svm = new SUIT_ViewManager(_appli->activeStudy(), _appli->desktop(), new SUIT_ViewModel());
37   _appli->addViewManager(_svm);
38   _viewWin = _svm->createViewWindow();
39
40   if (_viewWin && _appli->desktop())
41     _viewWin->resize((int)(_appli->desktop()->width() * 0.6), (int)(_appli->desktop()->height() * 0.6 ));
42 }
43
44 QString  
45 BL::MainWindows_SALOME::engineIOR() const
46 {
47   DEBTRACE("Entering in BL::SalomeGui::engineIOR");
48   return _appli->defaultEngineIOR();
49 }
50
51 void 
52 BL::MainWindows_SALOME::viewManagers(QStringList& list) const
53 {
54   DEBTRACE("Entering in BL::SalomeGui::viewManagers");
55   list.append(_svm->getType());
56 }
57
58
59 BL::MainWindows_SALOME::~MainWindows_SALOME()
60 {
61   DEBTRACE("Destroying BL::MainWindows_SALOME");
62 }
63
64 QMainWindow * 
65 BL::MainWindows_SALOME::getDockParent()
66 {
67   return _appli->desktop();
68 }
69
70 QMainWindow * 
71 BL::MainWindows_SALOME::getTabParent()
72 {
73   return _viewWin;
74 }
75
76 QAction* 
77 BL::MainWindows_SALOME::createAction(const QString& toolTip,
78                                      const QIcon& icon,
79                                      const QString& menu,
80                                      const QString& status,
81                                      const int shortCut,
82                                      QObject* parent,
83                                      bool checkable,
84                                      QObject* receiver,
85                                      const char* member)
86 {
87   return SalomeApp_Module::createAction(getActionId(), toolTip, icon, menu, status, shortCut, parent, checkable, receiver, member);
88 }
89
90 int
91 BL::MainWindows_SALOME::createTopMenu(const QString & menu_name)
92 {
93   return createMenu(menu_name, -1);
94 }
95
96 void 
97 BL::MainWindows_SALOME::addActionToMenu(QAction * action, int menu_id)
98 {
99   createMenu(action, menu_id);
100 }