VTK
|
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 "vtkRenderingContext2DModule.h" // For export macro 00030 #include "vtkObject.h" 00031 00032 class vtkContext2D; 00033 class vtkContextMouseEvent; 00034 class vtkContextKeyEvent; 00035 class vtkContextScene; 00036 class vtkContextScenePrivate; 00037 class vtkVector2f; 00038 00039 class VTKRENDERINGCONTEXT2D_EXPORT vtkAbstractContextItem : public vtkObject 00040 { 00041 public: 00042 vtkTypeMacro(vtkAbstractContextItem, vtkObject); 00043 virtual void PrintSelf(ostream &os, vtkIndent indent); 00044 00048 virtual void Update(); 00049 00051 virtual bool Paint(vtkContext2D *painter); 00052 00055 bool PaintChildren(vtkContext2D *painter); 00056 00059 virtual void ReleaseGraphicsResources(); 00060 00063 unsigned int AddItem(vtkAbstractContextItem* item); 00064 00068 bool RemoveItem(vtkAbstractContextItem* item); 00069 00073 bool RemoveItem(unsigned int index); 00074 00077 vtkAbstractContextItem* GetItem(unsigned int index); 00078 00080 unsigned int GetNumberOfItems(); 00081 00083 void ClearItems(); 00084 00085 //BTX 00087 virtual bool Hit(const vtkContextMouseEvent &mouse); 00088 00091 virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent &mouse); 00092 00095 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse); 00096 00099 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00100 00103 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse); 00104 00107 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00108 00111 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00112 00115 virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse); 00116 00120 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta); 00121 00123 virtual bool KeyPressEvent(const vtkContextKeyEvent &key); 00124 00126 00127 virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key); 00128 //ETX 00130 00133 virtual void SetScene(vtkContextScene *scene); 00134 00136 00138 vtkContextScene* GetScene() 00139 { 00140 return this->Scene; 00141 } 00143 00146 virtual void SetParent(vtkAbstractContextItem *parent); 00147 00149 00151 vtkAbstractContextItem* GetParent() 00152 { 00153 return this->Parent; 00154 } 00156 00158 virtual vtkVector2f MapToParent(const vtkVector2f& point); 00159 00161 virtual vtkVector2f MapFromParent(const vtkVector2f& point); 00162 00164 virtual vtkVector2f MapToScene(const vtkVector2f& point); 00165 00167 virtual vtkVector2f MapFromScene(const vtkVector2f& point); 00168 00170 00171 vtkGetMacro(Visible, bool); 00173 00175 00177 vtkSetMacro(Visible, bool); 00179 00181 00182 vtkGetMacro(Interactive, bool); 00184 00186 00187 vtkSetMacro(Interactive, bool); 00189 00190 //BTX 00191 protected: 00192 vtkAbstractContextItem(); 00193 ~vtkAbstractContextItem(); 00194 00196 vtkContextScene* Scene; 00197 00199 vtkAbstractContextItem* Parent; 00200 00204 vtkContextScenePrivate* Children; 00205 00207 bool Visible; 00208 00211 bool Interactive; 00212 00213 private: 00214 vtkAbstractContextItem(const vtkAbstractContextItem &); // Not implemented. 00215 void operator=(const vtkAbstractContextItem &); // Not implemented. 00216 //ETX 00217 }; 00218 00219 #endif //__vtkContextItem_h