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 =========================================================================*/
73 #ifndef vtkBorderWidget_h
74 #define vtkBorderWidget_h
75 
76 #include "vtkAbstractWidget.h"
77 #include "vtkInteractionWidgetsModule.h" // For export macro
78 
80 
81 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
82 {
83 public:
87  static vtkBorderWidget* New();
88 
90 
94  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
98 
104  vtkSetMacro(Selectable, vtkTypeBool);
105  vtkGetMacro(Selectable, vtkTypeBool);
106  vtkBooleanMacro(Selectable, vtkTypeBool);
108 
110 
115  vtkSetMacro(Resizable, vtkTypeBool);
116  vtkGetMacro(Resizable, vtkTypeBool);
117  vtkBooleanMacro(Resizable, vtkTypeBool);
119 
126  {
127  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
128  }
129 
134  {
135  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
136  }
137 
142 
143 protected:
145  ~vtkBorderWidget() override;
146 
152  virtual void SelectRegion(double eventPos[2]);
153 
154  // enable the selection of the region interior to the widget
157 
158  // processes the registered events
163 
164  // Special internal methods to support subclasses handling events.
165  // If a non-zero value is returned, the subclass is handling the event.
166  virtual int SubclassSelectAction() { return 0; }
167  virtual int SubclassTranslateAction() { return 0; }
168  virtual int SubclassEndSelectAction() { return 0; }
169  virtual int SubclassMoveAction() { return 0; }
170 
171  // helper methods for cursoe management
172  void SetCursor(int State) override;
173 
174  // widget state
177  {
178  Start = 0,
181  Selected
182  };
183 
184 private:
185  vtkBorderWidget(const vtkBorderWidget&) = delete;
186  void operator=(const vtkBorderWidget&) = delete;
187 };
188 
189 #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 *)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
virtual int SubclassMoveAction()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int SubclassEndSelectAction()
virtual int SubclassTranslateAction()
void SetRepresentation(vtkBorderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
static void MoveAction(vtkAbstractWidget *)
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69