SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions
SketchUpPluginProgressCallback Struct Referenceabstract

Interface to provide import/export progress feedback and cancellation. More...

#include <SketchUpAPI/import_export/pluginprogresscallback.h>

Public Member Functions

virtual bool HasBeenCancelled ()=0
 Call this to test if the user has pressed the cancel button. Your code should clean up and return promptly after detecting this. More...
 
virtual void SetPercentDone (double percent)=0
 Call this to set the percent complete on the dialog. More...
 
virtual void SetStepSize (double percent)=0
 You may also set a step size and increment it using the Step method. More...
 
virtual void Step ()=0
 Increments the progress dialog by the step size set using SetStepSize.
 
virtual void SetProgressMessage (const std::string &utf8_message)=0
 Supplies a UTF-8 message which will be presented on the progress dialog. More...
 

Detailed Description

Interface to provide import/export progress feedback and cancellation.

All well behaved SketchUp importer/exporter plugins should support progress feedback and cancellation through this interface. SketchUp will pop up a progress/cancel dialog prior to calling the appropriate Convert method on the importer/exporter plugin and supply a concrete implementation of this interface. The plugin should supply feedback to the user by estimating how far along the conversion is (via SetPercentDone or SetStepSize and Step), provide some textual progress (via SetProgressMessage) and test for cancellation by calling HasBeenCancelled.

For example, the main loop of an importer plugin may look like this:

progress_callback->SetProgressMessage("Importing 50 things!");
progress_callback->SetStepSize(1.0);
for (int steps = 0; steps < 50; ++steps) {
progress_callback->Step();
// Do something which builds an skp model
if (progress_callback->HasBeenCancelled()) {
// Clean up and return
return false;
}
}
progress_callback->SetProgressMessage("We're half way there!");
// Do some more larger steps
progress_callback->SetPercentDone(75.0);
progress_callback->SetProgressMessage("Finishing up!");
// And some more
progress_callback->SetPercentDone(100.0);
// Success!
return true;

Member Function Documentation

virtual bool SketchUpPluginProgressCallback::HasBeenCancelled ( )
pure virtual

Call this to test if the user has pressed the cancel button. Your code should clean up and return promptly after detecting this.

Returns
Returns true if the user has pressed cancel.
virtual void SketchUpPluginProgressCallback::SetPercentDone ( double  percent)
pure virtual

Call this to set the percent complete on the dialog.

Parameters
[in]percentThe percent done from 0 to 100.
virtual void SketchUpPluginProgressCallback::SetProgressMessage ( const std::string &  utf8_message)
pure virtual

Supplies a UTF-8 message which will be presented on the progress dialog.

Parameters
utf8_messageThe message.
virtual void SketchUpPluginProgressCallback::SetStepSize ( double  percent)
pure virtual

You may also set a step size and increment it using the Step method.

Parameters
[in]percentThe percent to increment with each call to Step.

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