1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_OperatorMenus.cxx
25 // Author : Nicolas REJNERI
29 #include "QAD_OperatorMenus.h"
30 #include "QAD_Desktop.h"
36 QAD_OperatorMenus::QAD_OperatorMenus(QAD_Desktop* theDesktop)
44 QAD_OperatorMenus::~QAD_OperatorMenus()
49 Builds popup menu with a 'Context', a 'Parent' and an 'Object'.
50 Parent is equal to 'Objectbrowser' or 'Viewer'.
52 QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(const QString & theContext,
53 const QString & theParent,
54 const QString & theObject)
56 QAD_Menus* aMenus = myDesktop->getActiveMenus();
57 QAD_ListPopupMenu* aPopup;
59 QList<QAD_ListPopupMenu> PopupList = aMenus->getPopupMenuList();
61 for(aPopup=PopupList.first();aPopup!=NULL;aPopup=PopupList.next()){
62 if ((aPopup->getContext().compare(theContext)==0) &&
63 (aPopup->getParent().compare(theParent)==0) &&
64 (aPopup->getObject().compare(theObject)==0)) {
71 QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(int thePopupMenuId)
73 QAD_Menus* aMenus = myDesktop->getActiveMenus();
75 if(!aMenus->getPopupMenuList().isEmpty() &&
76 aMenus->getPopupMenuList().at(thePopupMenuId)!=NULL) {
77 return aMenus->getPopupMenuList().at(thePopupMenuId);
82 void QAD_OperatorMenus::showMenuBar(int theMenuBarId)
85 QAD_Menus* aMenus = myDesktop->getActiveMenus();
86 if(!aMenus->getMenuBarList().isEmpty() &&
87 aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
88 aMenus->getMenuBarList().at(theMenuBarId)->show();
92 void QAD_OperatorMenus::hideMenuBar(int theMenuBarId)
96 aMenus=myDesktop->getActiveMenus();
97 if(!aMenus->getMenuBarList().isEmpty() &&
98 aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
99 aMenus->getMenuBarList().at(theMenuBarId)->hide();
103 void QAD_OperatorMenus::showToolBar(int theToolBarId)
108 aMenus=myDesktop->getActiveMenus();
109 if(!aMenus->getToolBarList().isEmpty() &&
110 aMenus->getToolBarList().at(theToolBarId)!=NULL) {
111 aMenus->getToolBarList().at(theToolBarId)->show();
115 void QAD_OperatorMenus::hideToolBar(int theToolBarId)
120 aMenus=myDesktop->getActiveMenus();
121 if(!aMenus->getToolBarList().isEmpty() &&
122 aMenus->getToolBarList().at(theToolBarId)!=NULL) {
123 aMenus->getToolBarList().at(theToolBarId)->hide();