VTK  9.3.20240229
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
126 #ifndef vtkBorderWidget_h
127 #define vtkBorderWidget_h
128 
129 #include "vtkAbstractWidget.h"
130 #include "vtkInteractionWidgetsModule.h" // For export macro
131 
132 VTK_ABI_NAMESPACE_BEGIN
134 
135 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
136 {
137 public:
141  static vtkBorderWidget* New();
142 
144 
148  void PrintSelf(ostream& os, vtkIndent indent) override;
150 
152 
158  vtkSetMacro(Selectable, vtkTypeBool);
159  vtkGetMacro(Selectable, vtkTypeBool);
160  vtkBooleanMacro(Selectable, vtkTypeBool);
162 
164 
169  vtkSetMacro(Resizable, vtkTypeBool);
170  vtkGetMacro(Resizable, vtkTypeBool);
171  vtkBooleanMacro(Resizable, vtkTypeBool);
173 
180  {
181  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
182  }
183 
188  {
189  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
190  }
191 
196 
202 
203 protected:
205  ~vtkBorderWidget() override;
206 
212  virtual void SelectRegion(double eventPos[2]);
213 
214  // enable the selection of the region interior to the widget
217 
218  // processes the registered events
224 
225  // Special internal methods to support subclasses handling events.
226  // If a non-zero value is returned, the subclass is handling the event.
227  virtual int SubclassSelectAction() { return 0; }
228  virtual int SubclassTranslateAction() { return 0; }
229  virtual int SubclassEndSelectAction() { return 0; }
230  virtual int SubclassMoveAction() { return 0; }
231 
232  // helper methods for cursoe management
233  void SetCursor(int State) override;
234 
235  // widget state
238  {
239  Start = 0,
242  Selected
243  };
244 
245 private:
246  vtkBorderWidget(const vtkBorderWidget&) = delete;
247  void operator=(const vtkBorderWidget&) = delete;
248 };
249 
250 VTK_ABI_NAMESPACE_END
251 #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:108
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64