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: PrintDlgMgr.c /main/7 1996/08/12 18:40:50 cde-hp $ */
25 * DtPrint/PrintDlgMgr.c
28 * (c) Copyright 1996 Digital Equipment Corporation.
29 * (c) Copyright 1996 Hewlett-Packard Company.
30 * (c) Copyright 1996 International Business Machines Corp.
31 * (c) Copyright 1996 Sun Microsystems, Inc.
32 * (c) Copyright 1996 Novell, Inc.
33 * (c) Copyright 1996 FUJITSU LIMITED.
34 * (c) Copyright 1996 Hitachi.
36 #include <Dt/PrintDlgMgrP.h>
37 #include <Dt/PrintMsgsP.h>
41 #define SEND_MAIL_LABEL DTPRINT_GETMESSAGE( \
42 MS_PrintDlgMgrSet, DTPDM_SEND_MAIL_LABEL, _DtPrMsgPrintDlgMgr_0000)
43 #define BANNER_LABEL DTPRINT_GETMESSAGE( \
44 MS_PrintDlgMgrSet, DTPDM_BANNER_LABEL, _DtPrMsgPrintDlgMgr_0001)
45 #define SPOOL_OPTS_LABEL DTPRINT_GETMESSAGE( \
46 MS_PrintDlgMgrSet, DTPDM_SPOOL_OPTS_LABEL, _DtPrMsgPrintDlgMgr_0002)
48 Widget _DtCreatePDMJobSetup(Widget parent)
51 Widget send_mail, banner_label, banner, spool_opts_label, spool_opts;
53 Dimension banner_label_width, banner_label_height;
54 Dimension banner_height;
55 Dimension spool_opts_label_width, spool_opts_label_height;
56 Dimension spool_opts_height;
57 Position offset; /* vertical offset between text fields and their labels */
58 Dimension vspace = 10; /* space between the "rows" */
60 * create the manager for the Job Setup Box
63 XtVaCreateManagedWidget("JobSetup", xmFormWidgetClass, parent,
64 XmNallowOverlap, False,
69 label = XmStringCreateLocalized(SEND_MAIL_LABEL);
71 XmVaCreateSimpleCheckBox(manager, "SendMail", NULL,
72 XmVaCHECKBUTTON, label, NULL, NULL, NULL,
75 XtManageChild(send_mail);
79 label = XmStringCreateLocalized(BANNER_LABEL);
81 XtVaCreateManagedWidget("BannerLabel",
84 XmNlabelString, label,
85 XmNalignment, XmALIGNMENT_END,
89 XtVaCreateManagedWidget("Banner",
90 xmTextFieldWidgetClass,
94 * spooler command options
96 label = XmStringCreateLocalized(SPOOL_OPTS_LABEL);
98 XtVaCreateManagedWidget("OptionsLabel",
101 XmNlabelString, label,
102 XmNalignment, XmALIGNMENT_END,
106 XtVaCreateManagedWidget("Options",
107 xmTextFieldWidgetClass,
111 * retrieve various dimensions of form children
113 XtVaGetValues(banner_label,
114 XmNwidth, &banner_label_width,
115 XmNheight, &banner_label_height,
117 XtVaGetValues(banner,
118 XmNheight, &banner_height,
120 XtVaGetValues(spool_opts_label,
121 XmNwidth, &spool_opts_label_width,
122 XmNheight, &spool_opts_label_height,
124 XtVaGetValues(spool_opts,
125 XmNheight, &spool_opts_height,
128 * set the width of the shorter text field to match the longest
130 if(banner_label_width < spool_opts_label_width)
131 XtVaSetValues(banner_label,
132 XmNwidth, spool_opts_label_width,
133 XmNrecomputeSize, False,
136 XtVaSetValues(spool_opts_label,
137 XmNwidth, banner_label_width,
138 XmNrecomputeSize, False,
141 * layout the form children
143 XtVaSetValues(send_mail,
144 XmNleftAttachment, XmATTACH_FORM,
145 XmNtopAttachment, XmATTACH_FORM,
147 offset = ((Position)banner_height - (Position)banner_label_height) / 2;
148 XtVaSetValues(banner_label,
149 XmNleftAttachment, XmATTACH_FORM,
150 XmNtopAttachment, XmATTACH_WIDGET,
151 XmNtopWidget, send_mail,
152 XmNtopOffset, vspace + (offset > 0 ? offset : 0),
154 XtVaSetValues(banner,
155 XmNleftAttachment, XmATTACH_WIDGET,
156 XmNleftWidget, banner_label,
157 XmNrightAttachment, XmATTACH_FORM,
158 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
159 XmNtopWidget, banner_label,
160 XmNtopOffset, -offset,
163 ((Position)spool_opts_height - (Position)spool_opts_label_height) / 2;
164 XtVaSetValues(spool_opts_label,
165 XmNleftAttachment, XmATTACH_FORM,
166 XmNtopAttachment, XmATTACH_WIDGET,
167 XmNtopWidget, banner_label,
168 XmNtopOffset, vspace + (offset > 0 ? offset : 0),
170 XtVaSetValues(spool_opts,
171 XmNleftAttachment, XmATTACH_WIDGET,
172 XmNleftWidget, spool_opts_label,
173 XmNrightAttachment, XmATTACH_FORM,
174 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
175 XmNtopWidget, spool_opts_label,
176 XmNtopOffset, -offset,
179 * return the new Job Setup Box