forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkCaptionWidget.h
108 lines (85 loc) · 3.75 KB
/
vtkCaptionWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCaptionWidget.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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 "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkBorderWidget.h"
class vtkCaptionRepresentation;
class vtkCaptionActor2D;
class vtkHandleWidget;
class vtkPointHandleRepresentation3D;
class vtkCaptionAnchorCallback;
class VTKINTERACTIONWIDGETS_EXPORT vtkCaptionWidget : public vtkBorderWidget
{
public:
// Description:
// Instantiate this class.
static vtkCaptionWidget *New();
// Description:
// Standard VTK class methods.
vtkTypeMacro(vtkCaptionWidget,vtkBorderWidget);
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)
{this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(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();
protected:
vtkCaptionWidget();
~vtkCaptionWidget();
// 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();
//BTX
friend class vtkCaptionAnchorCallback;
//ETX
private:
vtkCaptionWidget(const vtkCaptionWidget&); //Not implemented
void operator=(const vtkCaptionWidget&); //Not implemented
};
#endif