Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmail / DtMailWDM.C
1 /* $XConsortium: DtMailWDM.C /main/3 1996/04/21 19:41:45 drk $ */
2 /*
3  *+SNOTICE
4  *
5  *      RESTRICTED CONFIDENTIAL INFORMATION:
6  *      
7  *      The information in this document is subject to special
8  *      restrictions in a confidential disclosure agreement bertween
9  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
10  *      document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
11  *      Sun's specific written approval.  This documment and all copies
12  *      and derivative works thereof must be returned or destroyed at
13  *      Sun's request.
14  *
15  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
16  *
17  *+ENOTICE
18  */
19
20 ///////////////////////////////////////////////////////////
21 // DtMailWDM.C
22 //////////////////////////////////////////////////////////
23 #include "DtMailWDM.hh"
24 #include "Application.h"
25 #include <Xm/Xm.h>
26 #include <Xm/MessageB.h>
27 #include "BusyPixmap.h"
28 #include <assert.h>
29
30 DtMailWDM *theDtMailWDM =
31         new DtMailWDM ( "DtMailWDM" );
32
33 DtMailWDM::DtMailWDM ( char   *name ) 
34          : WorkingDialogManager ( name )
35 {
36     _text = NULL;
37 }
38
39
40 Widget 
41 DtMailWDM::post (char *title,
42                  char          *text, 
43                  void          *clientData,
44                  DialogCallback ok,
45                  DialogCallback cancel,
46                  DialogCallback help )
47 {
48     // The the dialog already exists, and is currently in use,
49     // just return this dialog. The DtMailWDM
50     // only supports one dialog.
51     
52     if ( _w && XtIsManaged ( _w ) )
53         return _w;
54     
55     // Pass the message on to the base class
56     
57     DialogManager::post (title, text, clientData, ok, cancel, help );
58     
59     forceUpdate( _w );
60     return _w;
61 }
62
63 Widget 
64 DtMailWDM::post (char *title,
65                  char          *text, 
66                  Widget wid,
67                  void          *clientData,
68                  DialogCallback ok,
69                  DialogCallback cancel,
70                  DialogCallback help )
71 {
72     // The the dialog already exists, and is currently in use,
73     // just return this dialog. The DtMailWDM
74     // only supports one dialog.
75     
76     if ( _w && XtIsManaged ( _w ) )
77         return _w;
78     
79     // Pass the message on to the base class
80     
81     DialogManager::post (title, text, wid, clientData, ok, cancel, help );
82     
83     forceUpdate( _w );
84     return _w;
85 }
86
87
88 void
89 DtMailWDM::updateAnimation()
90 {
91     if (_w) {
92         XtVaSetValues ( _w, 
93 //          XmNsymbolPixmap, _busyPixmaps->next(),
94             NULL );
95         forceUpdate( _w );
96     }
97 }
98     
99 void
100 DtMailWDM::updateDialog( 
101     char *text
102 )
103 {
104     
105     if ( _w )
106     {
107     
108         // Just change the string displayed in the dialog
109     
110         XmString xmstr = XmStringCreateLocalized ( text ); 
111
112         // Update the pixmap too...
113         XtVaSetValues ( _w, 
114 //                  XmNsymbolPixmap, _busyPixmaps->next(),
115                     XmNmessageString, xmstr, 
116                     NULL );
117         XmStringFree ( xmstr );
118
119     }
120
121     forceUpdate( _w );
122 }