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 
81  bool RemoveItem(vtkAbstractContextItem* item);
82 
88  bool RemoveItem(unsigned int index);
89 
94  vtkAbstractContextItem* GetItem(unsigned int index);
95 
100  unsigned int GetItemIndex(vtkAbstractContextItem* item);
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 
153  virtual vtkAbstractContextItem* GetPickedItem(const vtkContextMouseEvent &mouse);
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 
245  virtual vtkVector2f MapToParent(const vtkVector2f& point);
246 
250  virtual vtkVector2f MapFromParent(const vtkVector2f& point);
251 
255  virtual vtkVector2f MapToScene(const vtkVector2f& point);
256 
260  virtual vtkVector2f MapFromScene(const vtkVector2f& point);
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
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:59
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.
virtual void Update()
Updates the extensions string.
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
vtkAbstractContextItem * Parent
Point to the parent item - can be null.
vtkContextScene * Scene
Point to the scene the item is on - can be null.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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...
vtkAbstractContextItem * GetParent()
Get the parent item.