VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkQtItemView.h,v $ 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 -------------------------------------------------------------------------*/ 00033 #ifndef __vtkQtItemView_h 00034 #define __vtkQtItemView_h 00035 00036 #include "QVTKWin32Header.h" 00037 #include "vtkView.h" 00038 00039 #include <QAbstractItemView> 00040 #include "vtkQtAbstractModelAdapter.h" 00041 00043 00045 class vtkQtItemView; 00046 class QItemSelectionModel; 00048 00049 class QVTK_EXPORT vtkQtSignalHandler : public QObject 00050 { 00051 Q_OBJECT 00052 public: 00053 void setTarget(vtkQtItemView* t) { this->Target = t; } 00054 public slots: 00055 void slotSelectionChanged(const QItemSelection&, const QItemSelection&); 00056 private: 00057 vtkQtItemView* Target; 00058 }; 00059 00060 class QVTK_EXPORT vtkQtItemView : public vtkView 00061 { 00062 public: 00063 static vtkQtItemView *New(); 00064 vtkTypeRevisionMacro(vtkQtItemView, vtkView); 00065 void PrintSelf(ostream& os, vtkIndent indent); 00066 00068 00069 virtual void SetItemView(QAbstractItemView*); 00070 QAbstractItemView* GetItemView(); 00072 00074 00075 virtual void SetItemModelAdapter(vtkQtAbstractModelAdapter* qma); 00076 vtkQtAbstractModelAdapter* GetItemModelAdapter(); 00078 00080 virtual void Update(); 00081 00082 protected: 00083 vtkQtItemView(); 00084 ~vtkQtItemView(); 00085 00087 00088 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, 00089 void* callData); 00091 00093 00095 virtual void AddInputConnection( int port, int index, 00096 vtkAlgorithmOutput* conn, 00097 vtkAlgorithmOutput* selectionConn); 00099 00101 00102 virtual void RemoveInputConnection( int port, int index, 00103 vtkAlgorithmOutput* conn, 00104 vtkAlgorithmOutput* selectionConn); 00106 00108 void QtSelectionChanged(const QItemSelection&, const QItemSelection&); 00109 00113 QItemSelectionModel* GetSelectionModel(); 00114 00115 private: 00116 vtkQtItemView(const vtkQtItemView&); // Not implemented. 00117 void operator=(const vtkQtItemView&); // Not implemented. 00118 00120 QAbstractItemView *ItemViewPtr; 00121 00123 vtkQtAbstractModelAdapter *ModelAdapterPtr; 00124 00126 QItemSelectionModel *SelectionModel; 00127 00130 int CheckViewAndModelError(); 00131 00133 00134 friend class vtkQtSignalHandler; 00135 vtkQtSignalHandler SignalHandler; 00137 00139 bool Selecting; 00140 00142 bool UseValueSelection; 00143 00145 char *ValueSelectionArrayName; 00146 00147 bool IOwnSelectionModel; 00148 00149 }; 00150 00151 #endif