2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: newIconDialog.c /main/4 1995/11/02 14:06:08 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
30 **********************************************************************/
31 /*******************************************************************************
34 *******************************************************************************/
38 #include <Xm/DialogS.h>
39 #include <Xm/MenuShell.h>
40 #include <Xm/MwmUtil.h>
43 #include <Xm/LabelG.h>
44 #include <Xm/SeparatoG.h>
45 #include <Xm/PushBG.h>
48 #include <Dt/DialogBox.h>
51 #include "externals.h"
53 /*******************************************************************************
54 Includes, Defines, and Global variables from the Declarations Editor:
55 *******************************************************************************/
57 static Widget newSeparator;
58 static Widget newWidthLabel;
59 static Widget newHeightLabel;
65 extern Widget editMenu_deleteHS_pb;
66 /*******************************************************************************
67 Forward declarations of functions that are defined later in this file.
68 *******************************************************************************/
70 Widget create_newIconDialog();
72 /*******************************************************************************
73 The following are callback functions.
74 *******************************************************************************/
76 /************************************************************************
79 ************************************************************************/
83 XtPointer client_data,
86 DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *)call_data;
88 switch (cb->button_position)
90 case 1: /* OK button */
94 case 2: /* CANCEL button */
95 Process_Size_Cancel();
98 case 3: /* HELP button */
99 XtCallCallbacks(w, XmNhelpCallback, NULL);
108 /*******************************************************************************
109 The 'build_' function creates all the widgets
110 using the resource values specified in the Property Editor.
111 *******************************************************************************/
114 build_newIconDialog( void )
116 XmString tmpXmStrings[3];
122 /* create the dialog box with shell */
124 tmpXmStrings[0] = GETXMSTR(4,6, "OK");
125 tmpXmStrings[1] = GETXMSTR(4,8, "Cancel");
126 tmpXmStrings[2] = GETXMSTR(4,10, "Help");
129 XtSetArg (args[n], XmNbuttonCount, 3); n++;
130 XtSetArg (args[n], XmNbuttonLabelStrings, tmpXmStrings); n++;
131 newIconDialog = __DtCreateDialogBoxDialog (mainWindow, "newIconDialog",
134 /* free compound strings now */
135 XmStringFree (tmpXmStrings[0]);
136 XmStringFree (tmpXmStrings[1]);
137 XmStringFree (tmpXmStrings[2]);
139 XtAddCallback(newIconDialog, XmNcallback, ButtonCB, NULL);
142 workForm = _DtDialogBoxGetButton(newIconDialog, 2);
143 XtSetArg(args[n], XmNcancelButton, workForm); n++;
144 XtSetValues (newIconDialog, args, n);
147 XtSetArg (args[n], XmNtitle, GETSTR(4,4, "Icon Editor - Resize")); n++;
148 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
149 XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
150 XtSetValues (XtParent(newIconDialog), args, n);
153 /* create form with width/height to go in dialog box as work area */
155 workForm = XtVaCreateManagedWidget( "newIconForm",
156 xmFormWidgetClass, newIconDialog,
157 XmNchildType, XmWORK_AREA,
158 XmNallowOverlap, False,
161 newWidthText = XtVaCreateManagedWidget( "newWidthText",
162 xmTextFieldWidgetClass, workForm,
164 XmNtopAttachment, XmATTACH_FORM,
166 XmNrightAttachment, XmATTACH_FORM,
169 tmpXmStrings[0] = GETXMSTR(4,12, "New Width:");
170 newWidthLabel = XtVaCreateManagedWidget( "newWidthLabel",
171 xmLabelGadgetClass, workForm,
172 XmNalignment, XmALIGNMENT_END,
173 XmNlabelString, tmpXmStrings[0],
175 XmNtopAttachment, XmATTACH_FORM,
176 XmNrightWidget, newWidthText,
177 XmNrightAttachment, XmATTACH_WIDGET,
179 XmNleftAttachment, XmATTACH_FORM,
181 XmStringFree(tmpXmStrings[0]);
183 newHeightText = XtVaCreateManagedWidget( "newHeightText",
184 xmTextFieldWidgetClass, workForm,
185 XmNtopWidget, newWidthText,
186 XmNtopAttachment, XmATTACH_WIDGET,
188 XmNrightAttachment, XmATTACH_FORM,
190 XmNbottomAttachment, XmATTACH_FORM,
193 tmpXmStrings[0] = GETXMSTR(4,14, "New Height:");
194 newHeightLabel = XtVaCreateManagedWidget( "newHeightLabel",
195 xmLabelGadgetClass, workForm,
196 XmNalignment, XmALIGNMENT_END,
197 XmNlabelString, tmpXmStrings[0],
198 XmNtopWidget, newWidthLabel,
199 XmNtopAttachment, XmATTACH_WIDGET,
200 XmNrightWidget, newHeightText,
201 XmNrightAttachment, XmATTACH_WIDGET,
203 XmNbottomAttachment, XmATTACH_FORM,
205 XmNleftAttachment, XmATTACH_FORM,
207 XmStringFree(tmpXmStrings[0]);
209 return ( newIconDialog );
212 /*******************************************************************************
213 The following is the 'Interface function' which is the
214 external entry point for creating this interface.
215 This function should be called from your application or from
217 *******************************************************************************/
220 create_newIconDialog( void )
224 rtrn = build_newIconDialog();
230 /*******************************************************************************
232 *******************************************************************************/