VTK: Interaction/Widgets/vtkBorderWidget.h Source File

| VTK 9.3.1

vtkBorderWidget.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
76 #ifndef vtkBorderWidget_h
77 #define vtkBorderWidget_h
78
79 #include "vtkAbstractWidget.h"
80 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
81 #include "vtkInteractionWidgetsModule.h" // For export macro
82 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
83
84 VTK_ABI_NAMESPACE_BEGIN
85 class vtkBorderRepresentation;
86
87 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
88 {
89 public:
93 static vtkBorderWidget* New();
94
96
99 vtkTypeMacro(vtkBorderWidget, vtkAbstractWidget);
100 void PrintSelf(ostream& os, vtkIndent indent) override;
102
104
110 vtkSetMacro(Selectable, vtkTypeBool);
111 vtkGetMacro(Selectable, vtkTypeBool);
112 vtkBooleanMacro(Selectable, vtkTypeBool);
114
116
121 vtkSetMacro(Resizable, vtkTypeBool);
122 vtkGetMacro(Resizable, vtkTypeBool);
123 vtkBooleanMacro(Resizable, vtkTypeBool);
125
131 void SetRepresentation(vtkBorderRepresentation* r)
132 {
133 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
134 }
135
139 vtkBorderRepresentation* GetBorderRepresentation()
140 {
141 return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
142 }
143
147 void CreateDefaultRepresentation() override;
148
153 vtkTypeBool GetProcessEvents() override;
154
155 protected:
156 vtkBorderWidget();
157 ~vtkBorderWidget() override;
158
164 virtual void SelectRegion(double eventPos[2]);
165
166 // enable the selection of the region interior to the widget
167 vtkTypeBool Selectable;
168 vtkTypeBool Resizable;
169
170 // processes the registered events
171 static void SelectAction(vtkAbstractWidget*);
172 static void TranslateAction(vtkAbstractWidget*);
173 static void EndSelectAction(vtkAbstractWidget*);
174 static void MoveAction(vtkAbstractWidget*);
175 static void HoverLeaveAction(vtkAbstractWidget*);
176
177 // Special internal methods to support subclasses handling events.
178 // If a non-zero value is returned, the subclass is handling the event.
179 virtual int SubclassSelectAction() { return 0; }
180 virtual int SubclassTranslateAction() { return 0; }
181 virtual int SubclassEndSelectAction() { return 0; }
182 virtual int SubclassMoveAction() { return 0; }
183
184 // helper methods for cursoe management
185 void SetCursor(int State) override;
186
187 // widget state
188 int WidgetState;
189 enum WidgetStateType
190 {
191 Start = 0,
192 Define,
193 Manipulate,
194 Selected
195 };
196 #if !defined(VTK_LEGACY_REMOVE)
197 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
198 typedef WidgetStateType _WidgetState;
199 #endif
200
201 private:
202 vtkBorderWidget(const vtkBorderWidget&) = delete;
203 void operator=(const vtkBorderWidget&) = delete;
204 };
205
206 VTK_ABI_NAMESPACE_END
207 #endif
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:178
vtkBorderRepresentation
represent a vtkBorderWidget
Definition: vtkBorderRepresentation.h:61
vtkBorderWidget
place a border around a 2D rectangular region
Definition: vtkBorderWidget.h:88
vtkBorderWidget::Resizable
vtkTypeBool Resizable
Definition: vtkBorderWidget.h:168
vtkBorderWidget::SelectAction
static void SelectAction(vtkAbstractWidget *)
vtkBorderWidget::TranslateAction
static void TranslateAction(vtkAbstractWidget *)
vtkBorderWidget::WidgetState
int WidgetState
Definition: vtkBorderWidget.h:188
vtkBorderWidget::SelectRegion
virtual void SelectRegion(double eventPos[2])
Subclasses generally implement this method.
vtkBorderWidget::~vtkBorderWidget
~vtkBorderWidget() override
vtkBorderWidget::New
static vtkBorderWidget * New()
Method to instantiate class.
vtkBorderWidget::SetCursor
void SetCursor(int State) override
vtkBorderWidget::vtkBorderWidget
vtkBorderWidget()
vtkBorderWidget::Selectable
vtkTypeBool Selectable
Definition: vtkBorderWidget.h:167
vtkBorderWidget::WidgetStateType
WidgetStateType
Definition: vtkBorderWidget.h:190
vtkBorderWidget::Define
@ Define
Definition: vtkBorderWidget.h:192
vtkBorderWidget::Manipulate
@ Manipulate
Definition: vtkBorderWidget.h:193
vtkBorderWidget::GetBorderRepresentation
vtkBorderRepresentation * GetBorderRepresentation()
Return the representation as a vtkBorderRepresentation.
Definition: vtkBorderWidget.h:139
vtkBorderWidget::SubclassSelectAction
virtual int SubclassSelectAction()
Definition: vtkBorderWidget.h:179
vtkBorderWidget::EndSelectAction
static void EndSelectAction(vtkAbstractWidget *)
vtkBorderWidget::HoverLeaveAction
static void HoverLeaveAction(vtkAbstractWidget *)
vtkBorderWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkBorderWidget::SubclassMoveAction
virtual int SubclassMoveAction()
Definition: vtkBorderWidget.h:182
vtkBorderWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for class.
vtkBorderWidget::SubclassEndSelectAction
virtual int SubclassEndSelectAction()
Definition: vtkBorderWidget.h:181
vtkBorderWidget::SubclassTranslateAction
virtual int SubclassTranslateAction()
Definition: vtkBorderWidget.h:180
vtkBorderWidget::SetRepresentation
void SetRepresentation(vtkBorderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkBorderWidget.h:131
vtkBorderWidget::GetProcessEvents
vtkTypeBool GetProcessEvents() override
Reimplement ProcessEvents to disable it when using relative location with windowLocation.
vtkBorderWidget::MoveAction
static void MoveAction(vtkAbstractWidget *)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:65
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkAbstractWidget.h
vtkDeprecation.h
VTK_DEPRECATED_IN_9_2_0
#define VTK_DEPRECATED_IN_9_2_0(reason)
Definition: vtkDeprecation.h:108