VTK  9.2.6
vtkBalloonWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBalloonWidget.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 =========================================================================*/
74 #ifndef vtkBalloonWidget_h
75 #define vtkBalloonWidget_h
76 
77 #include "vtkHoverWidget.h"
78 #include "vtkInteractionWidgetsModule.h" // For export macro
79 
81 class vtkProp;
83 class vtkStdString;
84 class vtkPropMap;
85 class vtkImageData;
86 
87 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonWidget : public vtkHoverWidget
88 {
89 public:
93  static vtkBalloonWidget* New();
94 
96 
100  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
107  void SetEnabled(int) override;
108 
115  {
116  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
117  }
118 
123  {
124  return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);
125  }
126 
130  void CreateDefaultRepresentation() override;
131 
133 
137  void AddBalloon(vtkProp* prop, vtkStdString* str, vtkImageData* img);
138  void AddBalloon(vtkProp* prop, const char* str, vtkImageData* img);
139  void AddBalloon(vtkProp* prop, const char* str) // for wrapping
140  {
141  this->AddBalloon(prop, str, nullptr);
142  }
143  void RemoveBalloon(vtkProp* prop);
145 
147 
153  const char* GetBalloonString(vtkProp* prop);
154  vtkImageData* GetBalloonImage(vtkProp* prop);
156 
158 
162  void UpdateBalloonString(vtkProp* prop, const char* str);
163  void UpdateBalloonImage(vtkProp* prop, vtkImageData* image);
165 
170  virtual vtkProp* GetCurrentProp() { return this->CurrentProp; }
171 
173 
179  void SetPicker(vtkAbstractPropPicker*);
180  vtkGetObjectMacro(Picker, vtkAbstractPropPicker);
182 
183  /*
184  * Register internal Pickers within PickingManager
185  */
186  void RegisterPickers() override;
187 
188 protected:
190  ~vtkBalloonWidget() override;
191 
192  // This class implements the method called from its superclass.
193  int SubclassEndHoverAction() override;
194  int SubclassHoverAction() override;
195 
196  // Classes for managing balloons
197  vtkPropMap* PropMap; // PIMPL'd map of (vtkProp,vtkStdString)
198 
199  // Support for picking
201 
202  // The vtkProp that is being hovered over (which may be nullptr)
204 
205 private:
206  vtkBalloonWidget(const vtkBalloonWidget&) = delete;
207  void operator=(const vtkBalloonWidget&) = delete;
208 };
209 
210 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
void SetEnabled(int) override
The method for activating and deactivating this widget.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
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:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
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
static vtkHoverWidget * New()
Instantiate this class.
void SetRepresentation(vtkBalloonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...