VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtChartLegend.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 -------------------------------------------------------------------------*/ 00020 00023 00024 #ifndef _vtkQtChartLegend_h 00025 #define _vtkQtChartLegend_h 00026 00027 00028 #include "vtkQtChartExport.h" 00029 #include <QWidget> 00030 00031 class vtkQtChartLegendInternal; 00032 class vtkQtChartLegendModel; 00033 class QFont; 00034 class QPainter; 00035 class QPoint; 00036 class QRect; 00037 00038 00047 class VTKQTCHART_EXPORT vtkQtChartLegend : public QWidget 00048 { 00049 Q_OBJECT 00050 00051 public: 00052 enum LegendLocation 00053 { 00054 Left = 0, 00055 Top, 00056 Right, 00057 Bottom 00058 }; 00059 00060 enum ItemFlow 00061 { 00062 LeftToRight = 0, 00063 TopToBottom 00064 }; 00065 00066 public: 00070 vtkQtChartLegend(QWidget *parent=0); 00071 virtual ~vtkQtChartLegend(); 00072 00074 00075 00076 00077 00078 00079 vtkQtChartLegendModel *getModel() const {return this->Model;} 00080 00085 LegendLocation getLocation() const {return this->Location;} 00086 00095 void setLocation(LegendLocation location); 00096 00101 ItemFlow getFlow() const {return this->Flow;} 00102 00111 void setFlow(ItemFlow flow); 00113 00118 int getOffset() const; 00119 00124 virtual QSize sizeHint() const {return this->Bounds;} 00125 00129 void drawLegend(QPainter &painter); 00130 00131 signals: 00133 void locationChanged(); 00134 00135 public slots: 00137 void reset(); 00138 00146 void setOffset(int offset); 00147 00148 protected slots: 00152 void insertEntry(int index); 00153 00157 void startEntryRemoval(int index); 00158 00162 void finishEntryRemoval(int index); 00163 00167 void updateEntryText(int index); 00168 00172 void updateEntryVisible(int index); 00173 00174 protected: 00180 virtual bool event(QEvent *e); 00181 00185 virtual void paintEvent(QPaintEvent *e); 00186 00190 virtual void resizeEvent(QResizeEvent *e); 00191 00198 virtual void mousePressEvent(QMouseEvent *e); 00199 00206 virtual void mouseMoveEvent(QMouseEvent *e); 00207 00214 virtual void mouseReleaseEvent(QMouseEvent *e); 00215 00216 private: 00218 void calculateSize(); 00219 00221 void updateMaximum(); 00222 00223 private: 00224 vtkQtChartLegendInternal *Internal; 00225 vtkQtChartLegendModel *Model; 00226 LegendLocation Location; 00227 ItemFlow Flow; 00228 QSize Bounds; 00229 int IconSize; 00230 int TextSpacing; 00231 int Margin; 00232 00233 private: 00234 vtkQtChartLegend(const vtkQtChartLegend &); 00235 vtkQtChartLegend &operator=(const vtkQtChartLegend &); 00236 }; 00237 00238 #endif