Salome HOME
Update classes documentation
[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   //! Check that the selected owners are valid for the current filters
51   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
52   void updateSelectedOwners(bool isUpdateViewer);
53
54   //! Clears selection in Viewer and object Browser
55   void clearSelection();
56
57   /// Updates selection, which are depend on the selection in the given place
58   /// \param thePlace a widget where selection has happened.
59   void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace);
60
61 signals:
62   //! Emited when selection in a one of viewers was changed
63   void selectionChanged();
64
65  private slots:
66    /// Reaction on selectio0n in Object browser
67   void onObjectBrowserSelection();
68
69    /// Reaction on selectio0n in Viewer
70   void onViewerSelection();
71
72  private:
73    /// Reference to workshop
74   XGUI_Workshop* myWorkshop;
75
76   /// Current selection object
77   XGUI_Selection* mySelection;
78 };
79
80 #endif