00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkContextItem.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 00027 #ifndef __vtkContextItem_h 00028 #define __vtkContextItem_h 00029 00030 #include "vtkObject.h" 00031 #include "vtkWeakPointer.h" // Needed for weak pointer references to the scene 00032 00033 class vtkContext2D; 00034 class vtkContextScene; 00035 class vtkTransform2D; 00036 class vtkContextMouseEvent; 00037 00038 class VTK_CHARTS_EXPORT vtkContextItem : public vtkObject 00039 { 00040 public: 00041 vtkTypeMacro(vtkContextItem, vtkObject); 00042 virtual void PrintSelf(ostream &os, vtkIndent indent); 00043 00047 virtual void Update(); 00048 00050 virtual bool Paint(vtkContext2D *painter) = 0; 00051 00052 //BTX 00054 virtual bool Hit(const vtkContextMouseEvent &mouse); 00055 00058 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse); 00059 00062 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00063 00066 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse); 00067 00070 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00071 00074 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00075 00079 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta); 00080 //ETX 00081 00083 virtual void SetTransform(vtkTransform2D *transform); 00084 00086 00087 vtkGetObjectMacro(Transform, vtkTransform2D); 00089 00091 00092 vtkGetMacro(Visible, bool); 00094 00096 00097 vtkSetMacro(Visible, bool); 00099 00101 00102 vtkGetMacro(Opacity, double); 00104 00106 00107 vtkSetMacro(Opacity, double); 00109 00111 void Translate(float dx, float dy); 00112 00115 virtual void SetScene(vtkContextScene *scene); 00116 00119 vtkContextScene* GetScene(); 00120 00123 virtual void ReleaseGraphicsResources(); 00124 00125 //BTX 00126 protected: 00127 vtkContextItem(); 00128 ~vtkContextItem(); 00129 00130 vtkTransform2D *Transform; 00131 vtkWeakPointer<vtkContextScene> Scene; 00132 00133 bool Visible; 00134 00135 double Opacity; 00136 00137 private: 00138 vtkContextItem(const vtkContextItem &); // Not implemented. 00139 void operator=(const vtkContextItem &); // Not implemented. 00140 //ETX 00141 }; 00142 00143 #endif //__vtkContextItem_h