Salome HOME
Merge remote-tracking branch 'origin/V8_3_BR' into ngr/python3_dev
[modules/gui.git] / src / SalomeApp / SalomeApp_ListView.h
index 89c7cbcb5092413a2851db62c760a38f28858305..f55cef0cf0f7baae3742d74b9dbedd1739a0399e 100644 (file)
@@ -1,34 +1,45 @@
-//  SALOME SalomeApp
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2005  CEA/DEN, EDF R&D
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  File   : SalomeApp_ListView.h
-//  Author : Vadim SANDLER
-//  Module : SALOME
-//  $Header$
 
+// File   : SalomeApp_ListView.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
 #ifndef SALOMEAPP_LISTVIEW_H
 #define SALOMEAPP_LISTVIEW_H
 
-#include <qlistview.h>
-#include <qlist.h>
-#include <qstring.h>
-#include <qpixmap.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
+//#include <QtxListView.h>
 
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qtoolbutton.h> 
-#endif
-//VRV: porting on Qt 3.0.5
+#include <SUIT_PopupClient.h>
+
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QString>
+#include <QLineEdit>
+#include <QComboBox>
 
 #include <TColStd_ListOfInteger.hxx>
 #include <TColStd_ListOfReal.hxx>
 
-#include <SUIT_PopupClient.h>
+class QToolButton; 
 
 // enumeration for ListView updating mode
 enum UpdateType {
@@ -43,11 +54,11 @@ enum UpdateType {
 class SalomeApp_ListViewItem;
 class SalomeApp_EntityEdit;
 
-//================================================================
-// Class        : SalomeApp_ListView
-// Description  : parent class for Data Viewer and Properties Viewer
-//================================================================
-class SalomeApp_ListView : public QListView , public SUIT_PopupClient  {
+/*!
+  \class SalomeApp_ListView
+  parent class for Data Viewer and Properties Viewer
+*/
+class SalomeApp_ListView : public QTreeWidget/*QtxListView*/ , public SUIT_PopupClient  {
   
   Q_OBJECT
     
@@ -64,7 +75,7 @@ public:
 
 // fills popup with items
   virtual QString popupClientType() const;
-  virtual void    contextMenuPopup( QPopupMenu* );
+  virtual void    contextMenuPopup( QMenu* );
 
 // setting editing of items availbale/not available
   void enableEditing(bool theFlag);
@@ -176,10 +187,10 @@ public:
 
 public:
   SalomeApp_EntityEdit( QWidget* parent, 
-                       int      controlType = etLineEdit, 
-                       int      valueType   = vtString,
-                       bool     butApply    = false, 
-                       bool     butCancel   = false);
+                        int      controlType = etLineEdit, 
+                        int      valueType   = vtString,
+                        bool     butApply    = false, 
+                        bool     butCancel   = false);
   ~SalomeApp_EntityEdit();
 
   void finishEditing();
@@ -187,18 +198,18 @@ public:
   QString getText();
   void setText(const QString& theText );
   void insertItem( const QString& theValue, 
-                  bool           theSetCurrent = false,
-                  int            theOrder = atBottom );
+                   bool           theSetCurrent = false,
+                   int            theOrder = atBottom );
   void insertList( const QStringList& theList, 
-                  const int          theCurrent = -1 );
+                   const int          theCurrent = -1 );
   void insertItem( const int theValue, 
-                  bool  theSetCurrent = false );
+                   bool  theSetCurrent = false );
   void insertList( const TColStd_ListOfInteger& theList, 
-                  const int                    theCurrent = -1 );
+                   const int                    theCurrent = -1 );
   void insertItem( const double theValue, 
-                  bool         theSetCurrent = false );
+                   bool         theSetCurrent = false );
   void insertList( const TColStd_ListOfReal& theList, 
-                  const int                 theCurrent = -1 );
+                   const int                 theCurrent = -1 );
   QWidget* getControl();
   void setFocus();
   void setValidator(const QValidator*);
@@ -226,44 +237,36 @@ private:
   QString              myString;
 };
 
-class SalomeApp_ListViewItem : public QListViewItem
+class SalomeApp_ListViewItem : public QTreeWidgetItem
 {
 public:
   SalomeApp_ListViewItem( SalomeApp_ListView* );
   SalomeApp_ListViewItem( SalomeApp_ListView*, 
-                         SalomeApp_ListViewItem* );
-  SalomeApp_ListViewItem( SalomeApp_ListView*,
-                         const QString&,
-                         const bool = false );
+                          SalomeApp_ListViewItem* );
   SalomeApp_ListViewItem( SalomeApp_ListView*,
-                         const QString& theName,
-                         const QString& theValue, 
-                         const bool = false );
-  SalomeApp_ListViewItem( SalomeApp_ListViewItem* theParent,
-                         const QString&,
-                         const bool = false );
-  SalomeApp_ListViewItem( SalomeApp_ListView*,
-                         SalomeApp_ListViewItem*,
-                         const QString&,
-                         const bool = false );
+                          const QStringList&,
+                          const bool = false );
   SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
-                         SalomeApp_ListViewItem*,
-                         const QString&,
-                         const bool = false);
+                          const QStringList&,
+                          const bool = false );
+  SalomeApp_ListViewItem( SalomeApp_ListView*,
+                          SalomeApp_ListViewItem*,
+                          const QString&,
+                          const bool = false );
   SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
-                         const QString& theName,
-                         const QString& theValue, 
-                         const bool = false);
+                          SalomeApp_ListViewItem*,
+                          const QString&,
+                          const bool = false);
   SalomeApp_ListViewItem( SalomeApp_ListView*,
-                         SalomeApp_ListViewItem*,
-                         const QString& theName,
-                         const QString& theValue, 
-                         const bool = false);
+                          SalomeApp_ListViewItem*,
+                          const QString& theName,
+                          const QString& theValue, 
+                          const bool = false);
   SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
-                         SalomeApp_ListViewItem*,
-                         const QString&,
-                         const QString&, 
-                         const bool = false);
+                          SalomeApp_ListViewItem*,
+                          const QString&,
+                          const QString&, 
+                          const bool = false);
   ~SalomeApp_ListViewItem();
 
   QString            fullName();
@@ -326,6 +329,7 @@ public:
 protected:
   // initialization
   void               init();
+  int                depth() const;
 
 private:
   bool myEditable;