VTK  9.0.20210616
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 
75 
82 
89 
95 
101 
106 
110  void ClearItems();
111 
118 
126 
133 
140  virtual vtkIdType StackUnder(vtkIdType child, vtkIdType above);
141 
145  virtual bool Hit(const vtkContextMouseEvent& mouse);
146 
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 
238 
243 
248 
253 
255 
258  vtkGetMacro(Visible, bool);
260 
262 
266  vtkSetMacro(Visible, bool);
268 
270 
273  vtkGetMacro(Interactive, bool);
275 
277 
280  vtkSetMacro(Interactive, bool);
282 
283 protected:
286 
291 
296 
303 
307  bool Visible;
308 
313 
314 private:
316  void operator=(const vtkAbstractContextItem&) = delete;
317 };
318 
319 #endif // vtkContextItem_h
vtkAbstractContextItem::MapFromParent
virtual vtkVector2f MapFromParent(const vtkVector2f &point)
Maps the point from the parent coordinate system.
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:35
vtkContextKeyEvent
data structure to represent key events.
Definition: vtkContextKeyEvent.h:35
vtkAbstractContextItem::GetScene
vtkContextScene * GetScene()
Get the vtkContextScene for the item, always set for an item in a scene.
Definition: vtkAbstractContextItem.h:220
vtkAbstractContextItem::Scene
vtkContextScene * Scene
Point to the scene the item is on - can be null.
Definition: vtkAbstractContextItem.h:290
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkAbstractContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkAbstractContextItem.h:41
vtkAbstractContextItem::RemoveItem
bool RemoveItem(vtkAbstractContextItem *item)
Remove child item from this item.
vtkAbstractContextItem::Raise
vtkIdType Raise(vtkIdType index)
Raises the child to the top of the item's stack.
vtkX3D::key
@ key
Definition: vtkX3D.h:263
vtkAbstractContextItem::MapToScene
virtual vtkVector2f MapToScene(const vtkVector2f &point)
Maps the point to the scene coordinate system.
vtkAbstractContextItem::KeyPressEvent
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
Key press event.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:63
vtkAbstractContextItem::GetPickedItem
virtual vtkAbstractContextItem * GetPickedItem(const vtkContextMouseEvent &mouse)
Return the item under the mouse.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
vtkAbstractContextItem::RemoveItem
bool RemoveItem(vtkIdType index)
Remove child item from this item.
vtkAbstractContextItem::Parent
vtkAbstractContextItem * Parent
Point to the parent item - can be null.
Definition: vtkAbstractContextItem.h:295
vtkAbstractContextItem::MapFromScene
virtual vtkVector2f MapFromScene(const vtkVector2f &point)
Maps the point from the scene coordinate system.
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkAbstractContextItem::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkContextScene
Provides a 2D scene for vtkContextItem objects.
Definition: vtkContextScene.h:48
vtkAbstractContextItem::Visible
bool Visible
Store the visibility of the item (default is true).
Definition: vtkAbstractContextItem.h:307
vtkAbstractContextItem::MapToParent
virtual vtkVector2f MapToParent(const vtkVector2f &point)
Maps the point to the parent coordinate system.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkAbstractContextItem::Hit
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkX3D::Scene
@ Scene
Definition: vtkX3D.h:160
vtkAbstractContextItem::StackAbove
virtual vtkIdType StackAbove(vtkIdType index, vtkIdType under)
Raises the child above the under sibling.
vtkAbstractContextItem::GetItem
vtkAbstractContextItem * GetItem(vtkIdType index)
Get the item at the specified index.
vtkContextScenePrivate
Private implementation for scene/items.
Definition: vtkContextScenePrivate.h:41
vtkAbstractContextItem::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkObject.h
vtkAbstractContextItem::StackUnder
virtual vtkIdType StackUnder(vtkIdType child, vtkIdType above)
Lowers the child under the above sibling.
vtkAbstractContextItem::MouseButtonReleaseEvent
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
vtkAbstractContextItem::Children
vtkContextScenePrivate * Children
This structure provides a list of children, along with convenience functions to paint the children et...
Definition: vtkAbstractContextItem.h:302
vtkAbstractContextItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkAbstractContextItem::SetScene
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
vtkAbstractContextItem::vtkAbstractContextItem
vtkAbstractContextItem()
vtkAbstractContextItem::Lower
vtkIdType Lower(vtkIdType index)
Lowers the child to the bottom of the item's stack.
vtkAbstractContextItem::MouseEnterEvent
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
vtkAbstractContextItem::AddItem
vtkIdType AddItem(vtkAbstractContextItem *item)
Add child items to this item.
vtkAbstractContextItem::SetParent
virtual void SetParent(vtkAbstractContextItem *parent)
Set the parent item.
vtkAbstractContextItem::MouseDoubleClickEvent
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.
vtkAbstractContextItem::KeyReleaseEvent
virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key)
Key release event.
vtkAbstractContextItem::GetParent
vtkAbstractContextItem * GetParent()
Get the parent item.
Definition: vtkAbstractContextItem.h:232
vtkAbstractContextItem::ClearItems
void ClearItems()
Remove all child items from this item.
vtkAbstractContextItem::MouseLeaveEvent
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
Mouse leave event.
vtkAbstractContextItem::MouseButtonPressEvent
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
vtkAbstractContextItem::GetNumberOfItems
vtkIdType GetNumberOfItems()
Get the number of child items.
vtkAbstractContextItem::~vtkAbstractContextItem
~vtkAbstractContextItem() override
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkAbstractContextItem::Interactive
bool Interactive
Store whether the item should respond to interactions (default is true).
Definition: vtkAbstractContextItem.h:312
vtkAbstractContextItem::PaintChildren
virtual bool PaintChildren(vtkContext2D *painter)
Paint the children of the item, should be called whenever the children need to be rendered.
vtkAbstractContextItem::GetItemIndex
vtkIdType GetItemIndex(vtkAbstractContextItem *item)
Get the index of the specified item in itemIndex.
vtkVector2f
Definition: vtkVector.h:432
vtkAbstractContextItem::MouseWheelEvent
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
vtkAbstractContextItem::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
vtkAbstractContextItem::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources()
Release graphics resources hold by the item.