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