Commit 46dec6db authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH:Cleaned up API so RequestCursorShape() does not require the explicit...

ENH:Cleaned up API so RequestCursorShape() does not require the explicit instantiation of an vtkObserverMediator, making the method easier to use.
parent 18981309
......@@ -19,8 +19,9 @@
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkObserverMediator.h"
vtkCxxRevisionMacro(vtkInteractorObserver, "1.33");
vtkCxxRevisionMacro(vtkInteractorObserver, "1.34");
vtkCxxSetObjectMacro(vtkInteractorObserver,DefaultRenderer,vtkRenderer);
......@@ -300,6 +301,16 @@ void vtkInteractorObserver::ReleaseFocus()
}
}
//----------------------------------------------------------------------------
int vtkInteractorObserver::RequestCursorShape(int requestedShape)
{
if ( ! this->ObserverMediator )
{
this->ObserverMediator = this->Interactor->GetObserverMediator();
}
return this->ObserverMediator->RequestCursorShape(this,requestedShape);
}
//----------------------------------------------------------------------------
void vtkInteractorObserver::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -42,11 +42,11 @@
#define __vtkInteractorObserver_h
#include "vtkObject.h"
#include "vtkObserverMediator.h" //to do an inline method invocation on this class
class vtkRenderWindowInteractor;
class vtkRenderer;
class vtkCallbackCommand;
class vtkObserverMediator;
class VTK_RENDERING_EXPORT vtkInteractorObserver : public vtkObject
......@@ -208,10 +208,7 @@ protected:
// The mediator used to request resources from the interactor.
vtkObserverMediator *ObserverMediator;
int RequestCursorShape(int requestedShape)
{
return this->ObserverMediator->RequestCursorShape(this,requestedShape);
}
int RequestCursorShape(int requestedShape);
private:
vtkInteractorObserver(const vtkInteractorObserver&); // Not implemented.
......
......@@ -22,9 +22,8 @@
#include "vtkRenderer.h"
#include "vtkEvent.h"
#include "vtkWidgetEvent.h"
#include "vtkObserverMediator.h"
vtkCxxRevisionMacro(vtkAbstractWidget, "1.5");
vtkCxxRevisionMacro(vtkAbstractWidget, "1.6");
//----------------------------------------------------------------------
......@@ -143,7 +142,6 @@ void vtkAbstractWidget::SetEnabled(int enabling)
if ( this->ManagesCursor )
{
this->ObserverMediator = this->Interactor->GetObserverMediator();
this->WidgetRep->ComputeInteractionState(X, Y);
this->SetCursor(this->WidgetRep->GetInteractionState());
}
......
......@@ -29,7 +29,7 @@
#include "vtkRenderWindowInteractor.h"
vtkStandardNewMacro(vtkOrientationMarkerWidget);
vtkCxxRevisionMacro(vtkOrientationMarkerWidget, "1.2");
vtkCxxRevisionMacro(vtkOrientationMarkerWidget, "1.3");
vtkCxxSetObjectMacro(vtkOrientationMarkerWidget, OrientationMarker, vtkProp);
......@@ -163,7 +163,6 @@ void vtkOrientationMarkerWidget::SetEnabled(int enabling)
if (this->Interactive)
{
vtkRenderWindowInteractor *i = this->Interactor;
this->ObserverMediator = this->Interactor->GetObserverMediator();
if ( this->EventCallbackCommand )
{
i->AddObserver( vtkCommand::MouseMoveEvent,
......
......@@ -21,7 +21,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkCoordinate.h"
vtkCxxRevisionMacro(vtkScalarBarWidget, "1.3");
vtkCxxRevisionMacro(vtkScalarBarWidget, "1.4");
vtkStandardNewMacro(vtkScalarBarWidget);
vtkCxxSetObjectMacro(vtkScalarBarWidget, ScalarBarActor, vtkScalarBarActor);
......@@ -88,9 +88,6 @@ void vtkScalarBarWidget::SetEnabled(int enabling)
// Add the scalar bar
this->CurrentRenderer->AddViewProp(this->ScalarBarActor);
this->InvokeEvent(vtkCommand::EnableEvent,NULL);
// Get the cursor resource manager
this->ObserverMediator = this->Interactor->GetObserverMediator();
}
else //disabling------------------------------------------
{
......
......@@ -21,7 +21,7 @@
#include "vtkRenderWindowInteractor.h"
#include "vtkCoordinate.h"
vtkCxxRevisionMacro(vtkXYPlotWidget, "1.2");
vtkCxxRevisionMacro(vtkXYPlotWidget, "1.3");
vtkStandardNewMacro(vtkXYPlotWidget);
vtkCxxSetObjectMacro(vtkXYPlotWidget, XYPlotActor, vtkXYPlotActor);
......@@ -82,8 +82,6 @@ void vtkXYPlotWidget::SetEnabled(int enabling)
i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
this->EventCallbackCommand, this->Priority);
this->ObserverMediator = i->GetObserverMediator();
// Add the xy plot
this->CurrentRenderer->AddViewProp(this->XYPlotActor);
this->InvokeEvent(vtkCommand::EnableEvent,NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment