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 
25 #ifndef vtkBlockItem_h
26 #define vtkBlockItem_h
27 
28 #include "vtkContextItem.h"
29 #include "vtkRenderingContext2DModule.h" // For export macro
30 #include "vtkStdString.h" // For vtkStdString ivars
31 
32 class vtkContext2D;
33 
34 class VTKRENDERINGCONTEXT2D_EXPORT vtkBlockItem : public vtkContextItem
35 {
36 public:
37  vtkTypeMacro(vtkBlockItem, vtkContextItem);
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
40  static vtkBlockItem* New();
41 
45  bool Paint(vtkContext2D* painter) override;
46 
50  bool Hit(const vtkContextMouseEvent& mouse) override;
51 
55  bool MouseEnterEvent(const vtkContextMouseEvent& mouse) override;
56 
60  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
61 
65  bool MouseLeaveEvent(const vtkContextMouseEvent& mouse) override;
66 
70  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
71 
75  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
76 
80  virtual void SetLabel(const vtkStdString& label);
81 
85  virtual vtkStdString GetLabel();
86 
88 
94  vtkSetVector4Macro(Dimensions, float);
96 
98 
104  vtkGetVector4Macro(Dimensions, float);
106 
107  void SetScalarFunctor(double (*scalarFunction)(double, double));
108 
109 protected:
110  vtkBlockItem();
111  ~vtkBlockItem() override;
112 
113  float Dimensions[4];
114 
116 
117  bool MouseOver;
118 
119  // Some function pointers to optionally do funky things...
120  double (*scalarFunction)(double, double);
121 
122 private:
123  vtkBlockItem(const vtkBlockItem&) = delete;
124  void operator=(const vtkBlockItem&) = delete;
125 };
126 
127 #endif // vtkBlockItem_h
vtkStdString.h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:34
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkContextItem.h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkAbstractContextItem::Hit
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkContextItem::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkBlockItem::MouseOver
bool MouseOver
Definition: vtkBlockItem.h:117
vtkAbstractContextItem::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkAbstractContextItem::MouseButtonReleaseEvent
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
vtkContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkContextItem.h:31
vtkAbstractContextItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkBlockItem::Label
vtkStdString Label
Definition: vtkBlockItem.h:115
vtkAbstractContextItem::MouseEnterEvent
virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse)
Mouse enter event.
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...
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkBlockItem
a vtkContextItem that draws a block (optional label).
Definition: vtkBlockItem.h:34