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 
27 #ifndef vtkAbstractContextItem_h
28 #define vtkAbstractContextItem_h
29 
30 #include "vtkRenderingContext2DModule.h" // For export macro
31 #include "vtkObject.h"
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  virtual void PrintSelf(ostream &os, vtkIndent indent);
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  unsigned int AddItem(vtkAbstractContextItem* item);
75 
82 
88  bool RemoveItem(unsigned int index);
89 
95 
101 
105  unsigned int GetNumberOfItems();
106 
110  void ClearItems();
111 
117  unsigned int Raise(unsigned int index);
118 
125  virtual unsigned int StackAbove(unsigned int index,
126  unsigned int under);
127 
133  unsigned int Lower(unsigned int index);
134 
141  virtual unsigned int StackUnder(unsigned int child,
142  unsigned int above);
143 
147  virtual bool Hit(const vtkContextMouseEvent &mouse);
148 
154 
160  virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
161 
167  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
168 
174  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
175 
181  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
182 
188  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
189 
195  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse);
196 
202  virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
203 
207  virtual bool KeyPressEvent(const vtkContextKeyEvent &key);
208 
212  virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key);
213 
217  virtual void SetScene(vtkContextScene *scene);
218 
223  {
224  return this->Scene;
225  }
226 
231  virtual void SetParent(vtkAbstractContextItem *parent);
232 
238  {
239  return this->Parent;
240  }
241 
246 
251 
256 
261 
263 
266  vtkGetMacro(Visible, bool);
268 
270 
274  vtkSetMacro(Visible, bool);
276 
278 
281  vtkGetMacro(Interactive, bool);
283 
285 
288  vtkSetMacro(Interactive, bool);
290 
291 protected:
294 
299 
304 
311 
315  bool Visible;
316 
321 
322 private:
323  vtkAbstractContextItem(const vtkAbstractContextItem &) VTK_DELETE_FUNCTION;
324  void operator=(const vtkAbstractContextItem &) VTK_DELETE_FUNCTION;
325 
326 };
327 
328 #endif //vtkContextItem_h
base class for items that are part of a vtkContextScene.
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.
unsigned int GetNumberOfItems()
Get the number of child items.
virtual vtkVector2f MapToParent(const vtkVector2f &point)
Maps the point to the parent coordinate system.
vtkAbstractContextItem * GetItem(unsigned int index)
Get the item at the specified index.
vtkContextScene * Scene
Point to the scene the item is on - can be null.
bool RemoveItem(unsigned int index)
Remove child item from this item.
vtkContextScenePrivate * Children
This structure provides a list of children, along with convenience functions to paint the children et...
unsigned int Raise(unsigned int index)
Raises the child to the top of the item's stack.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual unsigned int StackAbove(unsigned int index, unsigned int under)
Raises the child above the under sibling.
virtual vtkAbstractContextItem * GetPickedItem(const vtkContextMouseEvent &mouse)
Return the item under the mouse.
virtual bool PaintChildren(vtkContext2D *painter)
Paint the children of the item, should be called whenever the children need to be rendered.
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual vtkVector2f MapFromScene(const vtkVector2f &point)
Maps the point from the scene coordinate system.
bool Interactive
Store whether the item should respond to interactions (default is true).
unsigned int GetItemIndex(vtkAbstractContextItem *item)
Get the index of the specified item.
vtkAbstractContextItem * Parent
Point to the parent item - can be null.
virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key)
Key release event.
virtual void SetParent(vtkAbstractContextItem *parent)
Set the parent item.
vtkAbstractContextItem * GetParent()
Get the parent item.
virtual unsigned int StackUnder(unsigned int child, unsigned int above)
Lowers the child under the above sibling.
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
Key press event.
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
Mouse leave event.
bool Visible
Store the visibility of the item (default is true).
virtual vtkVector2f MapFromParent(const vtkVector2f &point)
Maps the point from the parent coordinate system.
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
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...
vtkContextScene * GetScene()
Get the vtkContextScene for the item, always set for an item in a scene.
virtual vtkVector2f MapToScene(const vtkVector2f &point)
Maps the point to the scene coordinate system.
virtual void ReleaseGraphicsResources()
Release graphics resources hold by the item.
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
unsigned int AddItem(vtkAbstractContextItem *item)
Add child items to this item.
void ClearItems()
Remove all child items from this item.
unsigned int Lower(unsigned int index)
Lowers the child to the bottom of the item's stack.
virtual void SetScene(vtkContextScene *scene)
Set the vtkContextScene for the item, always set for an item in a scene.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
bool RemoveItem(vtkAbstractContextItem *item)
Remove child item from this item.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
data structure to represent key events.
data structure to represent mouse events.
Private implementation for scene/items.
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
@ Scene
Definition: vtkX3D.h:154
@ point
Definition: vtkX3D.h:236
@ key
Definition: vtkX3D.h:257
@ index
Definition: vtkX3D.h:246
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.