00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00034 #ifndef __vtkQtTableView_h
00035 #define __vtkQtTableView_h
00036
00037 #include "QVTKWin32Header.h"
00038 #include "vtkQtView.h"
00039
00040 #include <QPointer>
00041 #include <QSortFilterProxyModel>
00042 #include "vtkQtAbstractModelAdapter.h"
00043 #include "vtkSmartPointer.h"
00044
00045 class vtkAddMembershipArray;
00046 class vtkApplyColors;
00047 class vtkDataObjectToTable;
00048 class vtkIdTypeArray;
00049 class QItemSelection;
00050 class QTableView;
00051 class vtkQtTableModelAdapter;
00052
00053 class QVTK_EXPORT vtkQtTableView : public vtkQtView
00054 {
00055 Q_OBJECT
00056
00057 public:
00058 static vtkQtTableView *New();
00059 vtkTypeRevisionMacro(vtkQtTableView, vtkQtView);
00060 void PrintSelf(ostream& os, vtkIndent indent);
00061
00065 virtual QWidget* GetWidget();
00066
00068 void SetShowVerticalHeaders(bool);
00069
00071 void SetShowHorizontalHeaders(bool);
00072
00073
00074 enum
00075 {
00076 FIELD_DATA = 0,
00077 POINT_DATA = 1,
00078 CELL_DATA = 2,
00079 VERTEX_DATA = 3,
00080 EDGE_DATA = 4,
00081 ROW_DATA = 5,
00082 };
00083
00084
00086
00088 vtkGetMacro(FieldType, int);
00089 void SetFieldType(int);
00091
00093 void SetEnableDragDrop(bool);
00094
00097 void SetSortingEnabled(bool);
00098
00100
00103 void SetShowAll(bool);
00104 vtkGetMacro(ShowAll, bool);
00106
00108
00110 vtkSetStringMacro(ColumnName);
00111 vtkGetStringMacro(ColumnName);
00113
00114 void SetColumnVisibility(const QString &name, bool status);
00115
00118 void SetSplitMultiComponentColumns(bool value);
00119
00122 bool GetSplitMultiComponentColumns();
00123
00125
00126 void SetSortSelectionToTop(bool value);
00127 vtkGetMacro(SortSelectionToTop, bool);
00129
00131
00133 void SetApplyRowColors(bool value);
00134 vtkGetMacro(ApplyRowColors, bool);
00136
00138 virtual void Update();
00139
00141
00142 void SetColorArrayName(const char* name);
00143 const char* GetColorArrayName();
00145
00147
00148 void SetColorByArray(bool vis);
00149 bool GetColorByArray();
00150 vtkBooleanMacro(ColorByArray, bool);
00152
00154 virtual void ApplyViewTheme(vtkViewTheme* theme);
00155
00156
00157 enum
00158 {
00159 SELECT_ITEMS = 0,
00160 SELECT_ROWS,
00161 SELECT_COLUMNS
00162 };
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
00213 vtkSmartPointer<vtkAddMembershipArray> AddSelectedColumn;
00214 vtkSmartPointer<vtkDataObjectToTable> DataObjectToTable;
00215 vtkSmartPointer<vtkApplyColors> ApplyColors;
00216
00217
00218 vtkQtTableView(const vtkQtTableView&);
00219 void operator=(const vtkQtTableView&);
00220
00221 };
00222
00223 #endif