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
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 
138  void CreateDefaultRepresentation() override;
139 
144  vtkTypeBool GetProcessEvents() override;
145 
146 protected:
147  vtkBorderWidget();
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
162  static void SelectAction(vtkAbstractWidget*);
163  static void TranslateAction(vtkAbstractWidget*);
164  static void EndSelectAction(vtkAbstractWidget*);
165  static void MoveAction(vtkAbstractWidget*);
166  static void HoverLeaveAction(vtkAbstractWidget*);
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
virtual void SetCursor(int vtkNotUsed(state))
place a border around a 2D rectangular region
#define VTK_DEPRECATED_IN_9_2_0(reason)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
virtual int SubclassTranslateAction()
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
virtual int SubclassMoveAction()
vtkWidgetRepresentation * WidgetRep
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual vtkTypeBool GetProcessEvents()
Methods to change whether the widget responds to interaction.
represent a vtkBorderWidget
virtual int SubclassEndSelectAction()
vtkTypeBool Resizable
define the API for widget / widget representation
vtkBorderRepresentation * GetBorderRepresentation()
Return the representation as a vtkBorderRepresentation.
vtkTypeBool Selectable
virtual int SubclassSelectAction()
void SetRepresentation(vtkBorderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...