VTK  9.0.1
vtkBorderWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBorderWidget.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
76 #ifndef vtkBorderWidget_h
77 #define vtkBorderWidget_h
78 
79 #include "vtkAbstractWidget.h"
80 #include "vtkInteractionWidgetsModule.h" // For export macro
81 
83 
84 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
85 {
86 public:
90  static vtkBorderWidget* New();
91 
93 
97  void PrintSelf(ostream& os, vtkIndent indent) override;
99 
101 
107  vtkSetMacro(Selectable, vtkTypeBool);
108  vtkGetMacro(Selectable, vtkTypeBool);
109  vtkBooleanMacro(Selectable, vtkTypeBool);
111 
113 
118  vtkSetMacro(Resizable, vtkTypeBool);
119  vtkGetMacro(Resizable, vtkTypeBool);
120  vtkBooleanMacro(Resizable, vtkTypeBool);
122 
129  {
130  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
131  }
132 
137  {
138  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
139  }
140 
144  void CreateDefaultRepresentation() 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 
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 #endif
virtual void SetCursor(int vtkNotUsed(state))
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:69
a simple class to control print indentation
Definition: vtkIndent.h:33
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...