Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (84 sloc) 3.69 KB
Program: Visualization Toolkit
Module: vtkCaptionWidget.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or for details.
This software is distributed WITHOUT ANY WARRANTY; without even
PURPOSE. See the above copyright notice for more information.
// .NAME vtkCaptionWidget - widget for placing a caption (text plus leader)
// .SECTION Description
// This class provides support for interactively placing a caption on the 2D
// overlay plane. A caption is defined by some text with a leader (e.g.,
// arrow) that points from the text to a point in the scene. The caption is
// represented by a vtkCaptionRepresentation. It uses the event bindings of
// its superclass (vtkBorderWidget) to control the placement of the text, and
// adds the ability to move the attachment point around. In addition, when
// the caption text is selected, the widget emits a ActivateEvent that
// observers can watch for. This is useful for opening GUI dialogoues to
// adjust font characteristics, etc. (Please see the superclass for a
// description of event bindings.)
// Note that this widget extends the behavior of its superclass
// vtkBorderWidget. The end point of the leader can be selected and
// moved around with an internal vtkHandleWidget.
// .SECTION See Also
// vtkBorderWidget vtkTextWidget
#ifndef __vtkCaptionWidget_h
#define __vtkCaptionWidget_h
#include "vtkBorderWidget.h"
class vtkCaptionRepresentation;
class vtkCaptionActor2D;
class vtkHandleWidget;
class vtkPointHandleRepresentation3D;
class vtkCaptionAnchorCallback;
class VTK_WIDGETS_EXPORT vtkCaptionWidget : public vtkBorderWidget
// Description:
// Instantiate this class.
static vtkCaptionWidget *New();
// Description:
// Standard VTK class methods.
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Override superclasses' SetEnabled() method because the caption leader
// has its own dedicated widget.
virtual void SetEnabled(int enabling);
// Description:
// Specify an instance of vtkWidgetRepresentation used to represent this
// widget in the scene. Note that the representation is a subclass of vtkProp
// so it can be added to the renderer independent of the widget.
void SetRepresentation(vtkCaptionRepresentation *r)
// Description:
// Specify a vtkCaptionActor2D to manage. This is convenient, alternative
// method to SetRepresentation(). It internally create a vtkCaptionRepresentation
// and then invokes vtkCaptionRepresentation::SetCaptionActor2D().
void SetCaptionActor2D(vtkCaptionActor2D *capActor);
vtkCaptionActor2D *GetCaptionActor2D();
// Description:
// Create the default widget representation if one is not set.
void CreateDefaultRepresentation();
// Handles callbacks from the anchor point
vtkCaptionAnchorCallback *AnchorCallback;
// Widget for the anchor point
vtkHandleWidget *HandleWidget;
// Special callbacks for the anchor interaction
void StartAnchorInteraction();
void AnchorInteraction();
void EndAnchorInteraction();
friend class vtkCaptionAnchorCallback;
vtkCaptionWidget(const vtkCaptionWidget&); //Not implemented
void operator=(const vtkCaptionWidget&); //Not implemented
Something went wrong with that request. Please try again.