Salome HOME
Porting to SALOME_8.2.0 : Selection with SHIFT in sketch, stayed selection of point...
[modules/shaper.git] / src / XGUI / XGUI_SelectionMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #ifndef XGUI_SelectionMgr_H
4 #define XGUI_SelectionMgr_H
5
6 #include "XGUI.h"
7 #include <ModuleBase_Definitions.h>
8 #include <ModuleBase_ISelection.h>
9 #include <QObject>
10 #include <QModelIndexList>
11
12 #include <AIS_ListOfInteractive.hxx>
13 #include <NCollection_List.hxx>
14 #include <TopoDS_Shape.hxx>
15 #include <SelectMgr_IndexedMapOfOwner.hxx>
16
17 class XGUI_Workshop;
18 class XGUI_ObjectsBrowser;
19 class XGUI_Selection;
20
21 /**\class XGUI_SelectionMgr
22  * \ingroup GUI
23  * \brief Selection manager. Provides selection event on selection in 
24  * Object Browser and Viewer
25  */
26 class XGUI_EXPORT XGUI_SelectionMgr : public QObject
27 {
28 Q_OBJECT
29  public:
30    /// Constructor
31    /// \param theParent a parent workshop
32   XGUI_SelectionMgr(XGUI_Workshop* theParent);
33   virtual ~XGUI_SelectionMgr();
34
35   /// Returns current selection
36   XGUI_Selection* selection() const
37   {
38     return mySelection;
39   }
40
41   //! Connects the manager to all viewers accessible by Workshop
42   void connectViewers();
43
44   //! Selects the owners in the context.
45   //! \param theSelectedOwners a container of owners
46   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
47   void setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners,
48                          bool isUpdateViewer);
49
50   //! Clears selection in Viewer and object Browser
51   void clearSelection();
52
53   /// Updates selection, which are depend on the selection in the given place
54   /// \param thePlace a widget where selection has happened.
55   void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace);
56
57 signals:
58   //! Emited when selection in a one of viewers was changed
59   void selectionChanged();
60
61  private slots:
62    /// Reaction on selectio0n in Object browser
63   void onObjectBrowserSelection();
64
65    /// Reaction on selectio0n in Viewer
66   void onViewerSelection();
67
68  private:
69    /// Reference to workshop
70   XGUI_Workshop* myWorkshop;
71
72   /// Current selection object
73   XGUI_Selection* mySelection;
74 };
75
76 #endif