VTK  9.2.6
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 
27 #ifndef vtkAbstractContextItem_h
28 #define vtkAbstractContextItem_h
29 
30 #include "vtkObject.h"
31 #include "vtkRenderingContext2DModule.h" // For export macro
32 
33 class vtkContext2D;
35 class vtkContextKeyEvent;
36 class vtkContextScene;
38 class vtkVector2f;
39 
40 class VTKRENDERINGCONTEXT2D_EXPORT vtkAbstractContextItem : public vtkObject
41 {
42 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
51  virtual void Update();
52 
56  virtual bool Paint(vtkContext2D* painter);
57 
62  virtual bool PaintChildren(vtkContext2D* painter);
63 
68  virtual void ReleaseGraphicsResources();
69 
74  vtkIdType AddItem(vtkAbstractContextItem* item);
75 
81  bool RemoveItem(vtkAbstractContextItem* item);
82 
88  bool RemoveItem(vtkIdType index);
89 
95 
100  vtkIdType GetItemIndex(vtkAbstractContextItem* item);
101 
105  vtkIdType GetNumberOfItems();
106 
110  void ClearItems();
111 
117  vtkIdType Raise(vtkIdType index);
118 
125  virtual vtkIdType StackAbove(vtkIdType index, vtkIdType under);
126 
132  vtkIdType Lower(vtkIdType index);
133 
140  virtual vtkIdType StackUnder(vtkIdType child, vtkIdType above);
141 
145  virtual bool Hit(const vtkContextMouseEvent& mouse);
146 
151  virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent& mouse);
152 
158  virtual bool MouseEnterEvent(const vtkContextMouseEvent& mouse);
159 
165  virtual bool MouseMoveEvent(const vtkContextMouseEvent& mouse);
166 
172  virtual bool MouseLeaveEvent(const vtkContextMouseEvent& mouse);
173 
179  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse);
180 
186  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse);
187 
193  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse);
194 
200  virtual bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta);
201 
205  virtual bool KeyPressEvent(const vtkContextKeyEvent& key);
206 
210  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& key);
211 
215  virtual void SetScene(vtkContextScene* scene);
216 
220  vtkContextScene* GetScene() { return this->Scene; }
221 
226  virtual void SetParent(vtkAbstractContextItem* parent);
227 
232  vtkAbstractContextItem* GetParent() { return this->Parent; }
233 
237  virtual vtkVector2f MapToParent(const vtkVector2f& point);
238 
242  virtual vtkVector2f MapFromParent(const vtkVector2f& point);
243 
247  virtual vtkVector2f MapToScene(const vtkVector2f& point);
248 
252  virtual vtkVector2f MapFromScene(const vtkVector2f& point);
253 
255 
258  virtual bool GetVisible()
259  {
260  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning Visible of "
261  << this->Visible);
262  return this->Visible;
263  }
264 
266 
268 
272  vtkSetMacro(Visible, bool);
274 
276 
279  vtkGetMacro(Interactive, bool);
281 
283 
286  vtkSetMacro(Interactive, bool);
288 
289 protected:
291  ~vtkAbstractContextItem() override;
292 
297 
302 
309 
313  bool Visible;
314 
319 
320 private:
322  void operator=(const vtkAbstractContextItem&) = delete;
323 };
324 
325 #endif // vtkContextItem_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Visible
Store the visibility of the item (default is true).
Private implementation for scene/items.
vtkContextScene * GetScene()
Get the vtkContextScene for the item, always set for an item in a scene.
int vtkIdType
Definition: vtkType.h:332
bool Interactive
Store whether the item should respond to interactions (default is true).
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
const char * GetClassName() const
Return the class name as a string.
vtkAbstractContextItem * Parent
Point to the parent item - can be null.
vtkContextScene * Scene
Point to the scene the item is on - can be null.
base class for items that are part of a vtkContextScene.
vtkContextScenePrivate * Children
This structure provides a list of children, along with convenience functions to paint the children et...
virtual bool GetVisible()
Get the visibility of the item (should it be drawn).
vtkAbstractContextItem * GetParent()
Get the parent item.