VTK  9.3.1
vtkAbstractContextItem.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
15 #ifndef vtkAbstractContextItem_h
16 #define vtkAbstractContextItem_h
17 
18 #include "vtkObject.h"
19 #include "vtkRenderingContext2DModule.h" // For export macro
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkContext2D;
24 class vtkContextKeyEvent;
25 class vtkContextScene;
27 class vtkVector2f;
28 
29 class VTKRENDERINGCONTEXT2D_EXPORT vtkAbstractContextItem : public vtkObject
30 {
31 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
40  virtual void Update();
41 
45  virtual bool Paint(vtkContext2D* painter);
46 
51  virtual bool PaintChildren(vtkContext2D* painter);
52 
57  virtual void ReleaseGraphicsResources();
58 
63  vtkIdType AddItem(vtkAbstractContextItem* item);
64 
70  bool RemoveItem(vtkAbstractContextItem* item);
71 
77  bool RemoveItem(vtkIdType index);
78 
84 
89  vtkIdType GetItemIndex(vtkAbstractContextItem* item);
90 
94  vtkIdType GetNumberOfItems();
95 
99  void ClearItems();
100 
106  vtkIdType Raise(vtkIdType index);
107 
114  virtual vtkIdType StackAbove(vtkIdType index, vtkIdType under);
115 
121  vtkIdType Lower(vtkIdType index);
122 
129  virtual vtkIdType StackUnder(vtkIdType child, vtkIdType above);
130 
134  virtual bool Hit(const vtkContextMouseEvent& mouse);
135 
140  virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent& mouse);
141 
147  virtual bool MouseEnterEvent(const vtkContextMouseEvent& mouse);
148 
154  virtual bool MouseMoveEvent(const vtkContextMouseEvent& mouse);
155 
161  virtual bool MouseLeaveEvent(const vtkContextMouseEvent& mouse);
162 
168  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse);
169 
175  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse);
176 
182  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse);
183 
189  virtual bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta);
190 
194  virtual bool KeyPressEvent(const vtkContextKeyEvent& key);
195 
199  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& key);
200 
204  virtual void SetScene(vtkContextScene* scene);
205 
209  vtkContextScene* GetScene() { return this->Scene; }
210 
215  virtual void SetParent(vtkAbstractContextItem* parent);
216 
221  vtkAbstractContextItem* GetParent() { return this->Parent; }
222 
226  virtual vtkVector2f MapToParent(const vtkVector2f& point);
227 
231  virtual vtkVector2f MapFromParent(const vtkVector2f& point);
232 
236  virtual vtkVector2f MapToScene(const vtkVector2f& point);
237 
241  virtual vtkVector2f MapFromScene(const vtkVector2f& point);
242 
244 
247  virtual bool GetVisible()
248  {
249  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning Visible of "
250  << this->Visible);
251  return this->Visible;
252  }
253 
255 
257 
261  vtkSetMacro(Visible, bool);
263 
265 
268  vtkGetMacro(Interactive, bool);
270 
272 
275  vtkSetMacro(Interactive, bool);
277 
278 protected:
280  ~vtkAbstractContextItem() override;
281 
285  virtual void ReleaseGraphicsCache();
286 
291 
296 
303 
307  bool Visible;
308 
313 
314 private:
316  void operator=(const vtkAbstractContextItem&) = delete;
317 };
318 
319 VTK_ABI_NAMESPACE_END
320 #endif // vtkContextItem_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:315
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:49
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:28
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.