C++ API Reference
MProgressWindow Class Reference

Create and manipulate progress windows. More...

#include <MProgressWindow.h>

Static Public Member Functions

static bool reserve ()
 Reserves a progress window for use through this class. More...
 
static MStatus startProgress ()
 Displays the progress window on the screen. More...
 
static MStatus endProgress ()
 Destroys the progress window and removes it from the screen. More...
 
static MStatus setProgressRange (const int minValue, const int maxValue)
 Sets the range (minValue, maxValue) of the progress indicator. More...
 
static MStatus setProgressMin (const int minValue)
 Sets the minimum value for the progress. More...
 
static MStatus setProgressMax (const int maxValue)
 Sets the maximum value for the progress. More...
 
static int progressMin (MStatus *ReturnStatus=NULL)
 Get the minimum progress value. More...
 
static int progressMax (MStatus *ReturnStatus=NULL)
 Get the maximum progress value. More...
 
static MStatus setProgress (const int progress)
 Sets the progress value. More...
 
static MStatus advanceProgress (const int amount)
 Increases the progress value by amount. More...
 
static int progress (MStatus *ReturnStatus=NULL)
 Get the progress value. More...
 
static MStatus setTitle (const MString &title)
 Sets the title of the progress window. More...
 
static MString title (MStatus *ReturnStatus=NULL)
 Get the window title. More...
 
static MStatus setProgressStatus (const MString &progressStatus)
 Sets the progress status string. More...
 
static MString progressStatus (MStatus *ReturnStatus=NULL)
 Get the progress status string. More...
 
static MStatus setInterruptable (const bool value)
 Sets whether the progress window is interruptable. More...
 
static bool isInterruptable (MStatus *ReturnStatus=NULL)
 Determine whether the progress window is interruptable. More...
 
static bool isCancelled (MStatus *ReturnStatus=NULL)
 Determine whether the user has tried to cancel an interruptable progress window. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Create and manipulate progress windows.

The MProgressWindow class manages a window containing a status message, a graphical progress gauge, and optionally a "Hit ESC to Cancel" label for interruptable operations.

Only a single progress window may be displayed at any time. To reserve the use of the progress window, use the reserve() method in this class. Any methods that change the state of the progress window will fail unless the progress window has first been successfully reserved.

The startProgress() and endProgress() functions show and hide the progress window. endProgress() also has the effect of unreserving the progress window, allowing it to be reserved for another use.

The MEL command "progressWindow" provides equivalent functionality to this class. Attempting to manipulate a progress window that is in use by MEL will cause the methods in this class to fail.

Member Function Documentation

bool reserve ( )
static

Reserves a progress window for use through this class.

This method must be called before setting progress window parameters or starting progress.

Reserve will fail if progress window is already in use or when this method is called from worker thread.

Returns
true if the progress window was successfully reserved
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MStatus startProgress ( )
static

Displays the progress window on the screen.

Returns
Status code
Status Codes:
  • MS::kSuccess The progress window was created and displayed.
  • MS::kFailure Progress has already been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MStatus endProgress ( )
static

Destroys the progress window and removes it from the screen.

This method also unreserves the progress window, making it available for future reservation.

Returns
Status code
Status Codes:
  • MS::kSuccess The progress window was destroyed.
  • MS::kFailure Progress has not been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MStatus setProgressRange ( const int  minValue,
const int  maxValue 
)
static

Sets the range (minValue, maxValue) of the progress indicator.

When the progress value is set through setProgress() or advanceProgress(), it is checked against the minimum and maximum progress values. If the new progress value lies outside this range, it is clamped to a value in this range.

When the progress value is set to a value of minValue, the progress bar is displayed as empty. When the progress value is set to a value of maxValue, the progress bar is displayed as full. Intermediate progress values are displayed as intermediate positions of the progress bar.

Parameters
[in]minValueMinimum progress value
[in]maxValueMaximum progress value
Returns
Status code
Status Codes:
  • MS::kSuccess The range was set successfully.
  • MS::kInvalidParameter max is less than or equal to min.
  • MS::kFailure Progress has not been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MStatus setProgressMin ( const int  minValue)
static

Sets the minimum value for the progress.

Any progress value less then minValue will be set to minValue, with the progress bar displayed as empty.

