VTK
dox/Charts/Core/vtkChartLegend.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkChartLegend.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 
00028 #ifndef __vtkChartLegend_h
00029 #define __vtkChartLegend_h
00030 
00031 #include "vtkChartsCoreModule.h" // For export macro
00032 #include "vtkContextItem.h"
00033 #include "vtkNew.h"         // For vtkNew
00034 #include "vtkRect.h"        // For vtkRectf return value
00035 
00036 class vtkChart;
00037 class vtkPen;
00038 class vtkBrush;
00039 class vtkTextProperty;
00040 
00041 class VTKCHARTSCORE_EXPORT vtkChartLegend : public vtkContextItem
00042 {
00043 public:
00044   vtkTypeMacro(vtkChartLegend, vtkContextItem);
00045   virtual void PrintSelf(ostream &os, vtkIndent indent);
00046 
00048   static vtkChartLegend *New();
00049 
00051 
00052   vtkSetVector2Macro(Point, float);
00054 
00056 
00057   vtkGetVector2Macro(Point, float);
00059 
00060   enum {
00061     LEFT = 0,
00062     CENTER,
00063     RIGHT,
00064     TOP,
00065     BOTTOM,
00066     CUSTOM
00067     };
00068 
00070   void SetPoint(const vtkVector2f &point);
00071 
00073   const vtkVector2f& GetPointVector();
00074 
00076 
00078   vtkSetMacro(HorizontalAlignment, int);
00080 
00082 
00083   vtkGetMacro(HorizontalAlignment, int);
00085 
00087 
00089   vtkSetMacro(VerticalAlignment, int);
00091 
00093 
00094   vtkGetMacro(VerticalAlignment, int);
00096 
00098 
00099   vtkSetMacro(Padding, int);
00101 
00103 
00104   vtkGetMacro(Padding, int);
00106 
00108 
00109   vtkSetMacro(SymbolWidth, int);
00111 
00113 
00114   vtkGetMacro(SymbolWidth, int);
00116 
00118   virtual void SetLabelSize(int size);
00119 
00121   virtual int GetLabelSize();
00122 
00124 
00128   vtkSetMacro(Inline, bool);
00129   vtkGetMacro(Inline, bool);
00131 
00133 
00137   vtkSetMacro(DragEnabled, bool);
00138   vtkGetMacro(DragEnabled, bool);
00140 
00143   void SetChart(vtkChart* chart);
00144 
00147   vtkChart* GetChart();
00148 
00151   virtual void Update();
00152 
00154   virtual bool Paint(vtkContext2D *painter);
00155 
00161   virtual vtkRectf GetBoundingRect(vtkContext2D* painter);
00162 
00164   vtkPen * GetPen();
00165 
00167   vtkBrush * GetBrush();
00168 
00170   vtkTextProperty * GetLabelProperties();
00171 
00173 
00179   vtkSetMacro(CacheBounds, bool);
00180   vtkGetMacro(CacheBounds, bool);
00181   vtkBooleanMacro(CacheBounds, bool);
00183 
00185   virtual bool Hit(const vtkContextMouseEvent &mouse);
00186 
00188   virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00189 
00191   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00192 
00194   virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
00195 
00196 protected:
00197   vtkChartLegend();
00198   ~vtkChartLegend();
00199 
00200   float* Point;  // The point the legend is anchored to.
00201   int HorizontalAlignment; // Alignment of the legend to the point it is anchored to.
00202   int VerticalAlignment; // Alignment of the legend to the point it is anchored to.
00203 
00205   vtkNew<vtkPen> Pen;
00206 
00208   vtkNew<vtkBrush> Brush;
00209 
00211   vtkNew<vtkTextProperty> LabelProperties;
00212 
00214   bool DragEnabled;
00215 
00218   bool CacheBounds;
00219 
00221   int Button;
00222 
00223   vtkTimeStamp PlotTime;
00224   vtkTimeStamp RectTime;
00225 
00226   vtkRectf Rect;
00227 
00229   int Padding;
00230 
00232   int SymbolWidth;
00233 
00235   bool Inline;
00236 
00237   // Private storage class
00238   class Private;
00239   Private* Storage;
00240 
00241 private:
00242   vtkChartLegend(const vtkChartLegend &); // Not implemented.
00243   void operator=(const vtkChartLegend &); // Not implemented.
00244 };
00245 
00246 #endif //__vtkChartLegend_h