/usr/include/vtkQtChartLegend.h is in libvtk5-qt4-dev 5.8.0-14.1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkQtChartLegend.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
/// \file vtkQtChartLegend.h
/// \date February 12, 2008
#ifndef _vtkQtChartLegend_h
#define _vtkQtChartLegend_h
#include "vtkQtChartExport.h"
#include <QWidget>
class vtkQtChartLegendInternal;
class vtkQtChartLegendModel;
class QFont;
class QPainter;
class QPoint;
class QRect;
/// \class vtkQtChartLegend
/// \brief
/// The vtkQtChartLegend class displays a chart legend.
///
/// A vtkQtChartLegendModel is used to describe the entries. Each entry
/// can have an icon and a label. The icon is used to visually
/// identify the series on the chart. For a line chart series, the
/// image should be drawn in the same color and line style.
class VTKQTCHART_EXPORT vtkQtChartLegend : public QWidget
{
Q_OBJECT
public:
enum LegendLocation
{
Left = 0, ///< Place the legend on the left of the chart.
Top, ///< Place the legend on the top of the chart.
Right, ///< Place the legend on the right of the chart.
Bottom ///< Place the legend on the bottom of the chart.
};
enum ItemFlow
{
LeftToRight = 0, ///< Items are arranged left to right.
TopToBottom ///< Items are arranged top to bottom.
};
public:
/// \brief
/// Creates a chart legend instance.
/// \param parent The parent widget.
vtkQtChartLegend(QWidget *parent=0);
virtual ~vtkQtChartLegend();
/// \name Setup Methods
//@{
/// \brief
/// Gets the legend model.
/// \return
/// A pointer to the legend model.
vtkQtChartLegendModel *getModel() const {return this->Model;}
/// \brief
/// Gets the legend location.
/// \return
/// The legend location.
LegendLocation getLocation() const {return this->Location;}
/// \brief
/// Sets the legend location.
///
/// The chart uses the location to place the legend in the
/// appropriate place. The combination of location and flow
/// determine how the legend looks.
///
/// \param location The new legend location.
void setLocation(LegendLocation location);
/// \brief
/// Gets the legend item flow.
/// \return
/// The legend item flow.
ItemFlow getFlow() const {return this->Flow;}
/// \brief
/// Sets the legend item flow.
///
/// The flow is used to determine the layout direction of the
/// legend entries. Depending on the location, the same flow type
/// can look different.
///
/// \param flow The new item flow.
void setFlow(ItemFlow flow);
//@}
/// \brief
/// Gets the panning offset.
/// \return
/// The current panning offset.
int getOffset() const;
/// \brief
/// Gets the preferred size of the chart legend.
/// \return
/// The preferred size of the chart legend.
virtual QSize sizeHint() const {return this->Bounds;}
/// \brief
/// Draws the legend using the given painter.
/// \param painter The painter to use.
void drawLegend(QPainter &painter);
signals:
/// Emitted when the legend location is changed.
void locationChanged();
public slots:
/// Resets the chart legend.
void reset();
/// \brief
/// Sets the panning offset.
///
/// The offset is applied to the x or y axis depending on the
/// legend's location.
///
/// \param offset The new panning offset.
void setOffset(int offset);
protected slots:
/// \brief
/// Inserts a new entry in the legend.
/// \param index Where to insert the entry.
void insertEntry(int index);
/// \brief
/// Starts the entry removal process.
/// \param index The entry being removed.
void startEntryRemoval(int index);
/// \brief
/// Finishes the entry removal process.
/// \param index The entry that was removed.
void finishEntryRemoval(int index);
/// \brief
/// Updates the text for the given entry.
/// \param index The index of the modified entry.
void updateEntryText(int index);
/// \brief
/// Updates the visibility for the given entry.
/// \param index The index of the modified entry.
void updateEntryVisible(int index);
protected:
/// \brief
/// Updates the layout when the font changes.
/// \param e Event specific information.
/// \return
/// True if the event was handled.
virtual bool event(QEvent *e);
/// \brief
/// Draws the chart title.
/// \param e Event specific information.
virtual void paintEvent(QPaintEvent *e);
/// \brief
/// Updates the maximum offset when the size changes.
/// \param e Event specific information.
virtual void resizeEvent(QResizeEvent *e);
/// \brief
/// Used for panning the contents of the legend.
///
/// The widget cursor is set for panning.
///
/// \param e Event specific information.
virtual void mousePressEvent(QMouseEvent *e);
/// \brief
/// Used for panning the contents of the legend.
///
/// The conents are moved by changing the offset.
///
/// \param e Event specific information.
virtual void mouseMoveEvent(QMouseEvent *e);
/// \brief
/// Used for panning the contents of the legend.
///
/// The widget cursor is reset after panning.
///
/// \param e Event specific information.
virtual void mouseReleaseEvent(QMouseEvent *e);
private:
/// Calculates the preferred size of the chart legend.
void calculateSize();
/// Sets the maximum offset using the contents size.
void updateMaximum();
private:
vtkQtChartLegendInternal *Internal; ///< Stores the graphical items.
vtkQtChartLegendModel *Model; ///< A pointer to the model.
LegendLocation Location; ///< Stores the legend location.
ItemFlow Flow; ///< Stores the order of the items.
QSize Bounds; ///< Stores the prefered size.
int IconSize; ///< Stores the icon size.
int TextSpacing; ///< The space between icon and text.
int Margin; ///< The margin around the entries.
private:
vtkQtChartLegend(const vtkQtChartLegend &);
vtkQtChartLegend &operator=(const vtkQtChartLegend &);
};
#endif
|