VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtTableView.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 -------------------------------------------------------------------------*/ 00037 #ifndef __vtkQtTableView_h 00038 #define __vtkQtTableView_h 00039 00040 #include "vtkViewsQtModule.h" // For export macro 00041 #include "QVTKWin32Header.h" 00042 #include "vtkQtView.h" 00043 00044 #include <QPointer> 00045 #include <QSortFilterProxyModel> 00046 #include "vtkQtAbstractModelAdapter.h" 00047 #include "vtkSmartPointer.h" 00048 00049 class vtkAddMembershipArray; 00050 class vtkApplyColors; 00051 class vtkDataObjectToTable; 00052 class vtkIdTypeArray; 00053 class QItemSelection; 00054 class QTableView; 00055 class vtkQtTableModelAdapter; 00056 00057 class VTKVIEWSQT_EXPORT vtkQtTableView : public vtkQtView 00058 { 00059 Q_OBJECT 00060 00061 public: 00062 static vtkQtTableView *New(); 00063 vtkTypeMacro(vtkQtTableView, vtkQtView); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00069 virtual QWidget* GetWidget(); 00070 00072 void SetShowVerticalHeaders(bool); 00073 00075 void SetShowHorizontalHeaders(bool); 00076 00077 enum 00078 { 00079 FIELD_DATA = 0, 00080 POINT_DATA = 1, 00081 CELL_DATA = 2, 00082 VERTEX_DATA = 3, 00083 EDGE_DATA = 4, 00084 ROW_DATA = 5, 00085 }; 00086 00088 00090 vtkGetMacro(FieldType, int); 00091 void SetFieldType(int); 00093 00095 void SetEnableDragDrop(bool); 00096 00099 void SetSortingEnabled(bool); 00100 00102 00105 void SetShowAll(bool); 00106 vtkGetMacro(ShowAll, bool); 00108 00110 00112 vtkSetStringMacro(ColumnName); 00113 vtkGetStringMacro(ColumnName); 00115 00116 void SetColumnVisibility(const QString &name, bool status); 00117 00120 void SetSplitMultiComponentColumns(bool value); 00121 00124 bool GetSplitMultiComponentColumns(); 00125 00127 00128 void SetSortSelectionToTop(bool value); 00129 vtkGetMacro(SortSelectionToTop, bool); 00131 00133 00135 void SetApplyRowColors(bool value); 00136 vtkGetMacro(ApplyRowColors, bool); 00138 00140 virtual void Update(); 00141 00143 00144 void SetColorArrayName(const char* name); 00145 const char* GetColorArrayName(); 00147 00149 00150 void SetColorByArray(bool vis); 00151 bool GetColorByArray(); 00152 vtkBooleanMacro(ColorByArray, bool); 00154 00156 virtual void ApplyViewTheme(vtkViewTheme* theme); 00157 00158 enum 00159 { 00160 SELECT_ITEMS = 0, 00161 SELECT_ROWS, 00162 SELECT_COLUMNS 00163 }; 00164 00166 00171 virtual void SetSelectionBehavior(int type); 00172 virtual int GetSelectionBehavior(); 00174 00180 virtual void GetSelectedItems(vtkIdTypeArray* arr); 00181 00182 protected: 00183 vtkQtTableView(); 00184 ~vtkQtTableView(); 00185 00186 virtual void AddRepresentationInternal(vtkDataRepresentation* rep); 00187 virtual void RemoveRepresentationInternal(vtkDataRepresentation* rep); 00188 00189 private slots: 00190 void slotQtSelectionChanged(const QItemSelection&,const QItemSelection&); 00191 00192 private: 00193 void SetVTKSelection(); 00194 unsigned long LastSelectionMTime; 00195 unsigned long LastInputMTime; 00196 unsigned long LastMTime; 00197 00198 vtkSetStringMacro(ColorArrayNameInternal); 00199 vtkGetStringMacro(ColorArrayNameInternal); 00200 00201 QPointer<QTableView> TableView; 00202 vtkQtTableModelAdapter* TableAdapter; 00203 QSortFilterProxyModel* TableSorter; 00204 int FieldType; 00205 bool ShowAll; 00206 char* ColumnName; 00207 bool InSelectionChanged; 00208 bool SortSelectionToTop; 00209 bool ApplyRowColors; 00210 char* ColorArrayNameInternal; 00211 00212 vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn; 00213 vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable; 00214 vtkSmartPointer<vtkApplyColors> ApplyColors; 00215 00216 vtkQtTableView(const vtkQtTableView&); // Not implemented. 00217 void operator=(const vtkQtTableView&); // Not implemented. 00218 00219 }; 00220 00221 #endif