1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_MenuMgr.h
4 // Created: 03 April 2015
5 // Author: Vitaly SMETANNIKOV
7 #ifndef PartSet_MenuMgr_H
8 #define PartSet_MenuMgr_H
10 #include <ModelAPI_Feature.h>
24 * A class for management of module specific menu
26 class PartSet_MenuMgr: public QObject
31 /// \param theModule a parent module
32 PartSet_MenuMgr(PartSet_Module* theModule);
35 /// Returns action according to the given ID
36 /// \param theId an action identifier, it should be uniqued in the bounds of the module
37 QAction* action(const QString& theId) const;
39 /// Add menu atems for viewer into the given menu
40 /// \param theMenu a popup menu to be shown in the viewer
41 /// \param theStdActions a map of standard actions
42 /// \return true if items are added and there is no necessity to provide standard menu
43 bool addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const;
46 /// Processes the context menu action click
47 /// \param isChecked a state of toggle if the action is checkable
48 void onAction(bool isChecked);
52 /// A slot which is called on selection of menu item coresponding to line with coincedence
53 /// \param theAction an action of the selected item
54 void onLineHighlighted(QAction* theAction);
56 /// A slot which is called on hiding Detach menu
57 void onDetachMenuHide();
59 /// A slot which is called on selection an Item in Detach menu
60 /// \param theAction an action of the selected item
61 void onLineDetach(QAction* theAction);
63 /// A slot called on Part activation command
64 void onActivatePart(bool);
66 /// A slot called on PartSet activation command
67 void onActivatePartSet(bool);
69 /// A slot called on edit of feature
73 /// Returns true if the current operation is sketch entity create operation
74 /// \param theValue the current auxiliary value
75 /// \return the boolean result
76 bool canSetAuxiliary(bool& theValue) const;
78 /// Changes the sketcher entity construction argument value
79 /// \param isChecked if true, the feature is a construction
80 void setAuxiliary(const bool isChecked);
82 /// Create all actions for context menus. It is called on creation of module
83 /// Put the created actions into an internal map
86 /// Add action to the internal map
87 /// \param theId - string ID of the item
88 /// \param theAction - action to add
89 void addAction(const QString& theId, QAction* theAction);
91 /// Set color on presentation of result listed in myCoinsideLines
92 /// \param theId object Id in myCoinsideLines list
93 /// \param theColor a color which has to be set
94 /// \param theUpdate update viewer flag
95 /// \return previously defined color on the object
96 QColor setLineColor(int theId, const QColor theColor, bool theUpdate);
98 /// Reference to a parent module
99 PartSet_Module* myModule;
101 /// the popup menu actions
102 QMap<QString, QAction*> myActions;
104 /// List of lines coincided in a one point
105 mutable QList<FeaturePtr> myCoinsideLines;
107 /// A Coincedence feature selected by user for detaching
108 mutable FeaturePtr mySelectedFeature;
110 /// Id of menu item in Detach menu previously selected
113 /// Original color of highlighted line