VTK  9.3.20240419
vtkTooltipItem.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
15 #ifndef vtkTooltipItem_h
16 #define vtkTooltipItem_h
17 
18 #include "vtkContextItem.h"
19 #include "vtkRenderingContext2DModule.h" // For export macro
20 #include "vtkStdString.h" // For vtkStdString ivars
21 #include "vtkVector.h" // Needed for vtkVector2f
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkPen;
25 class vtkBrush;
26 class vtkTextProperty;
27 
28 class VTKRENDERINGCONTEXT2D_EXPORT vtkTooltipItem : public vtkContextItem
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  static vtkTooltipItem* New();
38 
40 
43  vtkSetVector2Macro(Position, float);
44  void SetPosition(const vtkVector2f& pos);
46 
48 
51  vtkGetVector2Macro(Position, float);
54 
56 
59  virtual void SetText(const vtkStdString& text);
60  virtual vtkStdString GetText();
62 
64 
68  vtkGetObjectMacro(Pen, vtkPen);
70 
72 
75  vtkGetObjectMacro(Brush, vtkBrush);
77 
79 
82  vtkGetObjectMacro(TextProperties, vtkTextProperty);
84 
88  void Update() override;
89 
93  bool Paint(vtkContext2D* painter) override;
94 
95 protected:
97  ~vtkTooltipItem() override;
98 
100  float* Position;
105 
106 private:
107  vtkTooltipItem(const vtkTooltipItem&) = delete;
108  void operator=(const vtkTooltipItem&) = delete;
109 };
110 
111 VTK_ABI_NAMESPACE_END
112 #endif // vtkTooltipItem_h
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:89
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:69
base class for items that are part of a vtkContextScene.
a simple class to control print indentation
Definition: vtkIndent.h:108
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:78
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:78
represent text properties.
takes care of drawing 2D axes
virtual void SetText(const vtkStdString &text)
Get/set the text of the item.
static vtkTooltipItem * New()
Creates a 2D Chart object.
void SetPosition(const vtkVector2f &pos)
Set the position of the tooltip (in pixels).
void Update() override
Update the geometry of the tooltip.
vtkVector2f PositionVector
vtkTextProperty * TextProperties
vtkVector2f GetPositionVector()
Get position of the axis (in pixels).
vtkStdString Text
bool Paint(vtkContext2D *painter) override
Paint event for the tooltip.
virtual vtkStdString GetText()
Get/set the text of the item.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkTooltipItem() override
vtkBrush * Brush