Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkMRMLAbstractWidget Class Reference

Process interaction events to update state of MRML widget nodes. More...

#include <Libs/MRML/DisplayableManager/vtkMRMLAbstractWidget.h>

Inheritance diagram for vtkMRMLAbstractWidget:
Inheritance graph
[legend]
Collaboration diagram for vtkMRMLAbstractWidget:
Collaboration graph
[legend]

Public Types

enum  {
  WidgetStateAny, WidgetStateIdle, WidgetStateOnWidget, WidgetStateTranslate,
  WidgetStateRotate, WidgetStateScale, WidgetStateUser
}
 The state of the widget. More...
 
typedef vtkObject Superclass
 Standard methods for a VTK class. More...
 
enum  WidgetEvents {
  WidgetEventNone, WidgetEventMouseMove, WidgetEventTranslateStart, WidgetEventTranslateEnd,
  WidgetEventRotateStart, WidgetEventRotateEnd, WidgetEventScaleStart, WidgetEventScaleEnd,
  WidgetEventPick, WidgetEventJumpCursor, WidgetEventAction, WidgetEventCustomAction1,
  WidgetEventCustomAction2, WidgetEventCustomAction3, WidgetEventSelect, WidgetEventUnselect,
  WidgetEventToggleSelect, WidgetEventMenu, WidgetEventReset, WidgetEventUser
}
 Widget events. More...
 

Public Member Functions

virtual bool CanProcessInteractionEvent (vtkMRMLInteractionEventData *eventData, double &distance2)
 
virtual const char * GetClassName ()
 
virtual bool GetGrabFocus ()
 
vtkMRMLInteractionNodeGetInteractionNode ()
 
virtual bool GetInteractive ()
 
virtual int GetMouseCursor ()
 
vtkMRMLApplicationLogicGetMRMLApplicationLogic ()
 
virtual bool GetNeedToRender ()
 
virtual vtkRenderer * GetRenderer ()
 
virtual vtkMRMLAbstractWidgetRepresentationGetRepresentation ()
 Get the representation. More...
 
virtual int GetWidgetState ()
 Convenient method to determine the state of the method. More...
 
virtual int IsA (const char *type)
 
virtual void Leave (vtkMRMLInteractionEventData *eventData)
 Called when the the widget loses the focus. More...
 
virtual void NeedToRenderOff ()
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual bool ProcessInteractionEvent (vtkMRMLInteractionEventData *eventData)
 
void SetEventTranslation (int widgetState, unsigned long interactionEvent, int modifiers, unsigned long widgetEvent)
 
void SetEventTranslation (unsigned long interactionEvent, int modifiers, unsigned long widgetEvent)
 
void SetEventTranslationClickAndDrag (int widgetState, unsigned long startInteractionEvent, int modifiers, int widgetStateDragging, unsigned long widgetStartEvent, unsigned long widgetEndEvent)
 
