Salome HOME
Synchronize adm files
[modules/jobmanager.git] / src / wrappers / BL_MainWindows_Qt.cxx
1 // Copyright (C) 2009-2014  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, 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 #include "BL_MainWindows_Qt.hxx"
21
22 BL::MainWindows_Qt::MainWindows_Qt(QMainWindow * main_window)
23 {
24   DEBTRACE("Creating BL::MainWindows_Qt");
25   BL_ASSERT(main_window);
26   _main_window = main_window;
27   _menuId = 0;
28 }
29
30 BL::MainWindows_Qt::~MainWindows_Qt()
31 {
32   DEBTRACE("Destroying BL::MainWindows_Qt");
33 }
34
35 QMainWindow * 
36 BL::MainWindows_Qt::getDockParent()
37 {
38   return _main_window;
39 }
40
41 QMainWindow * 
42 BL::MainWindows_Qt::getTabParent()
43 {
44   return _main_window;
45 }
46
47 QAction* 
48 BL::MainWindows_Qt::createAction(const QString& toolTip,
49                                  const QIcon& icon,
50                                  const QString& menu,
51                                  const QString& status,
52                                  const int accel,
53                                  QObject* parent,
54                                  bool checkable,
55                                  QObject* receiver,
56                                  const char* member,
57                                  const QString& shortCut)
58 {
59   QAction * action = new QAction(icon, menu, parent);
60   action->setStatusTip(status);
61   action->setToolTip(toolTip);
62   if (receiver)
63     connect(action, SIGNAL(triggered()), receiver, member);
64   return action;
65 }
66
67 int
68 BL::MainWindows_Qt::createTopMenu(const QString & menu_name)
69 {
70   QMenu * new_menu = _main_window->menuBar()->addMenu(menu_name);
71   _menu_map[getMenuId()] = new_menu;
72   return 0;
73 }
74
75 void
76 BL::MainWindows_Qt::addActionToMenu(QAction * action, int menu_id)
77 {
78   _menu_map[menu_id]->addAction(action);
79 }