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 00026 #ifndef __vtkAbstractContextItem_h 00027 #define __vtkAbstractContextItem_h 00028 00029 #include "vtkObject.h" 00030 00031 class vtkContext2D; 00032 class vtkContextMouseEvent; 00033 class vtkContextScene; 00034 class vtkContextScenePrivate; 00035 class vtkVector2f; 00036 00037 class VTK_CHARTS_EXPORT vtkAbstractContextItem : public vtkObject 00038 { 00039 public: 00040 vtkTypeMacro(vtkAbstractContextItem, vtkObject); 00041 virtual void PrintSelf(ostream &os, vtkIndent indent); 00042 00046 virtual void Update(); 00047 00049 virtual bool Paint(vtkContext2D *painter); 00050 00053 bool PaintChildren(vtkContext2D *painter); 00054 00057 virtual void ReleaseGraphicsResources(); 00058 00061 unsigned int AddItem(vtkAbstractContextItem* item); 00062 00066 bool RemoveItem(vtkAbstractContextItem* item); 00067 00071 bool RemoveItem(unsigned int index); 00072 00075 vtkAbstractContextItem* GetItem(unsigned int index); 00076 00078 unsigned int GetNumberOfItems(); 00079 00081 void ClearItems(); 00082 00083 //BTX 00085 virtual bool Hit(const vtkContextMouseEvent &mouse); 00086 00089 virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent &mouse); 00090 00093 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse); 00094 00097 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00098 00101 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse); 00102 00105 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00106 00109 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00110 00113 virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse); 00114 00116 00119 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta); 00120 //ETX 00122 00125 virtual void SetScene(vtkContextScene *scene); 00126 00128 00130 vtkContextScene* GetScene() 00131 { 00132 return this->Scene; 00133 } 00135 00138 virtual void SetParent(vtkAbstractContextItem *parent); 00139 00141 00143 vtkAbstractContextItem* GetParent() 00144 { 00145 return this->Parent; 00146 } 00148 00150 virtual vtkVector2f MapToParent(const vtkVector2f& point); 00151 00153 virtual vtkVector2f MapFromParent(const vtkVector2f& point); 00154 00156 virtual vtkVector2f MapToScene(const vtkVector2f& point); 00157 00159 virtual vtkVector2f MapFromScene(const vtkVector2f& point); 00160 00162 00163 vtkGetMacro(Visible, bool); 00165 00167 00169 vtkSetMacro(Visible, bool); 00171 00172 //BTX 00173 protected: 00174 vtkAbstractContextItem(); 00175 ~vtkAbstractContextItem(); 00176 00178 vtkContextScene* Scene; 00179 00181 vtkAbstractContextItem* Parent; 00182 00186 vtkContextScenePrivate* Children; 00187 00188 bool Visible; 00189 00190 private: 00191 vtkAbstractContextItem(const vtkAbstractContextItem &); // Not implemented. 00192 void operator=(const vtkAbstractContextItem &); // Not implemented. 00193 //ETX 00194 }; 00195 00196 #endif //__vtkContextItem_h