VTK
vtkAbstractContextItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextItem.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
26 #ifndef __vtkAbstractContextItem_h
27 #define __vtkAbstractContextItem_h
28 
29 #include "vtkRenderingContext2DModule.h" // For export macro
30 #include "vtkObject.h"
31 
32 class vtkContext2D;
34 class vtkContextKeyEvent;
35 class vtkContextScene;
37 class vtkVector2f;
38 
39 class VTKRENDERINGCONTEXT2D_EXPORT vtkAbstractContextItem : public vtkObject
40 {
41 public:
43  virtual void PrintSelf(ostream &os, vtkIndent indent);
44 
48  virtual void Update();
49 
51  virtual bool Paint(vtkContext2D *painter);
52 
55  bool PaintChildren(vtkContext2D *painter);
56 
59  virtual void ReleaseGraphicsResources();
60 
63  unsigned int AddItem(vtkAbstractContextItem* item);
64 
68  bool RemoveItem(vtkAbstractContextItem* item);
69 
73  bool RemoveItem(unsigned int index);
74 
77  vtkAbstractContextItem* GetItem(unsigned int index);
78 
80  unsigned int GetNumberOfItems();
81 
83  void ClearItems();
84 
85 //BTX
87  virtual bool Hit(const vtkContextMouseEvent &mouse);
88 
91  virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent &mouse);
92 
95  virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
96 
99  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
100 
103  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
104 
107  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
108 
111  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
112 
115  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse);
116 
120  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
121 
123  virtual bool KeyPressEvent(const vtkContextKeyEvent &key);
124 
126 
127  virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key);
128 //ETX
130 
133  virtual void SetScene(vtkContextScene *scene);
134 
136 
138  vtkContextScene* GetScene()
139  {
140  return this->Scene;
141  }
143 
146  virtual void SetParent(vtkAbstractContextItem *parent);
147 
149 
152  {
153  return this->Parent;
154  }
156 
158  virtual vtkVector2f MapToParent(const vtkVector2f& point);
159 
161  virtual vtkVector2f MapFromParent(const vtkVector2f& point);
162 
164  virtual vtkVector2f MapToScene(const vtkVector2f& point);
165 
167  virtual vtkVector2f MapFromScene(const vtkVector2f& point);
168 
170 
171  vtkGetMacro(Visible, bool);
173 
175 
177  vtkSetMacro(Visible, bool);
179 
180 //BTX
181 protected:
184 
187 
190 
195 
196  bool Visible;
197 
198 private:
199  vtkAbstractContextItem(const vtkAbstractContextItem &); // Not implemented.
200  void operator=(const vtkAbstractContextItem &); // Not implemented.
201 //ETX
202 };
203 
204 #endif //__vtkContextItem_h