VTK
dox/Charts/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 "vtkContextItem.h"
00032 #include "vtkNew.h"         // For vtkNew
00033 #include "vtkRect.h"        // For vtkRectf return value
00034 
00035 class vtkChart;
00036 class vtkPen;
00037 class vtkBrush;
00038 class vtkTextProperty;
00039 
00040 class VTK_CHARTS_EXPORT vtkChartLegend : public vtkContextItem
00041 {
00042 public:
00043   vtkTypeMacro(vtkChartLegend, vtkContextItem);
00044   virtual void PrintSelf(ostream &os, vtkIndent indent);
00045 
00047   static vtkChartLegend *New();
00048 
00050 
00051   vtkSetVector2Macro(Point, float);
00053 
00055 
00056   vtkGetVector2Macro(Point, float);
00058 
00059   enum {
00060     LEFT = 0,
00061     CENTER,
00062     RIGHT,
00063     TOP,
00064     BOTTOM,
00065     CUSTOM
00066     };
00067 
00069   void SetPoint(const vtkVector2f &point);
00070 
00072   const vtkVector2f& GetPointVector();
00073 
00075 
00077   vtkSetMacro(HorizontalAlignment, int);
00079 
00081 
00082   vtkGetMacro(HorizontalAlignment, int);
00084 
00086 
00088   vtkSetMacro(VerticalAlignment, int);
00090 
00092 
00093   vtkGetMacro(VerticalAlignment, int);
00095 
00097 
00098   vtkSetMacro(Padding, int);
00100 
00102 
00103   vtkGetMacro(Padding, int);
00105 
00107 
00108   vtkSetMacro(SymbolWidth, int);
00110 
00112 
00113   vtkGetMacro(SymbolWidth, int);
00115 
00117   virtual void SetLabelSize(int size);
00118 
00120   virtual int GetLabelSize();
00121 
00123 
00127   vtkSetMacro(Inline, bool);
00128   vtkGetMacro(Inline, bool);
00130 
00132 
00136   vtkSetMacro(DragEnabled, bool);
00137   vtkGetMacro(DragEnabled, bool);
00139 
00142   void SetChart(vtkChart* chart);
00143 
00146   vtkChart* GetChart();
00147 
00150   virtual void Update();
00151 
00153   virtual bool Paint(vtkContext2D *painter);
00154 
00160   virtual vtkRectf GetBoundingRect(vtkContext2D* painter);
00161 
00163   vtkPen * GetPen();
00164 
00166   vtkBrush * GetBrush();
00167 
00169   vtkTextProperty * GetLabelProperties();
00170 
00172   virtual bool Hit(const vtkContextMouseEvent &mouse);
00173 
00175   virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00176 
00178   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00179 
00181   virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
00182 
00183 protected:
00184   vtkChartLegend();
00185   ~vtkChartLegend();
00186 
00187   float* Point;  // The point the legend is anchored to.
00188   int HorizontalAlignment; // Alignment of the legend to the point it is anchored to.
00189   int VerticalAlignment; // Alignment of the legend to the point it is anchored to.
00190 
00192   vtkNew<vtkPen> Pen;
00193 
00195   vtkNew<vtkBrush> Brush;
00196 
00198   vtkNew<vtkTextProperty> LabelProperties;
00199 
00201   bool DragEnabled;
00202 
00204   int Button;
00205 
00206   vtkTimeStamp PlotTime;
00207   vtkTimeStamp RectTime;
00208 
00209   vtkRectf Rect;
00210 
00212   int Padding;
00213 
00215   int SymbolWidth;
00216 
00218   bool Inline;
00219 
00220   // Private storage class
00221   class Private;
00222   Private* Storage;
00223 
00224 private:
00225   vtkChartLegend(const vtkChartLegend &); // Not implemented.
00226   void operator=(const vtkChartLegend &); // Not implemented.
00227 };
00228 
00229 #endif //__vtkChartLegend_h