X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.h;h=a1e5c5ef1dd4b5bfbc04684db0424fb5cb07cbef;hb=47c18d4de2719126f6b045b5c37525cd8f170aa1;hp=b0949534bb6e321af70a2c9fe74cfdf484b9f027;hpb=8396394eba586fc212fe4cb3e1e838a54ebf4ffe;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index b0949534b..a1e5c5ef1 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -3,17 +3,57 @@ #define XGUI_ObjectsBrowser_H #include "XGUI.h" -#include "XGUI_Constants.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_EXPORT XGUI_ObjectsBrowser : public QTreeView + class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget { Q_OBJECT public: @@ -24,23 +64,54 @@ public: XGUI_DocumentDataModel* dataModel() const { return myDocModel; } //! Returns list of currently selected features - QFeatureList selectedFeatures() 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