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 virtual 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 00081 unsigned int GetItemIndex(vtkAbstractContextItem* item); 00082 00084 unsigned int GetNumberOfItems(); 00085 00087 void ClearItems(); 00088 00091 unsigned int Raise(unsigned int index); 00092 00094 00097 virtual unsigned int StackAbove(unsigned int index, 00098 unsigned int under); 00100 00103 unsigned int Lower(unsigned int index); 00104 00106 00109 virtual unsigned int StackUnder(unsigned int child, 00110 unsigned int above); 00112 00113 //BTX 00115 virtual bool Hit(const vtkContextMouseEvent &mouse); 00116 00119 virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent &mouse); 00120 00123 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse); 00124 00127 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00128 00131 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse); 00132 00135 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00136 00139 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00140 00143 virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse); 00144 00148 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta); 00149 00151 virtual bool KeyPressEvent(const vtkContextKeyEvent &key); 00152 00154 00155 virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key); 00156 //ETX 00158 00161 virtual void SetScene(vtkContextScene *scene); 00162 00164 00166 vtkContextScene* GetScene() 00167 { 00168 return this->Scene; 00169 } 00171 00174 virtual void SetParent(vtkAbstractContextItem *parent); 00175 00177 00179 vtkAbstractContextItem* GetParent() 00180 { 00181 return this->Parent; 00182 } 00184 00186 virtual vtkVector2f MapToParent(const vtkVector2f& point); 00187 00189 virtual vtkVector2f MapFromParent(const vtkVector2f& point); 00190 00192 virtual vtkVector2f MapToScene(const vtkVector2f& point); 00193 00195 virtual vtkVector2f MapFromScene(const vtkVector2f& point); 00196 00198 00199 vtkGetMacro(Visible, bool); 00201 00203 00205 vtkSetMacro(Visible, bool); 00207 00209 00210 vtkGetMacro(Interactive, bool); 00212 00214 00215 vtkSetMacro(Interactive, bool); 00217 00218 //BTX 00219 protected: 00220 vtkAbstractContextItem(); 00221 ~vtkAbstractContextItem(); 00222 00224 vtkContextScene* Scene; 00225 00227 vtkAbstractContextItem* Parent; 00228 00232 vtkContextScenePrivate* Children; 00233 00235 bool Visible; 00236 00239 bool Interactive; 00240 00241 private: 00242 vtkAbstractContextItem(const vtkAbstractContextItem &); // Not implemented. 00243 void operator=(const vtkAbstractContextItem &); // Not implemented. 00244 //ETX 00245 }; 00246 00247 #endif //vtkContextItem_h