void SetKeyboardEventTranslation (int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
 
void SetKeyboardEventTranslation (int widgetState, int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
 
virtual void SetMRMLApplicationLogic (vtkMRMLApplicationLogic *applicationLogic)
 
void SetRenderer (vtkRenderer *renderer)
 
virtual void SetRepresentation (vtkMRMLAbstractWidgetRepresentation *r)
 
virtual void SetWidgetState (int)
 Convenient method to change what state the widget is in. More...
 
virtual unsigned long TranslateInteractionEventToWidgetEvent (vtkMRMLInteractionEventData *eventData)
 Get widget event from translation event. More...
 
virtual void UpdateFromMRML (vtkMRMLNode *caller, unsigned long event, void *callData=nullptr)
 Build the actors of the representation with the info stored in the MRML scene. More...
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkMRMLAbstractWidgetSafeDownCast (vtkObject *o)
 

Protected Member Functions

const char * GetAssociatedNodeID (vtkMRMLInteractionEventData *eventData)
 
unsigned long TranslateInteractionEventToWidgetEvent (vtkWidgetEventTranslator *translator, vtkMRMLInteractionEventData *eventData)
 Helper function that attempts to translate an event with a specific translator only. More...
 
 vtkMRMLAbstractWidget ()
 
 ~vtkMRMLAbstractWidget () override
 

Protected Attributes

vtkMRMLApplicationLogicApplicationLogic
 
std::vector< vtkSmartPointer< vtkWidgetEventTranslator > > EventTranslators
 
vtkRenderer * Renderer
 
vtkSmartPointer< vtkMRMLAbstractWidgetRepresentationWidgetRep
 
int WidgetState
 

Detailed Description

Process interaction events to update state of MRML widget nodes.

vtkMRMLAbstractWidget is the abstract class that handles interaction events received from the displayable manager. To decide which widget gets the chance to process an interaction event, this class does not use VTK picking manager, but interactor style class queries displayable managers about what events they can process, displayable manager queries its widgets, and based on the returned information, interactor style selects a displayable manager and the displayable manager selects a widget.

vtkAbstractWidget uses vtkSlicerWidgetEventTranslator to translate VTK interaction events (defined in vtkCommand.h) into widget events (defined in vtkMRMLAbstractWidget.h and subclasses). This class allows modification of event bindings.

See also
vtkSlicerWidgetRepresentation vtkSlicerWidgetEventTranslator

Definition at line 59 of file vtkMRMLAbstractWidget.h.

Member Typedef Documentation

◆ Superclass

Standard methods for a VTK class.

Definition at line 63 of file vtkMRMLAbstractWidget.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The state of the widget.

Enumerator
WidgetStateAny 
WidgetStateIdle 
WidgetStateOnWidget 
WidgetStateTranslate 
WidgetStateRotate 
WidgetStateScale 
WidgetStateUser 

Definition at line 86 of file vtkMRMLAbstractWidget.h.

◆ WidgetEvents

Widget events.

Enumerator
WidgetEventNone 
WidgetEventMouseMove 
WidgetEventTranslateStart 
WidgetEventTranslateEnd 
WidgetEventRotateStart 
WidgetEventRotateEnd 
WidgetEventScaleStart 
WidgetEventScaleEnd 
WidgetEventPick 
WidgetEventJumpCursor 
WidgetEventAction 
WidgetEventCustomAction1 
WidgetEventCustomAction2 
WidgetEventCustomAction3 
WidgetEventSelect 
WidgetEventUnselect 
WidgetEventToggleSelect 
WidgetEventMenu 
WidgetEventReset 
WidgetEventUser 

Definition at line 98 of file vtkMRMLAbstractWidget.h.

Constructor & Destructor Documentation

◆ vtkMRMLAbstractWidget()

vtkMRMLAbstractWidget::vtkMRMLAbstractWidget ( )
protected

◆ ~vtkMRMLAbstractWidget()

vtkMRMLAbstractWidget::~vtkMRMLAbstractWidget ( )
overrideprotected

Member Function Documentation

◆ CanProcessInteractionEvent()

virtual bool vtkMRMLAbstractWidget::CanProcessInteractionEvent ( vtkMRMLInteractionEventData eventData,
double &  distance2 
)
virtual

Return true if the widget can process the event. Distance2 is the squared distance in display coordinates from the closest interaction position. The displayable manager with the closest distance will get the chance to process the interaction event.

Reimplemented in vtkSlicerMarkupsWidget, vtkMRMLWindowLevelWidget, vtkMRMLSliceIntersectionWidget, and vtkMRMLCameraWidget.

◆ GetAssociatedNodeID()

const char* vtkMRMLAbstractWidget::GetAssociatedNodeID ( vtkMRMLInteractionEventData eventData)
protected

Get ID of the node at the specified event position. Returns nullptr if nothing can be found.

◆ GetClassName()

virtual const char* vtkMRMLAbstractWidget::GetClassName ( )
virtual

◆ GetGrabFocus()

virtual bool vtkMRMLAbstractWidget::GetGrabFocus ( )
virtual

◆ GetInteractionNode()

vtkMRMLInteractionNode* vtkMRMLAbstractWidget::GetInteractionNode ( )

◆ GetInteractive()

virtual bool vtkMRMLAbstractWidget::GetInteractive ( )
virtual

Reimplemented in vtkSlicerMarkupsWidget.

◆ GetMouseCursor()

virtual int vtkMRMLAbstractWidget::GetMouseCursor ( )
virtual

Reimplemented in vtkSlicerMarkupsWidget.

◆ GetMRMLApplicationLogic()

vtkMRMLApplicationLogic* vtkMRMLAbstractWidget::GetMRMLApplicationLogic ( )

◆ GetNeedToRender()

virtual bool vtkMRMLAbstractWidget::GetNeedToRender ( )
virtual

◆ GetRenderer()

virtual vtkRenderer* vtkMRMLAbstractWidget::GetRenderer ( )
virtual

◆ GetRepresentation()

virtual vtkMRMLAbstractWidgetRepresentation* vtkMRMLAbstractWidget::GetRepresentation ( )
virtual

Get the representation.

◆ GetWidgetState()

virtual int vtkMRMLAbstractWidget::GetWidgetState ( )
virtual

Convenient method to determine the state of the method.

◆ IsA()

virtual int vtkMRMLAbstractWidget::IsA ( const char *  type)
virtual

◆ IsTypeOf()

static int vtkMRMLAbstractWidget::IsTypeOf ( const char *  type)
static

◆ Leave()

virtual void vtkMRMLAbstractWidget::Leave ( vtkMRMLInteractionEventData eventData)
virtual

Called when the the widget loses the focus.

Reimplemented in vtkSlicerMarkupsWidget, vtkMRMLWindowLevelWidget, and vtkMRMLSliceIntersectionWidget.

◆ NeedToRenderOff()

virtual void vtkMRMLAbstractWidget::NeedToRenderOff ( )
virtual

◆ PrintSelf()

void vtkMRMLAbstractWidget::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

◆ ProcessInteractionEvent()

virtual bool vtkMRMLAbstractWidget::ProcessInteractionEvent ( vtkMRMLInteractionEventData eventData)
virtual

Allows injecting interaction events for processing, without directly observing window interactor events. Return true if the widget processed the event.

Reimplemented in vtkSlicerMarkupsWidget, vtkMRMLWindowLevelWidget, vtkMRMLSliceIntersectionWidget, and vtkMRMLCameraWidget.

◆ SafeDownCast()

static vtkMRMLAbstractWidget* vtkMRMLAbstractWidget::SafeDownCast ( vtkObject *  o)
static

◆ SetEventTranslation() [1/2]

void vtkMRMLAbstractWidget::SetEventTranslation ( int  widgetState,
unsigned long  interactionEvent,
int  modifiers,
unsigned long  widgetEvent 
)

Define interaction event to widget event translation for mouse and other controller events Used in the specified widget state only.

◆ SetEventTranslation() [2/2]

void vtkMRMLAbstractWidget::SetEventTranslation ( unsigned long  interactionEvent,
int  modifiers,
unsigned long  widgetEvent 
)

Define interaction event to widget event translation for mouse and other controller events. Used in any widget state.

◆ SetEventTranslationClickAndDrag()

void vtkMRMLAbstractWidget::SetEventTranslationClickAndDrag ( int  widgetState,
unsigned long  startInteractionEvent,
int  modifiers,
int  widgetStateDragging,
unsigned long  widgetStartEvent,
unsigned long  widgetEndEvent 
)

◆ SetKeyboardEventTranslation() [1/2]

void vtkMRMLAbstractWidget::SetKeyboardEventTranslation ( int  modifier,
char  keyCode,
int  repeatCount,
const char *  keySym,
unsigned long  widgetEvent 
)

Define interaction event to widget event translation for keyboard events. Used in any widget state.

◆ SetKeyboardEventTranslation() [2/2]

void vtkMRMLAbstractWidget::SetKeyboardEventTranslation ( int  widgetState,
int  modifier,
char  keyCode,
int  repeatCount,
const char *  keySym,
unsigned long  widgetEvent 
)

Define interaction event to widget event translation for keyboard events. Used in the specified widget state only.

◆ SetMRMLApplicationLogic()

virtual void vtkMRMLAbstractWidget::SetMRMLApplicationLogic ( vtkMRMLApplicationLogic applicationLogic)
virtual

◆ SetRenderer()

void vtkMRMLAbstractWidget::SetRenderer ( vtkRenderer *  renderer)

◆ SetRepresentation()

virtual void vtkMRMLAbstractWidget::SetRepresentation ( vtkMRMLAbstractWidgetRepresentation r)
virtual

Set the representation. The widget takes over the ownership of this actor.

◆ SetWidgetState()

virtual void vtkMRMLAbstractWidget::SetWidgetState ( int  )
virtual

Convenient method to change what state the widget is in.

◆ TranslateInteractionEventToWidgetEvent() [1/2]

virtual unsigned long vtkMRMLAbstractWidget::TranslateInteractionEventToWidgetEvent ( vtkMRMLInteractionEventData eventData)
virtual

Get widget event from translation event.

◆ TranslateInteractionEventToWidgetEvent() [2/2]

unsigned long vtkMRMLAbstractWidget::TranslateInteractionEventToWidgetEvent ( vtkWidgetEventTranslator *  translator,
vtkMRMLInteractionEventData eventData 
)
protected

Helper function that attempts to translate an event with a specific translator only.

◆ UpdateFromMRML()

virtual void vtkMRMLAbstractWidget::UpdateFromMRML ( vtkMRMLNode caller,
unsigned long  event,
void *  callData = nullptr 
)
virtual

Build the actors of the representation with the info stored in the MRML scene.

Member Data Documentation

◆ ApplicationLogic

vtkMRMLApplicationLogic* vtkMRMLAbstractWidget::ApplicationLogic
protected

Definition at line 192 of file vtkMRMLAbstractWidget.h.

◆ EventTranslators

std::vector< vtkSmartPointer<vtkWidgetEventTranslator> > vtkMRMLAbstractWidget::EventTranslators
protected

Definition at line 198 of file vtkMRMLAbstractWidget.h.

◆ Renderer

vtkRenderer* vtkMRMLAbstractWidget::Renderer
protected

Definition at line 190 of file vtkMRMLAbstractWidget.h.

◆ WidgetRep

vtkSmartPointer<vtkMRMLAbstractWidgetRepresentation> vtkMRMLAbstractWidget::WidgetRep
protected

Definition at line 202 of file vtkMRMLAbstractWidget.h.

◆ WidgetState

int vtkMRMLAbstractWidget::WidgetState
protected

Definition at line 200 of file vtkMRMLAbstractWidget.h.


The documentation for this class was generated from the following file: