VkInterruptDialog(3x) VkInterruptDialog(3x)
VkInterruptDialog - A dialog manager that support interrupts
VkBusyDialog : VkDialogManager : VkComponent : VkCallbackObject
#include <Vk/VkInterruptDialog.h>
PUBLIC PROTOCOL SUMMARY
Constructor/Destructor
VkInterruptDialog(const char* name);
virtual void ~VkInterruptDialog(void);
Checking for Interrupts
Boolean wasInterupted(void);
This class supports applications that need to perform a lengthy task
and allow the task to be interrupted. To use the dialog,
applications must use the VkApp::setBusyDialog() method to install
an instance of VkInterruptDialog as the application's current busy
dialog, and then call VkApp::busy() Applications must periodically
check to see if the application has been interrupted. The period of
time between checks is up to the application, which must weigh
responsiveness against time spent checking.
Note that checking for interrupts involves entering a secondary
event loop for a short time, so the application must beware of reentrancy
problems in any callbacks that could be invoked.
FUNCTION DESCRIPTIONS [Toc] [Back] VkInterruptDialog()
VkInterruptDialog(const char* name);
Initialize a VkInterruptDialog object. Normally, applications can
use the globally instantiated theInterruptDialog.
~VkInterruptDialog()
virtual void ~VkInterruptDialog(void);
Free the memory associated with a VkInterruptDialog object.
wasInterupted()
Page 1
VkInterruptDialog(3x) VkInterruptDialog(3x)
Boolean wasInterupted(void);
Check to see if the user has pushed the dialog's "cancel" button
since the last time this function was called.
DATA MEMBER DESCRIPTIONS [Toc] [Back] const char* const interruptedCallback;
static const char *const interruptedCallback;
This callback list allows objects to register a member function to
be called when the user selects the "Cancel" button of a
VkInterruptDialog dialog. This callback can only be called if the
application calls wasInterrupted(). Normally, the application will
test the return value of this function, but the callback may be
useful in other situations.
The following code segment installs the interrupt dialog, and
performs a simulated lengthy task, checking for interrupts
periodically.
int i, j, k = 0;
// Install the interruptible dialog as the
// dialog to post when busy
theApplication->setBusyDialog(theInterruptDialog);
// Start being "busy"
theApplication->busy("Very Busy",
(BusyWindow *) clientData);
k = 0;
for(i=0; i<10000; i++)
{
// Every so often, see if the task
// was interrupted
if(theInterruptDialog->wasInterupted())
{
break; // kick out of current
// task if user interrupts
}
sleep(1);
}
Page 2
VkInterruptDialog(3x) VkInterruptDialog(3x)
// Task done, so we're not busy anymore
theApplication->notBusy();
// Restore the application's busy dialog
// as the default
theApplication->setBusyDialog(NULL);
INHERITED MEMBER FUNCTIONS [Toc] [Back] Inherited from VkDialogManager
show(), hide(), className(), clearCache(), prepost(), ok(),
cancel(), apply(), setTitle(), setButtonLabels(), unpost(),
unpostAll(), centerOnScreen(), lastPosted(), post(), postModal(),
postBlocked(), postAndWait(), post(), _action, _showOK, _showCancel,
_showApply, _allowMultipleDialogs, _minimizeMultipleDialogs,
prepostCallback
Inherited from VkComponent [Toc] [Back]
installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
setDefaultResources(), getResources(), manage(), unmanage(),
baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback
Inherited from VkCallbackObject [Toc] [Back]
callCallbacks(), addCallback(), removeCallback(),
removeAllCallbacks()
VIEWKIT 2.1 CHANGES
In multi-screen enabled applications or components, references to
theInterruptDialog will only be valid for the default screen in the
application. The following new function API will return the
VkInterruptDialog associated with the appropriate screen and should be
used instead of theInterruptDialog;
VkInterruptDialog *getAppInterruptDialog(VkComponent *comp);
CLASSES USED BY THIS CLASS
VkApp
VkBusyDialog, VkDialogManager, VkComponent, VkApp
ViewKit Programmer's Guide
The X Window System, DEC Press, Bob Sheifler and Jim Gettys
The X Window System Toolkit, DEC Press, Paul Asente and Ralph Swick
The OSF/Motif Programmers Reference, Prentice Hall, OSF
Page 3
VkInterruptDialog(3x) VkInterruptDialog(3x)
PPPPaaaaggggeeee 4444 [ Back ]
|