Parameters
[in]minValueMinimum progress value
Returns
Status code
Status Codes:
  • MS::kSuccess The minimum was set successfully.
  • MS::kInvalidParameter max is less than or equal to min.
  • MS::kFailure Progress has not been started.
MStatus setProgressMax ( const int  maxValue)
static

Sets the maximum value for the progress.

Any progress value greater then maxValue will be set to maxValue, with the progress bar displayed as full.

Parameters
[in]maxValueMaximum progress value
Returns
Status code
Status Codes:
  • MS::kSuccess The maximum was set successfully.
  • MS::kInvalidParameter max is less than or equal to min.
  • MS::kFailure Progress has not been started.
int progressMin ( MStatus ReturnStatus = NULL)
static

Get the minimum progress value.

Parameters
[out]ReturnStatusStatus code
Returns
Minimum progress value. Returns -1 if query fails.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
int progressMax ( MStatus ReturnStatus = NULL)
static

Get the maximum progress value.

Parameters
[out]ReturnStatusStatus code
Returns
Maximum progress value. Returns -1 if query fails.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
MStatus setProgress ( const int  progress)
static

Sets the progress value.

If progress is not between progressMin() and progressMax() inclusively, it is set to whichever of progressMin() or progressMax() is closest.

Advancing the progress value updates the progress bar to show the new amount of progress.

Parameters
[in]progressNew progress value
Returns
Status code
Status Codes:
  • MS::kSuccess Progress value set.
  • MS::kFailure Progress has not been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MStatus advanceProgress ( const int  amount)
static

Increases the progress value by amount.

If the resulting progress value is not between progressMin() and progressMax() inclusively, it is set to whichever of progressMin() or progressMax() is closest.

Advancing the progress value updates the progress bar to show the new amount of progress.

Parameters
[in]amountValue to add to current progress
Returns
Status code
Status Codes:
  • MS::kSuccess Progress value set.
  • MS::kFailure Progress has not been started.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
int progress ( MStatus ReturnStatus = NULL)
static

Get the progress value.

Parameters
[out]ReturnStatusStatus code
Returns
Progress value. Returns -1 if query fails.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
MStatus setTitle ( const MString title)
static

Sets the title of the progress window.

Parameters
[in]titleNew title
Returns
Status code
Status Codes:
  • MS::kSuccess Title set.
  • MS::kFailure Progress has not been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
MString title ( MStatus ReturnStatus = NULL)
static

Get the window title.

Parameters
[out]ReturnStatusStatus code
Returns
Window title string.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
MStatus setProgressStatus ( const MString progressStatus)
static

Sets the progress status string.

This string is shown above the progress bar and usually is of the form "Performing operation: <tt>XXX</tt>" where XXX is a numerical indication of the amount completed.

Parameters
[in]progressStatusNew status string
Returns
Status code
Status Codes:
  • MS::kSuccess Progress status set.
  • MS::kFailure Progress has not been started.
Examples:
progressWindowCmd/progressWindowCmd.cpp.
MString progressStatus ( MStatus ReturnStatus = NULL)
static

Get the progress status string.

Parameters
[out]ReturnStatusStatus code
Returns
Progress status string.
MStatus setInterruptable ( const bool  value)
static

Sets whether the progress window is interruptable.

An interruptable progress window can accept a signal from the user indicating that the operation should be cancelled.

isCancelled() is used to check if the user has tried to cancel an interruptable progress window.

Parameters
[in]valueTrue if the progress window should be made interruptable.
Returns
Status code
Status Codes:
  • MS::kSuccess Interruptable value set.
  • MS::kFailure Progress has not been started.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
bool isInterruptable ( MStatus ReturnStatus = NULL)
static

Determine whether the progress window is interruptable.

Parameters
[out]ReturnStatusStatus code
Returns
true when the progress window is interruptable
Examples:
progressWindowCmd/progressWindowCmd.cpp.
bool isCancelled ( MStatus ReturnStatus = NULL)
static

Determine whether the user has tried to cancel an interruptable progress window.

Parameters
[out]ReturnStatusStatus code
Returns
true when user has tried to cancel progress. If the progress window is not interruptable, this method returns false.
Examples:
atomImportExport/atomImportExport.cpp, and progressWindowCmd/progressWindowCmd.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

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