dtwm: basic multihead(xinerama only) support
[oweals/cde.git] / cde / programs / dticon / queryDialog.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: queryDialog.c /main/4 1995/11/02 14:06:32 rswiston $ */
24 /*********************************************************************
25 *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26 *  (c) Copyright 1993, 1994 International Business Machines Corp.
27 *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
28 *  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
29 *      Novell, Inc.
30 **********************************************************************/
31 /*******************************************************************************
32         queryDialog.c
33
34 *******************************************************************************/
35
36 #include <stdio.h>
37 #include <Xm/Xm.h>
38 #include <Xm/DialogS.h>
39 #include <Xm/MenuShell.h>
40 #include <Xm/MwmUtil.h>
41 #include <Xm/MessageB.h>
42 #include "main.h"
43 #include "externals.h"
44
45 #define    RES_CONVERT( res_name, res_value) \
46     XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
47
48 /*******************************************************************************
49         Includes, Defines, and Global variables from the Declarations Editor:
50 *******************************************************************************/
51
52 Widget  queryDialog;
53
54 /*******************************************************************************
55         Forward declarations of functions that are defined later in this file.
56 *******************************************************************************/
57
58 Widget  create_queryDialog();
59
60 /*******************************************************************************
61         The following are callback functions.
62 *******************************************************************************/
63
64 static void
65 okCallback_queryDialog(
66         Widget w,
67         XtPointer clientData,
68         XtPointer callbackArg )
69 {
70         Process_Query_OK();
71 }
72
73 static void
74 cancelCB_queryDialog(
75         Widget w,
76         XtPointer clientData,
77         XtPointer callbackArg )
78 {
79         Process_Query_Cancel();
80 }
81
82 /*******************************************************************************
83         The 'build_' function creates all the widgets
84         using the resource values specified in the Property Editor.
85 *******************************************************************************/
86
87 static Widget
88 build_queryDialog( void )
89 {
90     Widget      queryDialog_shell;
91     XmString tmpXmStr, tmpXmStr2, tmpXmStr3, tmpXmStr4, tmpXmStr5;
92     Arg  args[10];
93     int  n;
94
95
96     queryDialog_shell = XtVaCreatePopupShell( "queryDialog_shell",
97                         xmDialogShellWidgetClass, mainWindow,
98                         XmNtitle, GETSTR(6,2, "Icon Editor - Warning"),
99                         NULL );
100
101     tmpXmStr = GETXMSTR(6,2, "Icon Editor - Warning");
102     tmpXmStr2= GETXMSTR(6,6, "OK");
103     tmpXmStr3= GETXMSTR(6,8, "Do ya really wanna?");
104     tmpXmStr4= GETXMSTR(6,10, "Cancel");
105     tmpXmStr5= GETXMSTR(4,10, "Help");
106     queryDialog = XtVaCreateWidget( "queryDialog",
107                         xmMessageBoxWidgetClass, queryDialog_shell,
108                         XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON,
109                         XmNdialogTitle, tmpXmStr,
110                         XmNokLabelString, tmpXmStr2,
111                         XmNmessageString, tmpXmStr3,
112                         XmNcancelLabelString, tmpXmStr4,
113                         XmNhelpLabelString, tmpXmStr5,
114                         XmNdialogType, XmDIALOG_WARNING,
115                         NULL );
116     XmStringFree(tmpXmStr);
117     XmStringFree(tmpXmStr2);
118     XmStringFree(tmpXmStr3);
119     XmStringFree(tmpXmStr4);
120     XmStringFree(tmpXmStr5);
121
122     XtAddCallback( queryDialog, XmNokCallback, okCallback_queryDialog, NULL);
123     XtAddCallback( queryDialog, XmNcancelCallback, cancelCB_queryDialog, NULL);
124
125     n = 0;
126     XtSetArg (args[n], XmNuseAsyncGeometry, True);                          n++;
127     XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
128     XtSetValues (queryDialog_shell, args, n);
129
130
131     return ( queryDialog );
132 }
133
134 /*******************************************************************************
135         The following is the 'Interface function' which is the
136         external entry point for creating this interface.
137         This function should be called from your application or from
138         a callback function.
139 *******************************************************************************/
140
141 Widget
142 create_queryDialog( void )
143 {
144         Widget                  rtrn;
145
146         rtrn = build_queryDialog();
147
148         return(rtrn);
149 }
150
151 /*******************************************************************************
152         END OF FILE
153 *******************************************************************************/
154