00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00031 #ifndef __vtkQtListView_h
00032 #define __vtkQtListView_h
00033 
00034 #include "QVTKWin32Header.h"
00035 #include "vtkQtView.h"
00036 
00037 #include <QPointer>
00038 #include <QSortFilterProxyModel>
00039 #include "vtkQtAbstractModelAdapter.h"
00040 #include "vtkSmartPointer.h"
00041 
00042 class vtkApplyColors;
00043 class vtkDataObjectToTable;
00044 class QItemSelection;
00045 class QListView;
00046 class vtkQtTableModelAdapter;
00047 
00048 class QVTK_EXPORT vtkQtListView : public vtkQtView
00049 {
00050 Q_OBJECT
00051 
00052 public:
00053   static vtkQtListView *New();
00054   vtkTypeMacro(vtkQtListView, vtkQtView);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056   
00060   virtual QWidget* GetWidget();
00061 
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   
00073   
00075 
00077   vtkGetMacro(FieldType, int);
00078   void SetFieldType(int);
00080 
00082   void SetEnableDragDrop(bool);
00083 
00085   void SetAlternatingRowColors(bool);
00086 
00090   void SetDecorationStrategy(int);
00091 
00093 
00094   void SetColorArrayName(const char* name);
00095   const char* GetColorArrayName();
00097   
00099 
00100   void SetColorByArray(bool vis);
00101   bool GetColorByArray();
00102   vtkBooleanMacro(ColorByArray, bool);
00104 
00106   void SetVisibleColumn(int col);
00107 
00109   void SetFilterRegExp(const QRegExp& pattern);
00110 
00112 
00114   void SetIconSheet(QImage sheet);
00115   void SetIconSize(int w, int h);
00116   void SetIconSheetSize(int w, int h);
00117   void SetIconArrayName(const char* name);
00119 
00120   virtual void ApplyViewTheme(vtkViewTheme* theme);
00121 
00123   virtual void Update();
00124 
00125 protected:
00126   vtkQtListView();
00127   ~vtkQtListView();
00128 
00129   virtual void AddRepresentationInternal(vtkDataRepresentation* rep);
00130   virtual void RemoveRepresentationInternal(vtkDataRepresentation* rep);
00131 
00132 private slots:
00133   void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&);
00134 
00135 private:
00136   void SetVTKSelection();
00137 
00138   unsigned long LastSelectionMTime;
00139   unsigned long LastInputMTime;
00140   unsigned long LastMTime;
00141 
00142   vtkSetStringMacro(ColorArrayNameInternal);
00143   vtkGetStringMacro(ColorArrayNameInternal);
00144   vtkSetStringMacro(IconIndexArrayNameInternal);
00145   vtkGetStringMacro(IconIndexArrayNameInternal);
00146 
00147   QPointer<QListView> ListView;
00148   vtkQtTableModelAdapter* TableAdapter;
00149   QSortFilterProxyModel* TableSorter;
00150   char* ColorArrayNameInternal;
00151   char* IconIndexArrayNameInternal;
00152   char* VisibleColumnName;
00153   bool SortSelectionToTop;
00154   bool ApplyRowColors;
00155   int FieldType;
00156   int VisibleColumn;
00157   
00158 
00159   vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
00160   vtkSmartPointer<vtkApplyColors> ApplyColors;
00161 
00162 
00163   vtkQtListView(const vtkQtListView&);  
00164   void operator=(const vtkQtListView&);  
00165   
00166 };
00167 
00168 #endif