2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * $XConsortium: RoamInterruptibleCmd.hh /main/3 1995/11/06 16:12:42 rswiston $
28 * RESTRICTED CONFIDENTIAL INFORMATION:
30 * The information in this document is subject to special
31 * restrictions in a confidential disclosure agreement between
32 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
33 * document outside HP, IBM, Sun, USL, SCO, or Univel without
34 * Sun's specific written approval. This document and all copies
35 * and derivative works thereof must be returned or destroyed at
38 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
44 //////////////////////////////////////////////////////////////
45 // RoamInterruptibleCmd.h: Abstract class that supports lengthy,
46 // user-interruptible activities
47 //////////////////////////////////////////////////////////////
48 #ifndef ROAMINTERRUPTIBLECMD_H
49 #define ROAMINTERRUPTIBLECMD_H
52 #include "NoUndoCmd.h"
54 // Influenced by the InterruptibleCmd class from MotifApp.
55 // Different because it does not call the derived class's
56 // doit() repeatedly. Instead, it repeatedly calls check_if_done().
58 // Define a type for the callback invoked when the task is finished
60 class RoamInterruptibleCmd;
62 typedef void (*RoamTaskDoneCallback) (
63 RoamInterruptibleCmd *,
67 class RoamInterruptibleCmd : public NoUndoCmd {
71 XtWorkProcId _wpId; // The ID of the workproc
72 RoamTaskDoneCallback _callback; // Application-defined callback
77 Boolean _done; // TRUE if the task has been completed
78 Boolean _interrupted; // TRUE if the task was interrupted
80 virtual void cleanup(); // Called when task ends
81 virtual void updateMessage ( char * );
83 virtual void post_dialog() = 0;
84 virtual void unpost_dialog() = 0;
85 virtual void check_if_done() = 0;
88 static Boolean workProcCallback ( XtPointer );
89 static void interruptCallback ( void * );
93 // Derived classes implement doit(), declared by Cmd
97 RoamInterruptibleCmd ( char * , char *, int );
98 virtual ~RoamInterruptibleCmd();
100 virtual void execute(); // Overrides base class member function
101 virtual void execute ( RoamTaskDoneCallback, void * );
103 // Enable others to check if the command was interrupted...
104 virtual Boolean interrupted();
106 // Force update (and flushing of events in queue).
107 virtual void update();