Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / SALOMEGUI / QAD_OperatorMenus.cxx
1 using namespace std;
2 //  File      : QAD_OperatorMenus.cxx
3 //  Created   : Thu Jun 14 14:37:17 2001
4 //  Author    : Nicolas REJNERI
5 //  Project   : SALOME
6 //  Module    : SALOMEGUI
7 //  Copyright : Open CASCADE
8 //  $Header$
9
10 #include "QAD_OperatorMenus.h"
11 #include "QAD_Desktop.h"
12
13 /*!
14   Constructor.
15 */
16 QAD_OperatorMenus::QAD_OperatorMenus(QAD_Desktop* theDesktop)
17 {
18   myDesktop=theDesktop;
19 }
20
21 /*!
22   Destructor.
23 */
24 QAD_OperatorMenus::~QAD_OperatorMenus()
25 {
26 }
27
28 /*!
29   Builds popup menu with a 'Context', a 'Parent' and an 'Object'.
30   Parent is equal to 'Objectbrowser' or 'Viewer'.
31 */
32 QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(const QString & theContext,
33                                                       const QString & theParent,
34                                                       const QString & theObject)
35 {
36   QAD_Menus* aMenus = myDesktop->getActiveMenus();
37   QAD_ListPopupMenu* aPopup;
38
39   QList<QAD_ListPopupMenu> PopupList = aMenus->getPopupMenuList();
40
41   for(aPopup=PopupList.first();aPopup!=NULL;aPopup=PopupList.next()){
42     if ((aPopup->getContext().compare(theContext)==0) &&
43         (aPopup->getParent().compare(theParent)==0) &&
44         (aPopup->getObject().compare(theObject)==0)) {
45       return aPopup;
46     }
47   }
48   return NULL;
49 }
50
51 QAD_ListPopupMenu* QAD_OperatorMenus::createPopupMenu(int thePopupMenuId)
52 {
53   QAD_Menus* aMenus = myDesktop->getActiveMenus();
54
55   if(!aMenus->getPopupMenuList().isEmpty() && 
56      aMenus->getPopupMenuList().at(thePopupMenuId)!=NULL) {
57     return aMenus->getPopupMenuList().at(thePopupMenuId);
58   } else
59     return NULL;
60 }
61
62 void QAD_OperatorMenus::showMenuBar(int theMenuBarId)
63
64 {
65   QAD_Menus* aMenus = myDesktop->getActiveMenus();
66   if(!aMenus->getMenuBarList().isEmpty() && 
67      aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
68     aMenus->getMenuBarList().at(theMenuBarId)->show();
69   }
70 }
71
72 void QAD_OperatorMenus::hideMenuBar(int theMenuBarId)
73
74 {
75   QAD_Menus* aMenus;
76   aMenus=myDesktop->getActiveMenus();
77   if(!aMenus->getMenuBarList().isEmpty() && 
78      aMenus->getMenuBarList().at(theMenuBarId)!=NULL) {
79     aMenus->getMenuBarList().at(theMenuBarId)->hide();
80   }
81 }
82
83 void QAD_OperatorMenus::showToolBar(int theToolBarId)
84
85 {
86   QAD_Menus* aMenus;
87   
88   aMenus=myDesktop->getActiveMenus();
89   if(!aMenus->getToolBarList().isEmpty() && 
90      aMenus->getToolBarList().at(theToolBarId)!=NULL) {
91     aMenus->getToolBarList().at(theToolBarId)->show();
92   }
93 }
94
95 void QAD_OperatorMenus::hideToolBar(int theToolBarId)
96
97 {
98   QAD_Menus* aMenus;
99   
100   aMenus=myDesktop->getActiveMenus();
101   if(!aMenus->getToolBarList().isEmpty() && 
102      aMenus->getToolBarList().at(theToolBarId)!=NULL) {
103     aMenus->getToolBarList().at(theToolBarId)->hide();
104   }
105 }
106
107
108
109
110
111