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