VTK  9.7.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 "vtkInteractionWidgetsModule.h" // For export macro
72 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
73 
74 VTK_ABI_NAMESPACE_BEGIN
76 
77 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBorderWidget : public vtkAbstractWidget
78 {
79 public:
83  static vtkBorderWidget* New();
84 
86 
90  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
94 
100  vtkSetMacro(Selectable, vtkTypeBool);
101  vtkGetMacro(Selectable, vtkTypeBool);
102  vtkBooleanMacro(Selectable, vtkTypeBool);
104 
106 
111  vtkSetMacro(Resizable, vtkTypeBool);
112  vtkGetMacro(Resizable, vtkTypeBool);
113  vtkBooleanMacro(Resizable, vtkTypeBool);
115 
122  {
123  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
124  }
125 
130  {
131  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
132  }
133 
137  void CreateDefaultRepresentation() override;
138 
143  vtkTypeBool GetProcessEvents() override;
144 
145 protected:
146  vtkBorderWidget();
147  ~vtkBorderWidget() override;
148 
154  virtual void SelectRegion(double eventPos[2]);
155 
156  // enable the selection of the region interior to the widget
159 
160  // processes the registered events
161  static void SelectAction(vtkAbstractWidget*);
162  static void TranslateAction(vtkAbstractWidget*);
163  static void EndSelectAction(vtkAbstractWidget*);
164  static void MoveAction(vtkAbstractWidget*);
165  static void HoverLeaveAction(vtkAbstractWidget*);
166 
167  // Special internal methods to support subclasses handling events.
168  // If a non-zero value is returned, the subclass is handling the event.
169  virtual int SubclassSelectAction() { return 0; }
170  virtual int SubclassTranslateAction() { return 0; }
171  virtual int SubclassEndSelectAction() { return 0; }
172  virtual int SubclassMoveAction() { return 0; }
173 
174  // helper methods for cursoe management
175  void SetCursor(int State) override;
176 
177  // widget state
180  {
181  Start = 0,
184  Selected
185  };
186 
187 private:
188  vtkBorderWidget(const vtkBorderWidget&) = delete;
189  void operator=(const vtkBorderWidget&) = delete;
190 };
191 
192 VTK_ABI_NAMESPACE_END
193 #endif
place a border around a 2D rectangular region
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()
#define VTK_MARSHALAUTO
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...
virtual void SetCursor(int state)