4 * $XConsortium: RoamInterruptibleCmd.hh /main/3 1995/11/06 16:12:42 rswiston $
6 * RESTRICTED CONFIDENTIAL INFORMATION:
8 * The information in this document is subject to special
9 * restrictions in a confidential disclosure agreement between
10 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
11 * document outside HP, IBM, Sun, USL, SCO, or Univel without
12 * Sun's specific written approval. This document and all copies
13 * and derivative works thereof must be returned or destroyed at
16 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
22 //////////////////////////////////////////////////////////////
23 // RoamInterruptibleCmd.h: Abstract class that supports lengthy,
24 // user-interruptible activities
25 //////////////////////////////////////////////////////////////
26 #ifndef ROAMINTERRUPTIBLECMD_H
27 #define ROAMINTERRUPTIBLECMD_H
30 #include "NoUndoCmd.h"
32 // Influenced by the InterruptibleCmd class from MotifApp.
33 // Different because it does not call the derived class's
34 // doit() repeatedly. Instead, it repeatedly calls check_if_done().
36 // Define a type for the callback invoked when the task is finished
38 class RoamInterruptibleCmd;
40 typedef void (*RoamTaskDoneCallback) (
41 RoamInterruptibleCmd *,
45 class RoamInterruptibleCmd : public NoUndoCmd {
49 XtWorkProcId _wpId; // The ID of the workproc
50 RoamTaskDoneCallback _callback; // Application-defined callback
55 Boolean _done; // TRUE if the task has been completed
56 Boolean _interrupted; // TRUE if the task was interrupted
58 virtual void cleanup(); // Called when task ends
59 virtual void updateMessage ( char * );
61 virtual void post_dialog() = 0;
62 virtual void unpost_dialog() = 0;
63 virtual void check_if_done() = 0;
66 static Boolean workProcCallback ( XtPointer );
67 static void interruptCallback ( void * );
71 // Derived classes implement doit(), declared by Cmd
75 RoamInterruptibleCmd ( char * , char *, int );
76 virtual ~RoamInterruptibleCmd();
78 virtual void execute(); // Overrides base class member function
79 virtual void execute ( RoamTaskDoneCallback, void * );
81 // Enable others to check if the command was interrupted...
82 virtual Boolean interrupted();
84 // Force update (and flushing of events in queue).
85 virtual void update();