X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.h;h=a1e5c5ef1dd4b5bfbc04684db0424fb5cb07cbef;hb=47c18d4de2719126f6b045b5c37525cd8f170aa1;hp=0d1043c0f3f3734b3cee40abb3165529f24fdf61;hpb=bfc592b7af1751c4a64d5e545f5ac1dc513ecd01;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index 0d1043c0f..a1e5c5ef1 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -2,17 +2,58 @@ #ifndef XGUI_ObjectsBrowser_H #define XGUI_ObjectsBrowser_H -#include "XGUI_Constants.h" +#include "XGUI.h" +#include +#include #include class XGUI_DocumentDataModel; +class QLineEdit; + + +class XGUI_DataTree: public QTreeView +{ + Q_OBJECT +public: + XGUI_DataTree(QWidget* theParent); + virtual ~XGUI_DataTree(); + + //! Returns list of currently selected features + QFeatureList selectedFeatures() const { return mySelectedData; } + + XGUI_DocumentDataModel* dataModel() const; + +signals: + //! Emited when selection is changed + void selectionChanged(); + void activePartChanged(FeaturePtr thePart); + + //! Emited on context menu request + void contextMenuRequested(QContextMenuEvent* theEvent); + +protected slots: + virtual void commitData(QWidget* theEditor); + +protected: + virtual void mouseDoubleClickEvent(QMouseEvent* theEvent); + virtual void contextMenuEvent(QContextMenuEvent* theEvent); + +private slots: + //! Called when selection in Data Tree is changed + void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected); + +private: + //! List of currently selected data + QFeatureList mySelectedData; +}; + /**\class XGUI_ObjectsBrowser * \ingroup GUI * \brief Object browser window object. Represents data tree of current data structure */ - class XGUI_ObjectsBrowser : public QTreeView + class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget { Q_OBJECT public: @@ -23,23 +64,54 @@ public: XGUI_DocumentDataModel* dataModel() const { return myDocModel; } //! Returns list of currently selected features - QFeatureList selectedData() const { return mySelectedData; } + QFeatureList selectedFeatures() const { return myFeaturesList; } + + void setFeaturesSelected(const QFeatureList& theFeatures); + + //! Returns currently selected indexes + QModelIndexList selectedIndexes() const { return myTreeView->selectionModel()->selectedIndexes(); } + + //! Returns TreeView widget + XGUI_DataTree* treeView() const { return myTreeView; } + + //! Activates currently selected part. Signal activePartChanged will not be sent + void activatePart(const FeaturePtr& thePart); + + void rebuildDataTree(); signals: //! Emited when selection is changed void selectionChanged(); + //! Emited when current active document is changed + void activePartChanged(FeaturePtr thePart); + + //! Emited on context menu request + void contextMenuRequested(QContextMenuEvent* theEvent); + +protected: + virtual bool eventFilter(QObject* obj, QEvent* theEvent); private slots: - //! Called when selection in Data Tree is changed - void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected); + void onActivePartChanged(FeaturePtr thePart); + void onContextMenuRequested(QContextMenuEvent* theEvent); + void onLabelContextMenuRequested(const QPoint& thePnt); + + //! Called on Edit command request + void onEditItem(); + + void onSelectionChanged(); private: + void closeDocNameEditing(bool toSave); + //! Internal model XGUI_DocumentDataModel* myDocModel; - //! List of currently selected data - QFeatureList mySelectedData; + QLineEdit* myActiveDocLbl; + XGUI_DataTree* myTreeView; + + QFeatureList myFeaturesList; }; #endif \ No newline at end of file