VTK  9.1.0
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 =========================================================================*/
132 #ifndef vtkBorderWidget_h
133 #define vtkBorderWidget_h
134 
135 #include "vtkAbstractWidget.h"
136 #include "vtkInteractionWidgetsModule.h" // For export macro
137 
139 
140 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderWidget : public vtkAbstractWidget
141 {
142 public:
146  static vtkBorderWidget* New();
147 
149 
153  void PrintSelf(ostream& os, vtkIndent indent) override;
155 
157 
163  vtkSetMacro(Selectable, vtkTypeBool);
164  vtkGetMacro(Selectable, vtkTypeBool);
165  vtkBooleanMacro(Selectable, vtkTypeBool);
167 
169 
174  vtkSetMacro(Resizable, vtkTypeBool);
175  vtkGetMacro(Resizable, vtkTypeBool);
176  vtkBooleanMacro(Resizable, vtkTypeBool);
178 
185  {
186  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
187  }
188 
193  {
194  return reinterpret_cast<vtkBorderRepresentation*>(this->WidgetRep);
195  }
196 
201 
202 protected:
204  ~vtkBorderWidget() override;
205 
211  virtual void SelectRegion(double eventPos[2]);
212 
213  // enable the selection of the region interior to the widget
216 
217  // processes the registered events
223 
224  // Special internal methods to support subclasses handling events.
225  // If a non-zero value is returned, the subclass is handling the event.
226  virtual int SubclassSelectAction() { return 0; }
227  virtual int SubclassTranslateAction() { return 0; }
228  virtual int SubclassEndSelectAction() { return 0; }
229  virtual int SubclassMoveAction() { return 0; }
230 
231  // helper methods for cursoe management
232  void SetCursor(int State) override;
233 
234  // widget state
237  {
238  Start = 0,
241  Selected
242  };
243 
244 private:
245  vtkBorderWidget(const vtkBorderWidget&) = delete;
246  void operator=(const vtkBorderWidget&) = delete;
247 };
248 
249 #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.
static void MoveAction(vtkAbstractWidget *)
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69