VTK
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 =========================================================================*/
71 #ifndef vtkBalloonWidget_h
72 #define vtkBalloonWidget_h
73 
74 #include "vtkInteractionWidgetsModule.h" // For export macro
75 #include "vtkHoverWidget.h"
76 
78 class vtkProp;
80 class vtkStdString;
81 class vtkPropMap;
82 class vtkImageData;
83 
84 
85 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonWidget : public vtkHoverWidget
86 {
87 public:
91  static vtkBalloonWidget *New();
92 
94 
98  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
100 
105  void SetEnabled(int) VTK_OVERRIDE;
106 
113  {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
114 
119  {return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);}
120 
124  void CreateDefaultRepresentation() VTK_OVERRIDE;
125 
127 
131  void AddBalloon(vtkProp *prop, vtkStdString *str, vtkImageData *img);
132  void AddBalloon(vtkProp *prop, const char *str, vtkImageData *img);
133  void AddBalloon(vtkProp *prop, const char *str) //for wrapping
134  {this->AddBalloon(prop,str,NULL);}
135  void RemoveBalloon(vtkProp *prop);
137 
139 
145  const char *GetBalloonString(vtkProp *prop);
146  vtkImageData *GetBalloonImage(vtkProp *prop);
148 
150 
154  void UpdateBalloonString(vtkProp *prop, const char *str);
155  void UpdateBalloonImage(vtkProp *prop, vtkImageData *image);
157 
163  {return this->CurrentProp;}
164 
166 
172  void SetPicker(vtkAbstractPropPicker*);
173  vtkGetObjectMacro(Picker,vtkAbstractPropPicker);
175 
176 protected:
178  ~vtkBalloonWidget() VTK_OVERRIDE;
179 
180  // This class implements the method called from its superclass.
181  int SubclassEndHoverAction() VTK_OVERRIDE;
182  int SubclassHoverAction() VTK_OVERRIDE;
183 
184  // Classes for managing balloons
185  vtkPropMap *PropMap; //PIMPL'd map of (vtkProp,vtkStdString)
186 
187  // Support for picking
189 
190  // Register internal Pickers within PickingManager
191  void RegisterPickers() VTK_OVERRIDE;
192 
193  // The vtkProp that is being hovered over (which may be NULL)
194  vtkProp *CurrentProp;
195 
196 private:
197  vtkBalloonWidget(const vtkBalloonWidget&) VTK_DELETE_FUNCTION;
198  void operator=(const vtkBalloonWidget&) VTK_DELETE_FUNCTION;
199 };
200 
201 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
void SetEnabled(int) override
The method for activating and deactivating this widget.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
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:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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...