]> SALOME platform Git repositories - modules/gui.git/blob - src/PVViewer/PVViewer_GUIElements.cxx
Salome HOME
Merge branch 'master' into abn/paravis_rearch
[modules/gui.git] / src / PVViewer / PVViewer_GUIElements.cxx
1 // Copyright (C) 2010-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 // Author: Adrien Bruneton (CEA)
20
21 #include "PVViewer_GUIElements.h"
22 #include "SUIT_Desktop.h"
23
24 #include <pqPropertiesPanel.h>
25 #include <pqPipelineBrowserWidget.h>
26 #include <pqParaViewMenuBuilders.h>
27
28 #include <QMenu>
29 #include <QList>
30 #include <QAction>
31
32 PVViewer_GUIElements * PVViewer_GUIElements::theInstance = 0;
33
34 PVViewer_GUIElements::PVViewer_GUIElements(SUIT_Desktop* desk) :
35   propertiesPanel(0), pipelineBrowserWidget(0),
36   sourcesMenu(0)
37 {
38   propertiesPanel = new pqPropertiesPanel(desk);
39   pipelineBrowserWidget  = new pqPipelineBrowserWidget(desk);
40
41   sourcesMenu = new QMenu(desk);
42   pqParaViewMenuBuilders::buildSourcesMenu(*sourcesMenu, desk);
43
44   filtersMenu = new QMenu(desk);
45   pqParaViewMenuBuilders::buildFiltersMenu(*filtersMenu, desk);
46
47   macrosMenu = new QMenu(desk);
48   pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu);
49 }
50
51 PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(SUIT_Desktop* desk)
52 {
53   if (! theInstance)
54     theInstance = new PVViewer_GUIElements(desk);
55   return theInstance;
56 }
57
58 void PVViewer_GUIElements::updateSourcesMenu(QMenu *menu)
59 {
60   if (menu)
61     {
62       menu->clear();
63       QList<QAction *> act_list = sourcesMenu->actions();
64       foreach(QAction * a, act_list)
65       {
66         menu->addAction(a);
67       }
68     }
69 }
70
71 void PVViewer_GUIElements::updateFiltersMenu(QMenu *menu)
72 {
73   if (menu)
74     {
75       menu->clear();
76       QList<QAction *> act_list = filtersMenu->actions();
77       foreach(QAction * a, act_list)
78       {
79         menu->addAction(a);
80       }
81     }
82 }
83
84 void PVViewer_GUIElements::updateMacrosMenu(QMenu *menu)
85 {
86   if (menu)
87     {
88       menu->clear();
89       QList<QAction *> act_list = macrosMenu->actions();
90       foreach(QAction * a, act_list)
91       {
92         menu->addAction(a);
93       }
94     }
95 }
96
97
98 void PVViewer_GUIElements::onEmulateApply()
99 {
100   if (propertiesPanel)
101     propertiesPanel->apply();
102 }