VTK  9.7.1
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
62 #ifndef vtkBalloonWidget_h
63 #define vtkBalloonWidget_h
64 
65 #include "vtkHoverWidget.h"
66 #include "vtkInteractionWidgetsModule.h" // For export macro
67 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
68 
69 VTK_ABI_NAMESPACE_BEGIN
71 class vtkProp;
73 class vtkStdString;
74 class vtkPropMap;
75 class vtkImageData;
76 
77 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBalloonWidget : public vtkHoverWidget
78 {
79 public:
83  static vtkBalloonWidget* New();
84 
86 
90  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
97  void SetEnabled(int) override;
98 
105  {
106  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
107  }
108 
113  {
114  return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);
115  }
116 
120  void CreateDefaultRepresentation() override;
121 
123 
127  void AddBalloon(vtkProp* prop, vtkStdString* str, vtkImageData* img);
128  void AddBalloon(vtkProp* prop, const char* str, vtkImageData* img);
129  void AddBalloon(vtkProp* prop, const char* str) // for wrapping
130  {
131  this->AddBalloon(prop, str, nullptr);
132  }
133  void RemoveBalloon(vtkProp* prop);
135 
137 
143  const char* GetBalloonString(vtkProp* prop);
144  vtkImageData* GetBalloonImage(vtkProp* prop);
146 
148 
152  void UpdateBalloonString(vtkProp* prop, const char* str);
153  void UpdateBalloonImage(vtkProp* prop, vtkImageData* image);
155 
160  virtual vtkProp* GetCurrentProp() { return this->CurrentProp; }
161 
163 
169  void SetPicker(vtkAbstractPropPicker*);
170  vtkGetObjectMacro(Picker, vtkAbstractPropPicker);
172 
173  /*
174  * Register internal Pickers within PickingManager
175  */
176  void RegisterPickers() override;
177 
178 protected:
180  ~vtkBalloonWidget() override;
181 
182  // This class implements the method called from its superclass.
183  int SubclassEndHoverAction() override;
184  int SubclassHoverAction() override;
185 
186  // Classes for managing balloons
187  vtkPropMap* PropMap; // PIMPL'd map of (vtkProp,vtkStdString)
188 
189  // Support for picking
191 
192  // The vtkProp that is being hovered over (which may be nullptr)
194 
195 private:
196  vtkBalloonWidget(const vtkBalloonWidget&) = delete;
197  void operator=(const vtkBalloonWidget&) = delete;
198 };
199 
200 VTK_ABI_NAMESPACE_END
201 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void SetEnabled(int) override
The method for activating and deactivating this widget.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:27
vtkBalloonRepresentation * GetBalloonRepresentation()
Return the representation as a vtkBalloonRepresentation.
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkWidgetRepresentation * WidgetRep
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for a VTK class.
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void CreateDefaultRepresentation() override
A default representation, of which there is none, is created.
virtual int SubclassHoverAction()
popup text balloons above instance of vtkProp when hovering occurs
represent the vtkBalloonWidget
virtual int SubclassEndHoverAction()
abstract API for pickers that can pick an instance of vtkProp
vtkAbstractPropPicker * Picker
virtual vtkProp * GetCurrentProp()
Return the current vtkProp that is being hovered over.
invoke a vtkTimerEvent when hovering
void SetWidgetRepresentation(vtkWidgetRepresentation *r)
void AddBalloon(vtkProp *prop, const char *str)
Add and remove text and/or an image to be associated with a vtkProp.
vtkPropMap * PropMap
#define VTK_MARSHALAUTO
static vtkHoverWidget * New()
Instantiate this class.
void SetRepresentation(vtkBalloonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...