VTK  9.3.0
vtkBalloonWidget.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
71 #ifndef vtkBalloonWidget_h
72 #define vtkBalloonWidget_h
73 
74 #include "vtkHoverWidget.h"
75 #include "vtkInteractionWidgetsModule.h" // For export macro
76 
77 VTK_ABI_NAMESPACE_BEGIN
79 class vtkProp;
81 class vtkStdString;
82 class vtkPropMap;
83 class vtkImageData;
84 
85 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonWidget : public vtkHoverWidget
86 {
87 public:
91  static vtkBalloonWidget* New();
92 
94 
98  void PrintSelf(ostream& os, vtkIndent indent) override;
100 
105  void SetEnabled(int) override;
106 
113  {
115  }
116 
121  {
122  return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);
123  }
124 
129 
131 
135  void AddBalloon(vtkProp* prop, vtkStdString* str, vtkImageData* img);
136  void AddBalloon(vtkProp* prop, const char* str, vtkImageData* img);
137  void AddBalloon(vtkProp* prop, const char* str) // for wrapping
138  {
139  this->AddBalloon(prop, str, nullptr);
140  }
141  void RemoveBalloon(vtkProp* prop);
143 
145 
151  const char* GetBalloonString(vtkProp* prop);
154 
156 
160  void UpdateBalloonString(vtkProp* prop, const char* str);
163 
168  virtual vtkProp* GetCurrentProp() { return this->CurrentProp; }
169 
171 
178  vtkGetObjectMacro(Picker, vtkAbstractPropPicker);
180 
181  /*
182  * Register internal Pickers within PickingManager
183  */
184  void RegisterPickers() override;
185 
186 protected:
188  ~vtkBalloonWidget() override;
189 
190  // This class implements the method called from its superclass.
191  int SubclassEndHoverAction() override;
192  int SubclassHoverAction() override;
193 
194  // Classes for managing balloons
195  vtkPropMap* PropMap; // PIMPL'd map of (vtkProp,vtkStdString)
196 
197  // Support for picking
199 
200  // The vtkProp that is being hovered over (which may be nullptr)
202 
203 private:
204  vtkBalloonWidget(const vtkBalloonWidget&) = delete;
205  void operator=(const vtkBalloonWidget&) = delete;
206 };
207 
208 VTK_ABI_NAMESPACE_END
209 #endif
abstract API for pickers that can pick an instance of vtkProp
void SetWidgetRepresentation(vtkWidgetRepresentation *r)
vtkWidgetRepresentation * WidgetRep
represent the vtkBalloonWidget
popup text balloons above instance of vtkProp when hovering occurs
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
void SetEnabled(int) override
The method for activating and deactivating this widget.
~vtkBalloonWidget() override
const char * GetBalloonString(vtkProp *prop)
Methods to retrieve the information associated with each vtkProp (i.e., the information that makes up...
vtkBalloonRepresentation * GetBalloonRepresentation()
Return the representation as a vtkBalloonRepresentation.
void RemoveBalloon(vtkProp *prop)
Add and remove text and/or an image to be associated with a vtkProp.
vtkPropMap * PropMap
virtual vtkProp * GetCurrentProp()
Return the current vtkProp that is being hovered over.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetPicker(vtkAbstractPropPicker *)
Set/Get the object used to perform pick operations.
void UpdateBalloonImage(vtkProp *prop, vtkImageData *image)
Update the balloon string or image.
void AddBalloon(vtkProp *prop, const char *str)
Add and remove text and/or an image to be associated with a vtkProp.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for a VTK class.
void UpdateBalloonString(vtkProp *prop, const char *str)
Update the balloon string or image.
static vtkBalloonWidget * New()
Instantiate this class.
int SubclassHoverAction() override
void SetRepresentation(vtkBalloonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
int SubclassEndHoverAction() override
void AddBalloon(vtkProp *prop, vtkStdString *str, vtkImageData *img)
Add and remove text and/or an image to be associated with a vtkProp.
vtkAbstractPropPicker * Picker
void AddBalloon(vtkProp *prop, const char *str, vtkImageData *img)
Add and remove text and/or an image to be associated with a vtkProp.
vtkImageData * GetBalloonImage(vtkProp *prop)
Methods to retrieve the information associated with each vtkProp (i.e., the information that makes up...
invoke a vtkTimerEvent when hovering
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
abstract class defines interface between the widget and widget representation classes
@ image
Definition: vtkX3D.h:374