]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Module.h
Salome HOME
Switch off multi selection during line edit operation.
[modules/shaper.git] / src / PartSet / PartSet_Module.h
1 #ifndef PartSet_Module_H
2 #define PartSet_Module_H
3
4 #include "PartSet.h"
5
6 #include <XGUI_Module.h>
7 #include <XGUI_Command.h>
8
9 #include <QMap>
10 #include <QObject>
11
12 #include <string>
13
14 #include <boost/shared_ptr.hpp>
15
16 class QMouseEvent;
17 class QKeyEvent;
18 class PartSet_Listener;
19 class ModelAPI_Feature;
20
21 class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
22 {
23 Q_OBJECT
24
25 public:
26   PartSet_Module(XGUI_Workshop* theWshop);
27   virtual ~PartSet_Module();
28
29   /// Returns the module workshop
30   /// \returns a workshop instance
31   XGUI_Workshop* workshop() const;
32
33   virtual void createFeatures();
34   virtual void featureCreated(XGUI_Command* theFeature);
35   virtual QStringList nestedFeatures(QString theFeature);
36   std::string featureFile(const std::string&);
37
38   /// Creates an operation and send it to loop
39   /// \param theCmdId the operation name
40   virtual void launchOperation(const QString& theCmdId);
41
42   /// Displays or erase the current operation preview, if it has it.
43   /// \param theF
44   /// \param isDisplay the state whether the presentation should be displayed or erased
45   void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay);
46
47 public slots:
48   void onFeatureTriggered();
49   /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
50   /// by the operation start
51   void onOperationStopped(ModuleBase_Operation* theOperation);
52
53   /// SLOT, that is called by the selection in the viewer is changed.
54   /// The selection is sent to the current operation if it listens selection.
55   void onSelectionChanged();
56   /// SLOT, that is called by mouse press in the viewer.
57   /// The mouse released point is sent to the current operation to be processed.
58   /// \param theEvent the mouse event
59   void onMousePressed(QMouseEvent* theEvent);
60   /// SLOT, that is called by mouse release in the viewer.
61   /// The mouse released point is sent to the current operation to be processed.
62   /// \param theEvent the mouse event
63   void onMouseReleased(QMouseEvent* theEvent);
64   /// SLOT, that is called by mouse move in the viewer.
65   /// The mouse moved point is sent to the current operation to be processed.
66   /// \param theEvent the mouse event
67   void onMouseMoved(QMouseEvent* theEvent);
68
69   /// SLOT, that is called by the key in the viewer is clicked.
70   /// \param theEvent the mouse event
71   void onKeyRelease(QKeyEvent*);
72
73   /// SLOT, to apply to the current viewer the operation
74   /// \param theX the X projection value
75   /// \param theY the Y projection value
76   /// \param theZ the Z projection value
77   void onPlaneSelected(double theX, double theY, double theZ);
78
79   void onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
80
81   /// SLOT, to switch on/off the multi selection in the viewer
82   /// \param theEnabled the enabled state
83   void onMultiSelectionEnabled(bool theEnabled);
84
85   /// SLOT, to visualize the feature in another local context mode
86   /// \param theFeature the feature to be put in another local context mode
87   /// \param theMode the mode appeared on the feature
88   void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
89                             int theMode);
90 protected:
91   /// Creates a new operation
92   /// \param theCmdId the operation name
93   ModuleBase_Operation* createOperation(const std::string& theCmdId);
94
95   /// Sends the operation
96   /// \param theOperation the operation
97   void sendOperation(ModuleBase_Operation* theOperation);
98
99 private:
100   XGUI_Workshop* myWorkshop;
101   PartSet_Listener* myListener;
102
103   std::map<std::string, std::string> myFeaturesInFiles;
104 };
105
106 #endif