VTK
dox/GUISupport/Qt/vtkQtListView.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkQtListView.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00031 #ifndef __vtkQtListView_h
00032 #define __vtkQtListView_h
00033 
00034 #include "QVTKWin32Header.h"
00035 #include "vtkQtView.h"
00036 
00037 #include <QPointer>
00038 #include <QImage>
00039 #include <QSortFilterProxyModel>
00040 #include "vtkQtAbstractModelAdapter.h"
00041 #include "vtkSmartPointer.h"
00042 
00043 class vtkApplyColors;
00044 class vtkDataObjectToTable;
00045 class QItemSelection;
00046 class QListView;
00047 class vtkQtTableModelAdapter;
00048 
00049 class QVTK_EXPORT vtkQtListView : public vtkQtView
00050 {
00051 Q_OBJECT
00052 
00053 public:
00054   static vtkQtListView *New();
00055   vtkTypeMacro(vtkQtListView, vtkQtView);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057   
00061   virtual QWidget* GetWidget();
00062 
00063   enum
00064     {
00065     FIELD_DATA = 0,
00066     POINT_DATA = 1,
00067     CELL_DATA = 2,
00068     VERTEX_DATA = 3,
00069     EDGE_DATA = 4,
00070     ROW_DATA = 5,
00071     };
00072   
00074 
00076   vtkGetMacro(FieldType, int);
00077   void SetFieldType(int);
00079 
00081   void SetEnableDragDrop(bool);
00082 
00084   void SetAlternatingRowColors(bool);
00085 
00089   void SetDecorationStrategy(int);
00090 
00092 
00093   void SetColorArrayName(const char* name);
00094   const char* GetColorArrayName();
00096   
00098 
00099   void SetColorByArray(bool vis);
00100   bool GetColorByArray();
00101   vtkBooleanMacro(ColorByArray, bool);
00103 
00105   void SetVisibleColumn(int col);
00106 
00108   void SetFilterRegExp(const QRegExp& pattern);
00109 
00111 
00113   void SetIconSheet(QImage sheet);
00114   void SetIconSize(int w, int h);
00115   void SetIconSheetSize(int w, int h);
00116   void SetIconArrayName(const char* name);
00118 
00119   virtual void ApplyViewTheme(vtkViewTheme* theme);
00120 
00122   virtual void Update();
00123 
00124 protected:
00125   vtkQtListView();
00126   ~vtkQtListView();
00127 
00128   virtual void AddRepresentationInternal(vtkDataRepresentation* rep);
00129   virtual void RemoveRepresentationInternal(vtkDataRepresentation* rep);
00130 
00131 private slots:
00132   void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
00133 
00134 private:
00135   void SetVTKSelection();
00136 
00137   unsigned long LastSelectionMTime;
00138   unsigned long LastInputMTime;
00139   unsigned long LastMTime;
00140 
00141   vtkSetStringMacro(ColorArrayNameInternal);
00142   vtkGetStringMacro(ColorArrayNameInternal);
00143   vtkSetStringMacro(IconIndexArrayNameInternal);
00144   vtkGetStringMacro(IconIndexArrayNameInternal);
00145 
00146   QPointer<QListView> ListView;
00147   vtkQtTableModelAdapter* TableAdapter;
00148   QSortFilterProxyModel* TableSorter;
00149   char* ColorArrayNameInternal;
00150   char* IconIndexArrayNameInternal;
00151   char* VisibleColumnName;
00152   bool SortSelectionToTop;
00153   bool ApplyRowColors;
00154   int FieldType;
00155   int VisibleColumn;
00156   
00157   vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
00158   vtkSmartPointer<vtkApplyColors> ApplyColors;
00159 
00160   vtkQtListView(const vtkQtListView&);  // Not implemented.
00161   void operator=(const vtkQtListView&);  // Not implemented.
00162   
00163 };
00164 
00165 #endif