VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkContext2D;
25 class vtkContextKeyEvent;
26 class vtkContextScene;
28 class vtkVector2f;
29 
30 class VTKRENDERINGCONTEXT2D_EXPORT VTK_MARSHALAUTO vtkAbstractContextItem : public vtkObject
31 {
32 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
41  virtual void Update();
42 
46  virtual bool Paint(vtkContext2D* painter);
47 
52  virtual bool PaintChildren(vtkContext2D* painter);
53 
58  virtual void ReleaseGraphicsResources();
59 
65  virtual vtkIdType AddItem(vtkAbstractContextItem* item);
66 
73  bool RemoveItem(vtkAbstractContextItem* item);
74 
80  bool RemoveItem(vtkIdType index);
81 
87  virtual vtkAbstractContextItem* GetItem(vtkIdType index);
88 
93  vtkIdType GetItemIndex(vtkAbstractContextItem* item);
94 
98  vtkIdType GetNumberOfItems() VTK_FUTURE_CONST;
99 
103  void ClearItems();
104 
110  vtkIdType Raise(vtkIdType index);
111 
118  virtual vtkIdType StackAbove(vtkIdType index, vtkIdType under);
119 
125  vtkIdType Lower(vtkIdType index);
126 
133  virtual vtkIdType StackUnder(vtkIdType child, vtkIdType above);
134 
138  virtual bool Hit(const vtkContextMouseEvent& mouse);
139 
144  virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent& mouse);
145 
151  virtual bool MouseEnterEvent(const vtkContextMouseEvent& mouse);
152 
158  virtual bool MouseMoveEvent(const vtkContextMouseEvent& mouse);
159 
165  virtual bool MouseLeaveEvent(const vtkContextMouseEvent& mouse);
166 
172  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse);
173 
179  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse);
180 
186  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse);
187 
193  virtual bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta);
194 
198  virtual bool KeyPressEvent(const vtkContextKeyEvent& key);
199 
203  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& key);
204 
208  virtual void SetScene(vtkContextScene* scene);
209 
213  vtkContextScene* GetScene() { return this->Scene; }
214 
220  virtual void SetParent(vtkAbstractContextItem* parent);
221 
227  vtkAbstractContextItem* GetParent() { return this->Parent; }
228 
232  virtual vtkVector2f MapToParent(const vtkVector2f& point);
233 
237  virtual vtkVector2f MapFromParent(const vtkVector2f& point);
238 
242  virtual vtkVector2f MapToScene(const vtkVector2f& point);
243 
247  virtual vtkVector2f MapFromScene(const vtkVector2f& point);
248 
250 
253  virtual bool GetVisible()
254  {
255  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning Visible of "
256  << this->Visible);
257  return this->Visible;
258  }
259 
261 
263 
267  vtkSetMacro(Visible, bool);
269 
271 
274  vtkGetMacro(Interactive, bool);
276 
278 
281  vtkSetMacro(Interactive, bool);
283 
284 protected:
286  ~vtkAbstractContextItem() override;
287 
291  virtual void ReleaseGraphicsCache();
292 
297 
302 
309 
313  bool Visible;
314 
319 
320 private:
322  void operator=(const vtkAbstractContextItem&) = delete;
323 };
324 
325 VTK_ABI_NAMESPACE_END
326 #endif // vtkContextItem_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:52
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).
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
Private implementation for scene/items.
int vtkIdType
Definition: vtkType.h:363
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.
#define VTK_MARSHALEXCLUDE(reason)
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...
#define VTK_MARSHALAUTO
virtual bool GetVisible()
Get the visibility of the item (should it be drawn).
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL