VTK  9.3.0
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
67 #ifndef vtkBorderWidget_h
68 #define vtkBorderWidget_h
69 
70 #include "vtkAbstractWidget.h"
71 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
72 #include "vtkInteractionWidgetsModule.h" // For export macro
73 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
74 
75 VTK_ABI_NAMESPACE_BEGIN
77 
78 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
79 {
80 public:
84  static vtkBorderWidget* New();
85 
87 
91  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
95 
101  vtkSetMacro(Selectable, vtkTypeBool);
102  vtkGetMacro(Selectable, vtkTypeBool);
103  vtkBooleanMacro(Selectable, vtkTypeBool);
105 
107 
112  vtkSetMacro(Resizable, vtkTypeBool);
113  vtkGetMacro(Resizable, vtkTypeBool);
114  vtkBooleanMacro(Resizable, vtkTypeBool);
116 
123  {
124  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
125  }
126 
131  {
132  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
133  }
134 
139 
145 
146 protected:
148  ~vtkBorderWidget() override;
149 
155  virtual void SelectRegion(double eventPos[2]);
156 
157  // enable the selection of the region interior to the widget
160 
161  // processes the registered events
167 
168  // Special internal methods to support subclasses handling events.
169  // If a non-zero value is returned, the subclass is handling the event.
170  virtual int SubclassSelectAction() { return 0; }
171  virtual int SubclassTranslateAction() { return 0; }
172  virtual int SubclassEndSelectAction() { return 0; }
173  virtual int SubclassMoveAction() { return 0; }
174 
175  // helper methods for cursoe management
176  void SetCursor(int State) override;
177 
178  // widget state
181  {
182  Start = 0,
185  Selected
186  };
187 #if !defined(VTK_LEGACY_REMOVE)
188  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
190 #endif
191 
192 private:
193  vtkBorderWidget(const vtkBorderWidget&) = delete;
194  void operator=(const vtkBorderWidget&) = delete;
195 };
196 
197 VTK_ABI_NAMESPACE_END
198 #endif
define the API for widget / widget representation
vtkWidgetRepresentation * WidgetRep
represent a vtkBorderWidget
place a border around a 2D rectangular region
vtkTypeBool Resizable
static void SelectAction(vtkAbstractWidget *)
static void TranslateAction(vtkAbstractWidget *)
virtual void SelectRegion(double eventPos[2])
Subclasses generally implement this method.
~vtkBorderWidget() override
static vtkBorderWidget * New()
Method to instantiate class.
void SetCursor(int State) override
vtkTypeBool Selectable
vtkBorderRepresentation * GetBorderRepresentation()
Return the representation as a vtkBorderRepresentation.
virtual int SubclassSelectAction()
static void EndSelectAction(vtkAbstractWidget *)
static void HoverLeaveAction(vtkAbstractWidget *)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
virtual int SubclassMoveAction()
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for class.
virtual int SubclassEndSelectAction()
virtual int SubclassTranslateAction()
void SetRepresentation(vtkBorderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
vtkTypeBool GetProcessEvents() override
Reimplement ProcessEvents to disable it when using relative location with windowLocation.
static void MoveAction(vtkAbstractWidget *)
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)