ViewerShell Class Reference
[Plug-In Shells]

A base class for plug-ins with modeless dialogs. More...

#include <ViewerShell.h>

Inheritance diagram for ViewerShell:

Inheritance graph

List of all members.

Public Member Functions

 ViewerShell ()
 ~ViewerShell ()
bool getInputSpecification (PlugInArgList *&pArgList)
bool getOutputSpecification (PlugInArgList *&pArgList)
bool abort ()
void cleanupWidget (Subject &subject, const std::string &signal, const boost::any &data)

Protected Member Functions

virtual QWidget * getWidget () const =0

Protected Attributes

AttachmentPtr
< ApplicationServices
mpAppSvcsAttachment


Detailed Description

A base class for plug-ins with modeless dialogs.

This class contains functionality to properly destroy modeless dialogs in a plug-in. The default functionality of the class sets the destroy after execute flag to false so that the modeless dialog will not be destroyed when execute() successfully returns and the allow multiple instances flag to false so that only one modeless widget is available at any time.

The abort() method is used to register a PlugInCallback with DesktopServices to destroy the viewer widget. Derived plug-in classes should therefore provide an implementation for the getWidget() method to return a pointer to the modeless dialog or other viewer widget.

Derived plug-in classes must call the abort() method when the executable should be destroyed. This typically occurs in an overridden QWidget::closeEvent() method in the modeless dialog or when the executable has detected an error and needs to close.

See also:
ExecutableShell

Definition at line 52 of file ViewerShell.h.


Constructor & Destructor Documentation

ViewerShell::ViewerShell (  ) 

Creates a viewer plug-in.

The constructor sets the plug-in type to PlugInManagerServices::ViewerType() and sets the plug-in to not be destroyed after execution.

See also:
getType(), isDestroyedAfterExecute()

ViewerShell::~ViewerShell (  ) 

Destroys the viewer plug-in.


Member Function Documentation

bool ViewerShell::getInputSpecification ( PlugInArgList *&  pArgList  )  [virtual]

Retrieves the plug-in input parameters.

This method queries the plug-in for its input parameters that are needed to execute properly. The input arguments may be different in interactive mode and batch mode.

Parameters:
pArgList A plug-in arg list pointer that is set to a created input argument list specifying the plug-in input parameters. NULL is a valid pointer value if the plug-in does not require any input arguments.
Returns:
Returns true if the input parameter argument list was successfully created. If the plug-in does not require input arguments, true is returned, but the given plug-in arg list pointer may be NULL.
See also:
PlugInArgList

Default Implementation:
The default implementation does not set any args in the arg list and returns true.

Implements Executable.

bool ViewerShell::getOutputSpecification ( PlugInArgList *&  pArgList  )  [virtual]

Retrieves the plug-in output parameters.

This method queries the plug-in for its output parameters that are created during execution. The output arguments may be different in interactive mode and batch mode.

Parameters:
pArgList A plug-in arg list pointer that is set to a created output argument list specifying the plug-in output parameters. NULL is a valid pointer value if the plug-in does not provide any output arguments.
Returns:
Returns true if the output parameter argument list was successfully created. If the plug-in does not provide output arguments, true is returned, but the given plug-in arg list pointer may be NULL.
See also:
PlugInArgList

Default Implementation:
The default implementation does not set any args in the arg list and returns true.

Implements Executable.

bool ViewerShell::abort (  )  [virtual]

Destroys the viewer dialog or widget.

To perform specialized cleanup, this method should be overridden to perform the cleanup before calling the base class to destroy the viewer widget.

Default Implementation:
The default implementation of this method creates a PlugInCallback based on the widget returned from getWidget() and registers it with DesktopServices. When the callback is executed, the widget is hidden and then destroyed.
Returns:
Returns true if the plug-in callback was successfully registered with DesktopServices for the viewer widget, otherwise returns false.
See also:
PlugInCallback, DesktopServices::registerCallback()

Reimplemented from ExecutableShell.

void ViewerShell::cleanupWidget ( Subject subject,
const std::string &  signal,
const boost::any &  data 
)

This slot is called when the ApplicationWindow closes.

The viewer widget is deleted so that proper cleanup order is preserved if the viewer is active during application shutdown.

Parameters:
subject This should be the DesktopServices pointer.
signal DesktopServices::ApplicationWindowClosed
data Invalid

virtual QWidget* ViewerShell::getWidget (  )  const [protected, pure virtual]

Returns the viewer widget.

A value of NULL implies that no viewer widget needs to be destroyed.

The viewer widget is typically a modeless dialog, but can be any QWidget. This method is called by the default implementation of the abort() method to destroy the widget. A derived plug-in should implement this method to return a pointer to the widget so that it can be destroyed.

Returns:
A pointer to the viewer widget as a QWidget.
See also:
abort()


Member Data Documentation

Definition at line 137 of file ViewerShell.h.


Software Development Kit - Opticks 4.9.0 Build 16218