Use C++ linker
[oweals/cde.git] / cde / programs / dtcreate / Confirmed.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 /* $XConsortium: Confirmed.c /main/5 1996/10/15 14:44:45 rswiston $ */
24 /*******************************************************************************
25         Confirmed.c
26
27        Associated Header file: Confirmed.h
28 *******************************************************************************/
29
30 #include <stdio.h>
31
32 #include <Xm/Xm.h>
33 #include <Xm/MessageB.h>
34 #include <sys/signal.h>
35
36 #include "dtcreate.h"
37 #include "UxXt.h"
38 #include "CreateActionAppShell.h"
39
40 #define CONTEXT_MACRO_ACCESS 1
41 #include "Confirmed.h"
42 #undef CONTEXT_MACRO_ACCESS
43
44 /*******************************************************************************
45        The following are callback functions for Confirmed dialog.
46 *******************************************************************************/
47
48 /******************************************************************************/
49 /* activateCB_Confirmed_OkButton                                              */
50 /******************************************************************************/
51 void    activateCB_Confirmed_OkButton( Widget  UxWidget,
52                                         XtPointer UxClientData,
53                                         XtPointer UxCallbackArg)
54
55 {
56   XtDestroyWidget(XtParent(UxWidget));
57 }
58 /******************************************************************************/
59 /* display_confirmed_message                                                  */
60 /*                                                                            */
61 /* INPUT:  Widget parent - parent to position dialog on.                      */
62 /*         char *message - message to display in dialog box                   */
63 /* OUTPIT: none                                                               */
64 /*                                                                            */
65 /******************************************************************************/
66 void display_confirmed_message (Widget parent, char *message)
67 {
68
69   Confirmed = XmCreateInformationDialog(parent, "confirmedDialog", NULL, 0);
70   XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_CANCEL_BUTTON));
71   XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_HELP_BUTTON));
72
73   XtAddCallback( Confirmed, XmNokCallback,
74           (XtCallbackProc) activateCB_Confirmed_OkButton,
75           (XtPointer) NULL );
76
77   XtVaSetValues (Confirmed,
78                  RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 41, "Create Action - Confirmation")),
79                  RES_CONVERT(XmNmessageString, message),
80                  NULL);
81   XtRealizeWidget(Confirmed);
82
83   XtManageChild (Confirmed);
84   return;
85 }
86 /*******************************************************************************
87        The following are callback functions for Question dialog
88 *******************************************************************************/
89
90 /******************************************************************************/
91 /*                                                                            */
92 /* cancelCB_QuestionDialog                                                    */
93 /*                                                                            */
94 /******************************************************************************/
95 void    cancelCB_QuestionDialog(Widget UxWidget,
96                                    XtPointer UxClientData,
97                                    XtPointer UxCallbackArg)
98 {
99   XtDestroyWidget(XtParent(UxWidget));
100 }
101
102 /******************************************************************************/
103 /*                                                                            */
104 /* nosaveCB_QuestionDialog                                                    */
105 /*                                                                            */
106 /******************************************************************************/
107 void    nosaveCB_QuestionDialog(Widget UxWidget,
108                                    XtPointer UxClientData,
109                                    XtPointer UxCallbackArg)
110 {
111   XtDestroyWidget(XtParent(UxWidget));
112   FreeResources();
113   exit(0);
114 }
115
116 /******************************************************************************/
117 /*                                                                            */
118 /* saveCallbackB_QuestionDialog                                               */
119 /*                                                                            */
120 /******************************************************************************/
121 void    saveCB_QuestionDialog(Widget UxWidget,
122                                      XtPointer  UxClientData,
123                                      XtPointer UxCallbackArg)
124
125 {
126   XtDestroyWidget(XtParent(UxWidget));
127
128   /********************************************************************/
129   /* Activate the save routine.                                       */
130   /********************************************************************/
131   activateCB_CA_MB_FileSave((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
132
133 }
134
135 /******************************************************************************/
136 /* display_question_message                                                   */
137 /*                                                                            */
138 /* INPUT:  Widget parent - parent to position dialog on.                      */
139 /*         char *message - message to display in dialog box                   */
140 /* OUTPIT: none                                                               */
141 /*                                                                            */
142 /******************************************************************************/
143 void display_question_message (Widget parent, char *message,
144                                char *button1, XtCallbackProc cb_button1,
145                                char *button2, XtCallbackProc cb_button2,
146                                char *button3, XtCallbackProc cb_button3)
147 {
148   Widget tmpw;
149
150   QuestionDialog = XmCreateQuestionDialog(parent, "questionDialog", NULL, 0);
151
152   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_OK_BUTTON);
153   if (button1) {
154      XtVaSetValues(tmpw,
155                    RES_CONVERT( XmNlabelString, button1),
156                    NULL);
157      XtAddCallback( QuestionDialog, XmNokCallback,
158              (XtCallbackProc) cb_button1,
159              (XtPointer) NULL );
160   } else {
161      XtUnmanageChild (tmpw);
162   }
163
164   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_CANCEL_BUTTON);
165   if (button2) {
166      XtVaSetValues(tmpw,
167                    RES_CONVERT( XmNlabelString, button2),
168                    NULL);
169      XtAddCallback( QuestionDialog, XmNcancelCallback,
170              (XtCallbackProc) cb_button2,
171              (XtPointer) NULL );
172   } else {
173      XtUnmanageChild (tmpw);
174   }
175
176   tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_HELP_BUTTON);
177   if (button3) {
178      XtVaSetValues(tmpw,
179                    RES_CONVERT( XmNlabelString, button3),
180                    NULL);
181      XtAddCallback( QuestionDialog, XmNhelpCallback,
182              (XtCallbackProc) cb_button3,
183              (XtPointer) NULL );
184   } else {
185      XtUnmanageChild (tmpw);
186   }
187
188   XtVaSetValues (QuestionDialog,
189                  RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 51, "Create Action - Question")),
190                  RES_CONVERT(XmNmessageString, message),
191                  NULL);
192
193   XtManageChild (QuestionDialog);
194   return;
195 }
196 /*******************************************************************************
197        END OF FILE
198 *******************************************************************************/
199