Salome HOME
fd1adbed8b1cc6b1852fecc7e96706b1fb9fc00a
[modules/shaper.git] / src / XGUI / XGUI_ObjectsBrowser.h
1
2 #ifndef XGUI_ObjectsBrowser_H
3 #define XGUI_ObjectsBrowser_H
4
5 #include "XGUI.h"
6 #include "XGUI_Constants.h"
7
8 #include <QTreeView>
9
10 class XGUI_DocumentDataModel;
11
12 /**\class XGUI_ObjectsBrowser
13  * \ingroup GUI
14  * \brief Object browser window object. Represents data tree of current data structure
15  */
16  class XGUI_EXPORT XGUI_ObjectsBrowser : public QTreeView
17 {
18   Q_OBJECT
19 public:
20   XGUI_ObjectsBrowser(QWidget* theParent);
21   virtual ~XGUI_ObjectsBrowser();
22
23   //! Returns Model which provides access to data objects
24   XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
25
26   //! Returns list of currently selected features
27   QFeatureList selectedFeatures() const { return mySelectedData; }
28
29 signals:
30   //! Emited when selection is changed
31   void selectionChanged();
32   void activePartChanged(FeaturePtr thePart); 
33  
34   //! Emited on context menu request
35   void contextMenuRequested(QContextMenuEvent* theEvent);
36
37 protected:
38   virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
39   virtual void contextMenuEvent(QContextMenuEvent* theEvent);
40
41 private slots:
42   //! Called when selection in Data Tree is changed
43   void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
44
45 private:
46   //! Internal model
47   XGUI_DocumentDataModel* myDocModel;
48
49   //! List of currently selected data
50   QFeatureList mySelectedData;
51
52   //QModelIndex myActivePartIndex;
53 };
54
55 #endif