SHAPER 9.16.0
PartSet_MenuMgr.h
1// Copyright (C) 2014-2026 CEA, EDF
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#ifndef PartSet_MenuMgr_H
21#define PartSet_MenuMgr_H
22
23#include <ModelAPI_Feature.h>
24#include <ModelAPI_ResultPart.h>
25
26#include <QObject>
27#include <QMap>
28#include <QString>
29#include <QList>
30#include <QColor>
31
33class PartSet_Module;
34class QAction;
35class QMenu;
36
42{
43 Q_OBJECT
44public:
48
49
52 QAction* action(const QString& theId) const;
53
59 bool addViewerMenu(const QMap<QString, QAction*>& theStdActions,
60 QWidget* theParent,
61 QMap<int, QAction*>& theMenuActions) const;
62
65 void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
66
68 void activatePartSet() const;
69
71 virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
72
74 void activatePart(ResultPartPtr thePart) const;
75
76public slots:
79 void onAction(bool isChecked);
80
81private slots:
82
85 void onLineHighlighted(QAction* theAction);
86
88 void onDetachMenuHide();
89
92 void onLineDetach(QAction* theAction);
93
95 void onActivatePart(bool);
96
98 void onActivatePartSet(bool);
99
101 void onEdit(bool);
102
104 void onActivateAllParts();
105
106protected:
110 virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
111
112private:
116 bool canSetAuxiliary(bool& theValue) const;
117
120 void setAuxiliary(const bool isChecked);
121
124 void createActions();
125
129 void addAction(const QString& theId, QAction* theAction);
130
136 QColor setLineColor(int theId, const QColor theColor, bool theUpdate);
137
139 PartSet_Module* myModule;
140
142 QMap<QString, QAction*> myActions;
143
145 mutable QList<FeaturePtr> myCoinsideLines;
146
148 mutable FeaturePtr mySelectedFeature;
149
151 int myPrevId;
152
154 QColor myColor;
155};
156
157#endif
Base class for all operations.
Definition: ModuleBase_Operation.h:53
A class for management of module specific menu.
Definition: PartSet_MenuMgr.h:42
PartSet_MenuMgr(PartSet_Module *theModule)
Constructor.
Definition: PartSet_MenuMgr.cpp:66
QAction * action(const QString &theId) const
Returns action according to the given ID.
Definition: PartSet_MenuMgr.cpp:73
virtual void grantedOperationIds(ModuleBase_Operation *theOperation, QStringList &theIds) const
Returns list of granted operation indices.
Definition: PartSet_MenuMgr.cpp:569
bool addViewerMenu(const QMap< QString, QAction * > &theStdActions, QWidget *theParent, QMap< int, QAction * > &theMenuActions) const
Add menu items for viewer into the actions map.
Definition: PartSet_MenuMgr.cpp:127
void activatePartSet() const
Activates a PartSet document.
Definition: PartSet_MenuMgr.cpp:554
void onAction(bool isChecked)
Processes the context menu action click.
Definition: PartSet_MenuMgr.cpp:117
void updateViewerMenu(const QMap< QString, QAction * > &theStdActions)
Update state of pop-up menu items in viewer.
Definition: PartSet_MenuMgr.cpp:231
virtual bool eventFilter(QObject *theObj, QEvent *theEvent)
Redefinition of virtual method.
Definition: PartSet_MenuMgr.cpp:601
void activatePart(ResultPartPtr thePart) const
Activates a Part document.
Definition: PartSet_MenuMgr.cpp:496
Implementation of Partset module.
Definition: PartSet_Module.h:69