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  void PrintSelf(ostream &os, vtkIndent indent) override;
42 
43  static vtkBlockItem *New();
44 
48  bool Paint(vtkContext2D *painter) override;
49 
53  bool Hit(const vtkContextMouseEvent &mouse) override;
54 
58  bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override;
59 
63  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
64 
68  bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override;
69 
73  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
74 
78  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
79 
83  virtual void SetLabel(const vtkStdString &label);
84 
89 
91 
97  vtkSetVector4Macro(Dimensions, float);
99 
101 
107  vtkGetVector4Macro(Dimensions, float);
109 
110  void SetScalarFunctor(double (*scalarFunction)(double, double));
111 
112 protected:
114  ~vtkBlockItem() override;
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 &) = delete;
127  void operator=(const vtkBlockItem &) = delete;
128 
129 };
130 
131 #endif //vtkBlockItem_h
vtkBlockItem::MouseButtonReleaseEvent
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
vtkStdString.h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:41
double
double
Definition: vtkVectorOperators.h:166
vtkBlockItem::MouseLeaveEvent
bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override
Mouse leave event.
vtkBlockItem::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the item.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkBlockItem::MouseEnterEvent
bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override
Mouse enter event.
vtkContextItem.h
vtkBlockItem::GetLabel
virtual vtkStdString GetLabel()
Get the block label.
vtkBlockItem::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkBlockItem::~vtkBlockItem
~vtkBlockItem() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkBlockItem::MouseOver
bool MouseOver
Definition: vtkBlockItem.h:120
vtkBlockItem::SetScalarFunctor
void SetScalarFunctor(double(*scalarFunction)(double, double))
vtkBlockItem::MouseMoveEvent
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkContextItem.h:35
vtkBlockItem::vtkBlockItem
vtkBlockItem()
vtkBlockItem::New
static vtkBlockItem * New()
vtkBlockItem::Hit
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the supplied x, y coordinate is inside the item.
vtkBlockItem::Label
vtkStdString Label
Definition: vtkBlockItem.h:118
vtkBlockItem::MouseButtonPressEvent
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
vtkBlockItem
a vtkContextItem that draws a block (optional label).
Definition: vtkBlockItem.h:38
vtkBlockItem::SetLabel
virtual void SetLabel(const vtkStdString &label)
Set the block label.