VTK
vtkBlockItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBlockItem.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 
28 #ifndef vtkBlockItem_h
29 #define vtkBlockItem_h
30 
31 #include "vtkRenderingContext2DModule.h" // For export macro
32 #include "vtkContextItem.h"
33 #include "vtkStdString.h" // For vtkStdString ivars
34 
35 class vtkContext2D;
36 
37 class VTKRENDERINGCONTEXT2D_EXPORT vtkBlockItem : public vtkContextItem
38 {
39 public:
40  vtkTypeMacro(vtkBlockItem, vtkContextItem);
41  virtual void PrintSelf(ostream &os, vtkIndent indent);
42 
43  static vtkBlockItem *New();
44 
48  virtual bool Paint(vtkContext2D *painter);
49 
53  virtual bool Hit(const vtkContextMouseEvent &mouse);
54 
58  virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
59 
63  virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
64 
68  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
69 
73  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
74 
78  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
79 
83  virtual void SetLabel(const vtkStdString &label);
84 
88  virtual vtkStdString GetLabel();
89 
91 
97  vtkSetVector4Macro(Dimensions, float);
99 
101 
107  vtkGetVector4Macro(Dimensions, float);
109 
110  void SetScalarFunctor(double (*scalarFunction)(double, double));
111 
112 protected:
113  vtkBlockItem();
114  ~vtkBlockItem();
115 
116  float Dimensions[4];
117 
119 
120  bool MouseOver;
121 
122  // Some function pointers to optionally do funky things...
123  double (*scalarFunction)(double, double);
124 
125 private:
126  vtkBlockItem(const vtkBlockItem &) VTK_DELETE_FUNCTION;
127  void operator=(const vtkBlockItem &) VTK_DELETE_FUNCTION;
128 
129 };
130 
131 #endif //vtkBlockItem_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:47
base class for items that are part of a vtkContextScene.
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...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
a vtkContextItem that draws a block (optional label).
Definition: vtkBlockItem.h:37
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
vtkStdString Label
Definition: vtkBlockItem.h:118
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse)
Mouse leave event.