VTK  9.1.0
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
29#ifndef vtkBlockItem_h
30#define vtkBlockItem_h
31
32#include "vtkContextItem.h"
33#include "vtkNew.h" // For vtkNew
34#include "vtkRenderingContext2DModule.h" // For export macro
35#include "vtkStdString.h" // For vtkStdString ivars
36
37class vtkContext2D;
38class vtkTextProperty;
39class vtkBrush;
40class vtkPen;
41
42class VTKRENDERINGCONTEXT2D_EXPORT vtkBlockItem : public vtkContextItem
43{
44public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
48 static vtkBlockItem* New();
49
53 bool Paint(vtkContext2D* painter) override;
54
58 bool Hit(const vtkContextMouseEvent& mouse) override;
59
63 bool MouseEnterEvent(const vtkContextMouseEvent& mouse) override;
64
68 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
69
73 bool MouseLeaveEvent(const vtkContextMouseEvent& mouse) override;
74
78 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
79
83 bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
84
88 virtual void SetLabel(const vtkStdString& label);
89
94
96
102 vtkSetVector4Macro(Dimensions, float);
104
106
112 vtkGetVector4Macro(Dimensions, float);
114
116
123 vtkSetMacro(AutoComputeDimensions, bool);
124 vtkGetMacro(AutoComputeDimensions, bool);
125 vtkBooleanMacro(AutoComputeDimensions, bool);
127
128 enum
129 {
130 LEFT = 0,
135 CUSTOM
136 };
137
139
143 vtkSetMacro(HorizontalAlignment, int);
144 vtkGetMacro(HorizontalAlignment, int);
146
148
152 vtkSetMacro(VerticalAlignment, int);
153 vtkGetMacro(VerticalAlignment, int);
155
157
163 vtkSetVector2Macro(Padding, int);
164 vtkGetVector2Macro(Padding, int);
166
168
173 vtkSetVector2Macro(Margins, int);
174 vtkGetVector2Macro(Margins, int);
176
178
181 vtkGetObjectMacro(Pen, vtkPen);
183
185
188 vtkGetObjectMacro(Brush, vtkBrush);
190
192
196 vtkGetObjectMacro(MouseOverBrush, vtkBrush);
198
200
205 vtkGetObjectMacro(LabelProperties, vtkTextProperty);
207
208 void SetScalarFunctor(double (*scalarFunction)(double, double));
209
210protected:
212 ~vtkBlockItem() override;
213
214 float Dimensions[4];
215
217
219
220 // Some function pointers to optionally do funky things...
221 double (*scalarFunction)(double, double);
222
223private:
224 vtkBlockItem(const vtkBlockItem&) = delete;
225 void operator=(const vtkBlockItem&) = delete;
226
227 vtkTextProperty* LabelProperties;
228 vtkNew<vtkTextProperty> CachedTextProp;
229
230 vtkNew<vtkPen> Pen;
231 vtkNew<vtkPen> CachedPen;
232
233 vtkNew<vtkBrush> Brush;
234 vtkNew<vtkBrush> MouseOverBrush;
235 vtkNew<vtkBrush> CachedBrush;
236
237 int HorizontalAlignment;
238 int VerticalAlignment;
239 bool AutoComputeDimensions;
240 int Padding[2];
241 int Margins[2];
242};
243
244#endif // vtkBlockItem_h
a vtkContextItem that draws a block (optional label).
Definition: vtkBlockItem.h:43
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkStdString Label
Definition: vtkBlockItem.h:216
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkStdString GetLabel()
Get the block label.
bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override
Mouse enter event.
void SetScalarFunctor(double(*scalarFunction)(double, double))
virtual void SetLabel(const vtkStdString &label)
Set the block label.
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the supplied x, y coordinate is inside the item.
~vtkBlockItem() override
bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override
Mouse leave event.
bool Paint(vtkContext2D *painter) override
Paint event for the item.
void SetLabelProperties(vtkTextProperty *)
Provides access to the vtkTextProperty object that controls the way the label is rendered.
static vtkBlockItem * New()
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:97
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
base class for items that are part of a vtkContextScene.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:113
Allocate and hold a VTK object.
Definition: vtkNew.h:165
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:136
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
represent text properties.