Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / programs / dtmail / dtmail / RoamInterruptibleCmd.hh
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /*
24  *+SNOTICE
25  *
26  *      $XConsortium: RoamInterruptibleCmd.hh /main/3 1995/11/06 16:12:42 rswiston $
27  *
28  *      RESTRICTED CONFIDENTIAL INFORMATION:
29  *      
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
36  *      Sun's request.
37  *
38  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
39  *
40  *+ENOTICE
41  */
42
43
44 //////////////////////////////////////////////////////////////
45 // RoamInterruptibleCmd.h: Abstract class that supports lengthy,
46 //                     user-interruptible activities
47 //////////////////////////////////////////////////////////////
48 #ifndef ROAMINTERRUPTIBLECMD_H
49 #define ROAMINTERRUPTIBLECMD_H
50
51 #include <Xm/Xm.h>
52 #include "NoUndoCmd.h"
53
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().
57
58 // Define a type for the callback invoked when the task is finished
59
60 class RoamInterruptibleCmd;
61
62 typedef void (*RoamTaskDoneCallback) (
63                 RoamInterruptibleCmd *, 
64                 Boolean, 
65                 void * );
66
67 class RoamInterruptibleCmd : public NoUndoCmd {
68     
69   private:
70     
71     XtWorkProcId     _wpId;         // The ID of the workproc
72     RoamTaskDoneCallback _callback;     // Application-defined callback
73     void            *_clientData;
74     
75   protected:
76     
77     Boolean      _done;         // TRUE if the task has been completed
78     Boolean _interrupted;       // TRUE if the task was interrupted
79
80     virtual void cleanup();     // Called when task ends
81     virtual void updateMessage ( char * );
82
83     virtual void post_dialog() = 0;
84     virtual void unpost_dialog() = 0;
85     virtual void check_if_done() = 0;
86
87     Boolean workProc ();
88     static Boolean  workProcCallback ( XtPointer );
89     static void     interruptCallback ( void * );
90     void interrupt(); 
91
92     
93     // Derived classes implement doit(), declared by Cmd
94     
95   public:
96     
97     RoamInterruptibleCmd ( char * , char *, int );
98     virtual ~RoamInterruptibleCmd();
99     
100     virtual void execute();  // Overrides base class member function
101     virtual void execute ( RoamTaskDoneCallback, void * );
102
103     // Enable others to check if the command was interrupted...
104     virtual Boolean  interrupted();
105     
106     // Force update (and flushing of events in queue).
107     virtual void update();
108
109 };
110 #endif
111
112
113
114