Commit c36a048e authored by Ken Martin's avatar Ken Martin
Browse files

some mods to the user defined methods

parent 362bd499
......@@ -69,7 +69,9 @@ public:
virtual void HighlightActor(vlActor *actor);
void SetStartPickMethod(void (*f)(void *), void *arg);
void SetStartPickMethodArgDelete(void (*f)(void *));
void SetEndPickMethod(void (*f)(void *), void *arg);
void SetEndPickMethodArgDelete(void (*f)(void *));
void SetPicker(vlPicker *picker);
void SetPicker(vlPicker& picker) {this->SetPicker(&picker);};
......@@ -82,6 +84,9 @@ public:
// Create default picker. Used to create one when none is specified.
virtual vlPicker *CreateDefaultPicker();
void SetUserMethod(void (*f)(void *), void *arg);
void SetUserMethodArgDelete(void (*f)(void *));
protected:
vlRenderWindow *RenderWindow;
vlCamera *CurrentCamera;
......@@ -107,9 +112,15 @@ protected:
// methods called prior to and after picking
void (*StartPickMethod)(void *);
void (*StartPickMethodArgDelete)(void *);
void *StartPickMethodArg;
void (*EndPickMethod)(void *);
void (*EndPickMethodArgDelete)(void *);
void *EndPickMethodArg;
void (*UserMethod)(void *);
void (*UserMethodArgDelete)(void *);
void *UserMethodArg;
};
#endif
......@@ -37,9 +37,14 @@ vlRenderWindowInteractor::vlRenderWindowInteractor()
this->CurrentActor = NULL;
this->StartPickMethod = NULL;
this->StartPickMethodArgDelete = NULL;
this->StartPickMethodArg = NULL;
this->EndPickMethod = NULL;
this->EndPickMethodArgDelete = NULL;
this->EndPickMethodArg = NULL;
this->UserMethod = NULL;
this->UserMethodArgDelete = NULL;
this->UserMethodArg = NULL;
}
vlRenderWindowInteractor::~vlRenderWindowInteractor()
......@@ -174,6 +179,55 @@ vlPicker *vlRenderWindowInteractor::CreateDefaultPicker()
return new vlCellPicker;
}
// Description:
// Set the user method. This method is invokedon a ctrl-u.
void vlRenderWindowInteractor::SetUserMethod(void (*f)(void *), void *arg)
{
if ( f != this->UserMethod || arg != this->UserMethodArg )
{
// delete the current arg if there is one and a delete meth
if ((this->UserMethodArg)&&(this->UserMethodArgDelete))
{
(*this->UserMethodArgDelete)(this->UserMethodArg);
}
this->UserMethod = f;
this->UserMethodArg = arg;
this->Modified();
}
}
// Description:
// Called when a void* argument is being discarded. Lets the user free it.
void vlRenderWindowInteractor::SetUserMethodArgDelete(void (*f)(void *))
{
if ( f != this->UserMethodArgDelete)
{
this->UserMethodArgDelete = f;
this->Modified();
}
}
// Description:
// Called when a void* argument is being discarded. Lets the user free it.
void vlRenderWindowInteractor::SetStartPickMethodArgDelete(void (*f)(void *))
{
if ( f != this->StartPickMethodArgDelete)
{
this->StartPickMethodArgDelete = f;
this->Modified();
}
}
// Description:
// Called when a void* argument is being discarded. Lets the user free it.
void vlRenderWindowInteractor::SetEndPickMethodArgDelete(void (*f)(void *))
{
if ( f != this->EndPickMethodArgDelete)
{
this->EndPickMethodArgDelete = f;
this->Modified();
}
}
void vlRenderWindowInteractor::PrintSelf(ostream& os, vlIndent indent)
{
vlObject::PrintSelf(os,indent);
......
Supports Markdown
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