-fpermissive to allow GCC to compile old C++
[oweals/cde.git] / cde / programs / dtmail / dtmail / Dialog.C
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 librararies 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: Dialog.C /main/4 1996/04/21 19:41:15 drk $
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 #include "Dialog.h"
44 #include "Application.h"
45 #include "RoamMenuWindow.h"
46 #include <Xm/DialogS.h>
47 #include <assert.h>
48 #include "Help.hh"
49
50 // The following header is private to CDE and should NOT be required
51 // but unfortunately is.
52 //
53 extern "C" {
54 #include <Dt/HourGlass.h>
55 }
56
57
58 Dialog::Dialog(char *name, RoamMenuWindow *parent) : UIComponent(name)
59 {
60   _parent = parent;
61   _workArea = NULL;
62     
63   _w = XtCreatePopupShell(_name,
64                           xmDialogShellWidgetClass,
65                           parent->baseWidget(),
66                           NULL, 0 );
67
68   XtVaSetValues(_w, XmNdefaultPosition, False, NULL);
69
70   assert( theApplication != NULL );
71 }
72
73 Dialog::Dialog(RoamMenuWindow *parent) : UIComponent("")
74 {
75   _parent = parent;
76   _workArea=NULL;
77 }
78
79 Dialog::~Dialog()
80 {
81 }
82
83 void
84 Dialog::initialize()
85 {
86     
87     
88
89     XtVaSetValues( _w,
90                    XmNdefaultPosition, False, NULL );
91     
92     XtAddCallback( _w,
93                    XmNpopupCallback,
94                    ( XtCallbackProc ) &Dialog::popupCallback,
95                    XtPointer( this ) );
96     
97     XtAddCallback( _w,
98                    XmNpopdownCallback,
99                    ( XtCallbackProc ) &Dialog::popdownCallback,
100                    XtPointer( this ) );
101     
102     _workArea = createWorkArea ( _w );  
103     assert ( _workArea != NULL );
104     printHelpId("_workArea", _workArea);
105     /* add help callback */
106     // XtAddCallback(_workArea, XmNhelpCallback, HelpCB, helpId);
107
108     if ( !XtIsManaged ( _workArea ) )
109         XtManageChild ( _workArea ); 
110 }
111
112
113 void
114 Dialog::title(
115     char *text
116 )
117 {
118     XtVaSetValues ( _w, XmNtitle, text, NULL );
119 }
120
121
122 void
123 Dialog::popupCallback( Widget ,
124                        XtPointer clientData,
125                        XmAnyCallbackStruct *
126 )
127 {
128     Dialog *window=( Dialog * ) clientData;
129     
130     window->popped_up();
131     
132 }
133
134
135 void
136 Dialog::popdownCallback( Widget ,               // w
137                          XtPointer clientData,
138                          XmAnyCallbackStruct *
139 )
140 {
141     Dialog *window=( Dialog * ) clientData;
142     
143     window->popped_down();
144     
145 }
146
147 void
148 Dialog::manage()
149 {
150     if ( !XtIsManaged ( _workArea ) )
151         XtManageChild ( _workArea ); 
152     UIComponent::manage();
153 }
154
155 void
156 Dialog::busyCursor()
157 {
158     // Do nothing if the widget has not been realized.
159
160     if (XtIsRealized(_w)) {
161         _DtTurnOnHourGlass(_w);
162     }
163 }
164
165 void
166 Dialog::normalCursor()
167 {
168     // Do nothing if the widget has not been realized
169
170     if (XtIsRealized(_w)) {
171         _DtTurnOffHourGlass(_w);
172     }
173 }