VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkChartLegend.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChartLegend.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
28 #ifndef __vtkChartLegend_h
29 #define __vtkChartLegend_h
30 
31 #include "vtkChartsCoreModule.h" // For export macro
32 #include "vtkContextItem.h"
33 #include "vtkNew.h" // For vtkNew
34 #include "vtkRect.h" // For vtkRectf return value
35 
36 class vtkChart;
37 class vtkPen;
38 class vtkBrush;
39 class vtkTextProperty;
40 
41 class VTKCHARTSCORE_EXPORT vtkChartLegend : public vtkContextItem
42 {
43 public:
44  vtkTypeMacro(vtkChartLegend, vtkContextItem);
45  virtual void PrintSelf(ostream &os, vtkIndent indent);
46 
48  static vtkChartLegend *New();
49 
51 
52  vtkSetVector2Macro(Point, float);
54 
56 
57  vtkGetVector2Macro(Point, float);
59 
60  enum {
61  LEFT = 0,
64  TOP,
66  CUSTOM
67  };
68 
70  void SetPoint(const vtkVector2f &point);
71 
73  const vtkVector2f& GetPointVector();
74 
76 
78  vtkSetMacro(HorizontalAlignment, int);
80 
82 
83  vtkGetMacro(HorizontalAlignment, int);
85 
87 
89  vtkSetMacro(VerticalAlignment, int);
91 
93 
94  vtkGetMacro(VerticalAlignment, int);
96 
98 
99  vtkSetMacro(Padding, int);
101 
103 
104  vtkGetMacro(Padding, int);
106 
108 
109  vtkSetMacro(SymbolWidth, int);
111 
113 
114  vtkGetMacro(SymbolWidth, int);
116 
118  virtual void SetLabelSize(int size);
119 
121  virtual int GetLabelSize();
122 
124 
128  vtkSetMacro(Inline, bool);
129  vtkGetMacro(Inline, bool);
131 
133 
137  vtkSetMacro(DragEnabled, bool);
138  vtkGetMacro(DragEnabled, bool);
140 
143  void SetChart(vtkChart* chart);
144 
147  vtkChart* GetChart();
148 
151  virtual void Update();
152 
154  virtual bool Paint(vtkContext2D *painter);
155 
161  virtual vtkRectf GetBoundingRect(vtkContext2D* painter);
162 
164  vtkPen * GetPen();
165 
167  vtkBrush * GetBrush();
168 
170  vtkTextProperty * GetLabelProperties();
171 
173  virtual bool Hit(const vtkContextMouseEvent &mouse);
174 
176  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
177 
179  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
180 
182  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
183 
184 protected:
185  vtkChartLegend();
186  ~vtkChartLegend();
187 
188  float* Point; // The point the legend is anchored to.
189  int HorizontalAlignment; // Alignment of the legend to the point it is anchored to.
190  int VerticalAlignment; // Alignment of the legend to the point it is anchored to.
191 
194 
197 
200 
203 
205  int Button;
206 
209 
210  vtkRectf Rect;
211 
213  int Padding;
214 
217 
219  bool Inline;
220 
221  // Private storage class
222  class Private;
223  Private* Storage;
224 
225 private:
226  vtkChartLegend(const vtkChartLegend &); // Not implemented.
227  void operator=(const vtkChartLegend &); // Not implemented.
228 };
229 
230 #endif //__vtkChartLegend_h
Private * Storage
vtkTimeStamp PlotTime
record modification and/or execution time
Definition: vtkTimeStamp.h:34
Factory class for drawing 2D charts.
Definition: vtkChart.h:49
vtkTimeStamp RectTime
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkBrush > Brush
draw the chart legend
vtkNew< vtkTextProperty > LabelProperties
vtkNew< vtkPen > Pen