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 librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* util.c 1.22 - Fujitsu source for CDEnext 96/10/30 13:31:41 */
24 /* $XConsortium: util.c /main/13 1996/11/08 01:56:34 cde-fuj $ */
26 * (c) Copyright 1995 FUJITSU LIMITED
27 * This is source code modified by FUJITSU LIMITED under the Joint
28 * Development Agreement for the CDEnext PST.
29 * This is unpublished proprietary source code of FUJITSU LIMITED
38 #include <Xm/RowColumn.h>
42 #include "ufontrsrc.h"
45 extern Widget toplevel;
46 static void _destroy();
49 extern Resource resource ;
52 #include "pixmaps/Pencil.pm"
53 #include "pixmaps/Line.pm"
54 #include "pixmaps/Rectangle.pm"
55 #include "pixmaps/Circle.pm"
56 #include "pixmaps/Eraser.pm"
57 #include "pixmaps/SelectArea.pm"
60 #define ReadXpm XpmCreatePixmapFromData
62 #define ReadXpm _DtXpmCreatePixmapFromData
66 #include "pixmaps/arrow.pm"
70 CreateCaptionFrame(owner, name, labelstr, type, thickness)
77 Widget top, label, frame;
83 top = XmCreateForm(owner, "form", args, n);
84 if (labelstr && *labelstr){
85 xmstr = XmStringCreateLocalized(labelstr);
87 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
88 XtSetArg(args[n], XmNlabelString, xmstr); n++;
89 label = XmCreateLabelGadget(top, "label", args, n);
94 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
95 XtSetArg(args[n], XmNtopWidget, label); n++;
99 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
101 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
102 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
103 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
104 XtSetArg(args[n], XmNresizable, resource.capt_resize ); n++;
105 XtSetArg(args[n], XmNshadowType, type); n++;
106 XtSetArg(args[n], XmNshadowThickness , thickness); n++;
107 XtSetArg(args[n], XmNleftOffset, resource.capt_lftoff ); n++;
108 XtSetArg(args[n], XmNtopOffset, resource.capt_topoff ); n++;
109 XtSetArg(args[n], XmNrightOffset, resource.capt_rghoff ); n++;
110 frame = XmCreateFrame(top, "frame", args, n);
111 XtManageChild(frame);
123 CreatePixButton(owner, name, data)
137 disp = XtDisplay(owner);
138 root = DefaultRootWindow(disp);
141 XtSetArg(args[n], XmNborderWidth, 1); n++;
142 XtSetArg(args[n], XmNradioAlwaysOne, TRUE); n++;
143 XtSetArg(args[n], XmNradioBehavior, TRUE); n++;
144 top = XmCreateRowColumn(owner, name, args, n);
148 ReadXpm(disp, root, Pencil, &pix[0], &mask, &attr);
149 ReadXpm(disp, root, Line, &pix[1], &mask, &attr);
150 ReadXpm(disp, root, Rectangle, &pix[2], &mask, &attr);
151 ReadXpm(disp, root, Circle, &pix[3], &mask, &attr);
152 ReadXpm(disp, root, Eraser, &pix[4], &mask, &attr);
153 ReadXpm(disp, root, SelectArea, &pix[5], &mask, &attr);
155 for (i=0; i < NUMPIX; i++) {
157 XtSetArg(args[n], XmNlabelType, XmPIXMAP); n++;
158 XtSetArg(args[n], XmNlabelPixmap, pix[i]); n++;
159 XtSetArg(args[n], XmNindicatorOn, False); n++;
160 XtSetArg(args[n], XmNshadowThickness, 2); n++;
161 XtSetArg(args[n], XmNfillOnSelect, False); n++;
162 XtSetArg(args[n], XmNset, data->items[i].set); n++;
163 XtSetArg(args[n], XmNwidth, 36); n++;
164 XtSetArg(args[n], XmNheight, 36); n++;
165 data->items[i].w = XmCreateToggleButton(top, data->items[i].name, args, n);
166 XtManageChild(data->items[i].w);
167 XtAddCallback(data->items[i].w, XmNvalueChangedCallback,
168 data->items[i].cb, data->items[i].clientdata);
177 * returns the value what the text field has
186 GetTextFieldValue(textf)
190 if (textf->w2 == NULL) {
191 XtVaGetValues(textf->w1, XmNvalue, &s1, NULL);
194 if (XtIsSensitive(textf->w2)) {
195 XtVaGetValues(textf->w1, XmNvalue, &s1, NULL);
196 XtVaGetValues(textf->w2, XmNvalue, &s2, NULL);
197 s3 = (char *) XtMalloc(strlen(s1) + strlen(s2) + 2);
205 XtVaGetValues(textf->w1, XmNvalue, &s1, NULL);
213 arrow_change(w, data)
216 if (XtIsSensitive(data->w2)) {
217 XtSetSensitive(data->w2, False);
219 XtSetSensitive(data->w2, True);
223 static Widget focus_widget=NULL;
224 extern char AreaStr[160];
225 extern FalFontData fullFontData;
237 extern void CodeWindow();
238 CodeWindow(focus_widget, fullFontData.xlfdname, False);
243 CreateTextField(owner, name, labelstr, data, maxlength)
250 Widget row, label, arrow, textfield, code;
258 extern Pixmap arrow_pix;
261 XtSetArg(args[n], XmNorientation, (XtArgVal)XmHORIZONTAL); n++;
262 row = XmCreateRowColumn(owner, "row", args, n);
266 xms = XmStringCreateLocalized(labelstr);
267 XtSetArg(args[n], XmNlabelString, xms); n++;
268 label = XmCreateLabelGadget(row, "label", args, n);
269 XtManageChild(label);
273 XtSetArg(args[n], XmNcolumns, maxlength); n++;
274 XtSetArg(args[n], XmNmaxLength, maxlength); n++;
275 data->w1 = focus_widget = textfield =
276 XmCreateText(row, "textField", args, n);
277 XtManageChild(textfield);
278 XtAddCallback(textfield, XmNfocusCallback, (XtCallbackProc)focus, NULL);
281 disp = XtDisplay(row);
282 root = DefaultRootWindow(disp);
284 ReadXpm(disp, root, arrow_pm, &arrow_pix, &mask, &attr);
288 XtSetArg(args[n], XmNlabelPixmap, arrow_pix); n++;
289 XtSetArg(args[n], XmNlabelType, XmPIXMAP); n++;
290 XtSetArg(args[n], XmNindicatorOn, False); n++;
291 XtSetArg(args[n], XmNshadowThickness, 2); n++;
292 XtSetArg(args[n], XmNfillOnSelect, False); n++;
293 XtSetArg(args[n], XmNhighlightThickness, 0); n++;
294 arrow = XmCreateToggleButton(row, "arrow", args, n);
295 XtManageChild(arrow);
296 XtAddCallback(arrow, XmNvalueChangedCallback,
297 (XtCallbackProc)arrow_change, (XtPointer)data);
300 XtSetArg(args[n], XmNcolumns, maxlength ); n++;
301 XtSetArg(args[n], XmNmaxLength, maxlength); n++;
302 data->w2 = textfield = XmCreateText(row, "textField", args, n);
303 XtManageChild(textfield);
304 XtSetSensitive(textfield, False);
305 XtAddCallback(textfield, XmNfocusCallback, (XtCallbackProc)focus, NULL);
308 xms = XmStringCreateLocalized(resource.code) ;
309 XtSetArg(args[n], XmNlabelString, xms); n++;
310 XtSetArg(args[n], XmNhighlightThickness, 0); n++;
311 code = XmCreatePushButton(row, "Code", args, n);
315 XtAddCallback(code, XmNactivateCallback,
316 (XtCallbackProc)code_input, (XtPointer)textfield);
322 CreateMenuButtons( Widget owner, Button *buttons, int buttons_cnt )
324 CreateMenuButtons( owner, buttons, buttons_cnt )
335 #define LABEL(x) (buttons->items[(x)].label)
336 #define NMNIC(x) (buttons->items[(x)].mnemonic)
337 #define SENS(x) (buttons->items[(x)].sensitive)
339 buttons->w = (Widget *) malloc(sizeof(Widget)*buttons_cnt);
342 for (i=0; i<buttons_cnt; i++) {
343 if (LABEL(i) && *((char *) LABEL(i))){
345 if (strchr(LABEL(i), NMNIC(i))){
346 sprintf(buf, "%s", LABEL(i));
348 sprintf(buf, "%s(%c)", LABEL(i), NMNIC(i));
350 xms = XmStringCreateLocalized(buf);
351 XtSetArg(args[n],XmNlabelString, xms); n++;
352 XtSetArg(args[n],XmNmnemonic, NMNIC(i)); n++;
353 XtSetArg(args[n],XmNsensitive, SENS(i)); n++;
355 XmCreatePushButtonGadget(owner, "button", args, n);
356 if (buttons->items[i].cb){
357 XtAddCallback(buttons->w[i], XmNactivateCallback,
358 buttons->items[i].cb, buttons->items[i].clientdata);
363 XtSetArg(args[n], XmNseparatorType, XmSHADOW_ETCHED_IN); n++;
364 XtSetArg(args[n], XmNmargin, resource.menu_margin ); n++;
365 buttons->w[i] = XmCreateSeparatorGadget(owner,
366 "separater", args, n);
368 XtManageChild(buttons->w[i]);
379 static Atom delatom = 0;
381 delatom = XInternAtom(XtDisplayOfObject(toplevel),
382 "WM_DELETE_WINDOW", False);
390 CreateDialogAndButtons( Widget owner, String name,
391 void (*delcb)(), Button *btns, int btns_cnt, Widget *pop )
393 CreateDialogAndButtons( owner, name, delcb, btns, btns_cnt, pop )
406 XmString cs1, cs2, cs3;
409 XtSetArg( args[n], XmNautoUnmanage, resource. dia_tm_automng ); n++;
410 XtSetArg( args[n], XmNmarginWidth, resource.dia_tm_width ); n++;
411 XtSetArg( args[n], XmNmarginHeight, resource.dia_tm_height ); n++;
412 if (btns->itemcnt > 0){
413 cs1 = XmStringCreateLocalized(btns->items[0].label);
414 XtSetArg(args[n], XmNokLabelString, cs1); n++;
416 if (btns->itemcnt > 1){
417 cs2 = XmStringCreateLocalized(btns->items[1].label);
418 XtSetArg(args[n], XmNcancelLabelString, cs2); n++;
420 if (btns->itemcnt > 2){
421 cs3 = XmStringCreateLocalized(btns->items[2].label);
422 XtSetArg(args[n], XmNhelpLabelString, cs3); n++;
424 XtSetArg(args[n], XmNnoResize, resource.dia_tm_resize ); n++;
425 XtSetArg(args[n], XmNminimizeButtons, resource.dia_tm_minimize ); n++;
426 XtSetArg(args[n], XmNtitle, name ); n++;
427 *pop = XmCreateTemplateDialog(toplevel, "dialog", args, n);
429 XmAddWMProtocolCallback(XtParent(*pop),
430 DeleteWindowAtom(), delcb, 0);
432 XtSetArg( arg[n], XmNmarginWidth, resource.dia_rw_width ); n++;
433 XtSetArg( arg[n], XmNmarginHeight, resource.dia_rw_height ); n++;
434 XtSetArg( arg[n], XmNspacing, resource.dia_rw_spacing ); n++;
435 XtSetArg( arg[n], XmNorientation, XmVERTICAL); n++;
436 rowcol = XmCreateRowColumn( *pop, "RowCol", arg, n);
437 XtManageChild(rowcol);
438 if (btns->itemcnt > 0){
439 if (! btns->items[0].cb)
440 XtAddCallback(*pop, XmNokCallback, _unmap, 0);
441 XtAddCallback(*pop, XmNokCallback, btns->items[0].cb,
442 (btns->items[0].clientdata != NULL) ? btns->items[0].clientdata : 0);
444 if (btns->itemcnt > 1){
445 if (! btns->items[1].cb)
446 XtAddCallback(*pop, XmNcancelCallback, _unmap, 0);
447 XtAddCallback(*pop, XmNcancelCallback, btns->items[1].cb,
448 (btns->items[1].clientdata != NULL) ? btns->items[1].clientdata : 0);
450 if (btns->itemcnt > 2){
451 if (! btns->items[2].cb)
452 XtAddCallback(*pop, XmNhelpCallback, _unmap, 0);
453 XtAddCallback(*pop, XmNhelpCallback, btns->items[2].cb,
454 (btns->items[2].clientdata != NULL) ? btns->items[2].clientdata : 0);
457 XtSetValues(*pop, args, n);
458 if (btns->itemcnt == 1){
461 else if (btns->itemcnt == 2){
465 else if (btns->itemcnt == 3){
477 GuiInitialize(app, class_name, ac, av)
485 XtSetLanguageProc(NULL, NULL, NULL);
488 top = XtAppInitialize(app, class_name, NULL,0, ac,av, NULL,NULL,0);
494 CreateDrawingArea( owner, name, width, height, proc, val )
507 XtSetArg(arg[n], XmNwidth, width); n++;
508 XtSetArg(arg[n], XmNheight, height); n++;
509 XtSetArg(arg[n], XmNresizePolicy, XmRESIZE_NONE); n++;
510 XtSetArg(arg[n], XmNborderWidth, resource.draw_border); n++;
511 XtSetArg(arg[n], XmNbackground, resource.pane_background); n++;
512 XtSetArg(arg[n], XmNtopAttachment, (XtArgVal)XmATTACH_FORM); n++;
513 XtSetArg(arg[n], XmNleftAttachment, (XtArgVal)XmATTACH_FORM); n++;
514 XtSetArg(arg[n], XmNtopOffset, (XtArgVal)resource.draw_topoff); n++;
515 XtSetArg(arg[n], XmNleftOffset, (XtArgVal)resource.draw_lftoff); n++;
516 drawarea = XmCreateDrawingArea(owner, name, arg, n);
517 XtManageChild( drawarea );
518 XtAddEventHandler(drawarea, ExposureMask, FALSE, proc, (XtPointer)val);
526 AddLeftAttachWidget( w, ref, offset )
532 XmNleftAttachment, XmATTACH_WIDGET,
534 XmNleftOffset, offset,
539 AddLeftAttachForm( w, offset )
544 XmNleftAttachment, XmATTACH_FORM,
545 XmNleftOffset, offset,
550 AddTopAttachWidget( w, ref, offset )
556 XmNtopAttachment, XmATTACH_WIDGET,
558 XmNtopOffset, offset,
563 AddTopAttachForm( w, offset )
568 XmNtopAttachment, XmATTACH_FORM,
569 XmNtopOffset, offset,
574 AddRightAttachWidget( w, ref, offset )
580 XmNrightAttachment, XmATTACH_WIDGET,
582 XmNrightOffset, offset,
587 AddRightAttachForm( w, offset )
592 XmNrightAttachment, XmATTACH_FORM,
593 XmNrightOffset, offset,
598 AddBottomAttachForm( w, offset )
603 XmNbottomAttachment, XmATTACH_FORM,
604 XmNbottomOffset, offset,
607 #endif /* not USE_MACRO */
613 if (! XtIsManaged(w))
616 XRaiseWindow(XtDisplayOfObject(w), XtWindow(XtParent(w)));
629 ForcePopdownDialog(w)
638 SetLabelString(w, str)
643 cs = XmStringCreateLocalized(str);
644 XtVaSetValues( w, XmNlabelString, cs, NULL);
649 SetFooterString(w, str)
654 cs = XmStringCreateLocalized(str);
655 XtVaSetValues( w, XmNlabelString, cs, NULL);
661 /***********************************************************************
662 create and pop up the confirmaiton window
663 **********************************************************************/
665 static Widget notice=NULL;
668 format_str(st, charcnt , str)
675 static char buf[512];
681 if (! str || ! *str) return;
683 for( p=str, s=buf, lw=0; *p != 0; ){
685 if ( (*p == '\n') || (charcnt <= lw) ){
686 *s = '\n'; /* new line */
690 if( (len = mbtowc( &wc, p, MB_CUR_MAX )) <= 0 ) break;
691 for( i=0; i<len ; i++, s++, p++ ) *s = *p ;
697 cs = XmStringCreateLocalized(buf);
698 XtVaSetValues(st, XmNlabelString, (XtArgVal)cs, (String)0 );
704 if (notice && XtIsManaged(notice)){
705 XtUnmanageChild(notice);
709 static void _destroy(w)
723 PopupNotice( owner, message, type, button, do_format, title )
731 Widget label, help, cancel;
734 XmString cs1, cs2, cs3;
737 XtSetArg(args[n], XmNtitle, title ); n++;
738 XtSetArg(args[n], XmNnoResize, resource.pop_resize ); n++;
739 XtSetArg(args[n], XmNminimizeButtons, resource.pop_minimize ); n++;
740 XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
741 XtSetArg(args[n], XmNdialogType, type); n++;
742 notice = XmCreateMessageDialog( toplevel , "PopupNotice", args, n);
744 if (button->itemcnt > 0){
745 cs1 = XmStringCreateLocalized(button->items[0].label);
746 XtSetArg(args[n], XmNokLabelString, cs1); n++;
747 if (button->items[0].cb)
748 XtAddCallback(notice, XmNokCallback, button->items[0].cb, NULL);
749 cancel = XmMessageBoxGetChild(notice, XmDIALOG_CANCEL_BUTTON);
750 help = XmMessageBoxGetChild(notice, XmDIALOG_HELP_BUTTON);
752 if (button->itemcnt > 1){
753 cs2 = XmStringCreateLocalized(button->items[1].label);
754 XtSetArg(args[n], XmNcancelLabelString, cs2); n++;
755 if (button->items[1].cb)
756 XtAddCallback(notice, XmNcancelCallback, button->items[1].cb, NULL);
758 if (button->itemcnt > 2){
759 cs3 = XmStringCreateLocalized(button->items[2].label);
760 XtSetArg(args[n], XmNhelpLabelString, cs3); n++;
761 if (button->items[2].cb)
762 XtAddCallback(notice, XmNhelpCallback, button->items[2].cb, NULL);
763 XtAddCallback(help, XmNactivateCallback, (XtCallbackProc)_unmap, NULL);
765 XtSetValues(notice, args, n);
766 XtAddCallback(notice, XmNunmapCallback, (XtCallbackProc)_destroy, NULL);
767 if (button->itemcnt == 1){
769 XtUnmanageChild(cancel);
770 XtUnmanageChild(help);
772 else if (button->itemcnt == 2){
775 XtUnmanageChild(help);
777 else if (button->itemcnt == 3){
783 label = XmMessageBoxGetChild(notice, XmDIALOG_MESSAGE_LABEL);
786 format_str(label, 52, message);
788 cs1 = XmStringCreateLocalized(message);
789 XtVaSetValues(notice,
790 XmNmessageString, (XtArgVal) cs1, (String) 0);
791 XtVaSetValues(notice,
792 XmNmessageAlignment, XmALIGNMENT_CENTER, (String) 0);
795 XtManageChild(notice);
796 XBell(XtDisplayOfObject( toplevel ), 0);
802 _layout_centerEH(w, clientdata)
804 XtPointer clientdata;
808 Dimension bbw, mw, sw, cw;
811 XtVaGetValues(w, XmNchildren, &child, XmNnumChildren, &num, NULL);
812 XtVaGetValues(XtParent(w),
815 XmNshadowThickness, &sw,
817 XtVaGetValues(child[0], XmNwidth, &cw, NULL);
818 XtVaSetValues(w, XmNwidth, ((int)bbw-2*((int)mw+(int)sw)), NULL);
819 XtVaSetValues(child[0], XmNx,
820 ((((int)bbw-2*((int)mw+(int)sw))-(int)cw)/2), NULL);
825 CreateTemplateDialog( w, message, type, button, title, pop )
835 XmString cs, cs1=NULL, cs2=NULL, cs3=NULL;
839 cs = XmStringCreateLocalized(message);
840 XtSetArg(args[n], XmNnoResize, resource.temp_resize ); n++;
841 XtSetArg(args[n], XmNminimizeButtons, resource.temp_minimize ); n++;
842 XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
843 XtSetArg(args[n], XmNmessageString, cs); n++;
844 XtSetArg(args[n], XmNmessageAlignment, XmALIGNMENT_CENTER); n++;
845 XtSetArg(args[n], XmNtitle, title ); n++;
847 if (button->itemcnt > 0){
848 cs1 = XmStringCreateLocalized(button->items[0].label);
849 XtSetArg(args[n], XmNokLabelString, cs1); n++;
851 if (button->itemcnt > 1){
852 cs2 = XmStringCreateLocalized(button->items[1].label);
853 XtSetArg(args[n], XmNcancelLabelString, cs2); n++;
855 if (button->itemcnt > 2){
856 cs3 = XmStringCreateLocalized(button->items[2].label);
857 XtSetArg(args[n], XmNhelpLabelString, cs3); n++;
859 *pop = XmCreateTemplateDialog(w, "TemplateDialog", args, n);
860 if (button->itemcnt > 0 && button->items[0].cb)
861 XtAddCallback(*pop, XmNokCallback, button->items[0].cb, NULL);
862 if (button->itemcnt > 1 && button->items[1].cb)
863 XtAddCallback(*pop, XmNcancelCallback, button->items[1].cb, NULL);
864 if (button->itemcnt > 2 && button->items[2].cb)
865 XtAddCallback(*pop, XmNhelpCallback, button->items[2].cb, NULL);
868 if (cs1) XmStringFree(cs1);
869 if (cs2) XmStringFree(cs2);
870 if (cs3) XmStringFree(cs3);
872 XtAddCallback(*pop, XmNunmapCallback, (XtCallbackProc)_destroy, NULL);
874 XtSetArg(args[n], XmNwidth, resource.temp_width ); n++;
875 XtSetArg(args[n], XmNheight, resource.temp_height ); n++;
876 brtnb = XmCreateBulletinBoard(*pop, "BulletinBo", args, n);
877 XtManageChild(brtnb);
878 XtAddEventHandler(brtnb,
879 StructureNotifyMask, True, (XtEventHandler)_layout_centerEH, NULL);
887 AddDeleteProc(w, delcb)
891 Atom del = DeleteWindowAtom();
892 XmAddWMProtocols( w, &del, 1);
893 XmAddWMProtocolCallback( w, del, delcb, NULL );
897 AddPopupProc(w, popupcb)
901 XtAddCallback(XtParent(w), XmNpopupCallback, popupcb, 0);
905 AddDestroyProc(w, destroycb)
909 XtAddCallback(XtParent(w), XmNdestroyCallback, destroycb, 0);
913 CreateMenuBarAndFooterMessageForm(owner, name, buttons, bcnt, pop, footer)
921 Widget menuBar, form;
922 Widget footerFrame, footerForm, footerLabel, sep, casBtn, baseForm;
929 XtSetArg( arg[n], XmNiconName, name ); n++;
930 XtSetArg( arg[n], XmNdeleteResponse, XmUNMAP ); n++;
931 XtSetArg( arg[n], XmNmwmFunctions,
932 (MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE)); n++;
933 *pop = XtCreatePopupShell(name, applicationShellWidgetClass, owner, arg, n);
936 XtSetArg( arg[n], XmNshowSeparator, True ); n++;
937 form = XmCreateMainWindow( *pop, "MainW", arg, n);
941 menuBar = XmCreateMenuBar( form, "menuBar", arg, n);
942 XtManageChild(menuBar);
945 baseForm = XmCreateForm( form, "wgeForm", arg, n);
946 XtManageChild(baseForm);
948 for (i=0; i<bcnt; i++){
950 XtSetArg(arg[n], XmNtearOffModel, XmTEAR_OFF_ENABLED); n++;
951 buttons->items[i].menu =
952 XmCreatePulldownMenu(menuBar, "menu", arg, n);
954 if (strchr(buttons->items[i].label, buttons->items[i].mnemonic)){
955 sprintf(buf, "%s", buttons->items[i].label);
957 strcpy(buf, buttons->items[i].label);
959 strcat(buf, &(buttons->items[i].mnemonic));
962 cs = XmStringCreateLocalized(buf);
963 XtSetArg(arg[n],XmNmnemonic, buttons->items[i].mnemonic ); n++;
964 XtSetArg(arg[n],XmNlabelString, cs ); n++;
965 XtSetArg(arg[n],XmNsubMenuId, buttons->items[i].menu ); n++;
966 casBtn = XmCreateCascadeButton( menuBar, "casBtnA", arg, n);
967 XtManageChild(casBtn);
972 XtSetArg( arg[n], XmNshadowType, XmSHADOW_IN ); n++;
973 footerFrame = XmCreateFrame( form, "footerFrame", arg, n);
974 XtManageChild(footerFrame);
975 XtVaSetValues(form, XmNmessageWindow, footerFrame, NULL);
978 XtSetArg( arg[n], XmNtopAttachment, XmATTACH_FORM); n++;
979 XtSetArg( arg[n], XmNbottomAttachment, XmATTACH_FORM); n++;
980 XtSetArg( arg[n], XmNleftAttachment, XmATTACH_FORM); n++;
981 XtSetArg( arg[n], XmNrightAttachment, XmATTACH_FORM); n++;
982 footerForm = XmCreateForm( footerFrame, "footerForm", arg, n);
983 XtManageChild(footerForm);
986 cs = XmStringCreateLocalized(resource.message);
987 XtSetArg( arg[n], XmNlabelString, cs); n++;
988 XtSetArg( arg[n], XmNtopAttachment, XmATTACH_FORM); n++;
989 XtSetArg( arg[n], XmNbottomAttachment, XmATTACH_FORM); n++;
990 XtSetArg( arg[n], XmNleftAttachment, XmATTACH_FORM); n++;
991 XtSetArg( arg[n], XmNmarginTop, resource.ed_msg_margintop ); n++;
992 XtSetArg( arg[n], XmNmarginBottom, resource.ed_msg_marginbtm ); n++;
993 footerLabel = XmCreateLabel(footerForm, "Message", arg,n);
994 XtManageChild(footerLabel);
998 cs = XmStringCreateLocalized("");
999 XtSetArg( arg[n], XmNtopAttachment, XmATTACH_FORM); n++;
1000 XtSetArg( arg[n], XmNbottomAttachment, XmATTACH_FORM); n++;
1001 XtSetArg( arg[n], XmNrightAttachment, XmATTACH_FORM); n++;
1002 XtSetArg( arg[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
1003 XtSetArg( arg[n], XmNleftWidget, footerLabel); n++;
1004 XtSetArg( arg[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
1005 XtSetArg( arg[n], XmNmarginTop, resource.ed_mesg_margintop ); n++;
1006 XtSetArg( arg[n], XmNmarginBottom, resource.ed_mesg_marginbtm ); n++;
1007 XtSetArg( arg[n], XmNlabelString, cs); n++;
1008 *footer = XmCreateLabelGadget(footerForm, "MessageG", arg, n);
1009 XtManageChild(*footer);
1016 GetMenuWidget( buttons, buttons_num )
1020 return(buttons->items[buttons_num].menu);
1024 CreateForm( owner, name )
1033 form = XmCreateForm( owner, name, arg, n );
1034 XtManageChild(form);
1040 CreateLabel( owner, name, str )
1048 XmString cs = XmStringCreateLocalized(str);
1049 XtSetArg( arg[n], XmNlabelString, cs); n++;
1050 label = XmCreateLabel( owner, "label", arg, n);
1051 XtManageChild(label);
1058 CreateFrame(owner, name, type, thickness)
1062 XtPointer thickness;
1069 XtSetArg(args[n], XmNresizable, resource.frame_resize ); n++;
1070 XtSetArg(args[n], XmNshadowType, type); n++;
1071 XtSetArg(args[n], XmNshadowThickness , thickness); n++;
1072 frame = XmCreateFrame(owner, "frame", args, n);
1073 XtManageChild(frame);
1079 CreateRowColumn(owner, name, layout, space, marginw, marginh)
1092 XtSetArg(args[n], XmNorientation, layout); n++;
1093 XtSetArg(args[n], XmNspacing, space); n++;
1094 XtSetArg(args[n], XmNmarginWidth, marginw); n++;
1095 XtSetArg(args[n], XmNmarginHeight, marginh); n++;
1096 rc = XmCreateRowColumn(owner, "rowColumn", args, n);
1103 CreateScrollBar( owner, name, height, val, min, max, proc )
1117 XtSetArg( arg[n], XmNsliderSize, (XtArgVal)val ); n++;
1118 XtSetArg( arg[n], XmNpageIncrement, (XtArgVal)val ); n++;
1119 XtSetArg( arg[n], XmNmaximum, (XtArgVal)max ); n++;
1121 sc = XmCreateScrollBar(owner, "wgeScro", arg, n);
1122 XtManageChild( sc );
1123 XtAddCallback( sc, XmNvalueChangedCallback, proc, NULL );
1130 _scbase_cb( w, proc, calldata )
1133 XmScrollBarCallbackStruct *calldata;
1135 (*proc)(calldata->value);
1139 CreateScrollBase( owner, name, min, max, val, vcnt, sbproc )
1150 Widget base, frame, rwclm, sc;
1153 XtSetArg( arg[n], XmNwidth, resource.scll_fr_width ); n++;
1154 base = XmCreateForm( owner, name, arg, n );
1155 XtManageChild( base );
1157 XtSetArg( arg[n], XmNshadowType, XmSHADOW_IN ); n++;
1158 XtSetArg( arg[n], XmNshadowThickness, resource.scll_fr_thick ); n++;
1159 XtSetArg( arg[n], XmNbottomAttachment, XmATTACH_FORM ); n++;
1160 frame = XmCreateFrame( base, name, arg, n );
1161 XtManageChild( frame );
1163 rwclm = XmCreateRowColumn( frame, name, arg, n );
1164 XtManageChild( rwclm );
1165 if (vcnt < (max-min)){
1167 XtSetArg( arg[n], XmNsliderSize, vcnt ); n++;
1168 XtSetArg( arg[n], XmNminimum, min ); n++;
1169 XtSetArg( arg[n], XmNmaximum, max ); n++;
1170 XtSetArg( arg[n], XmNvalue, val ); n++;
1171 XtSetArg( arg[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
1172 XtSetArg( arg[n], XmNleftWidget, rwclm ); n++;
1173 XtSetArg( arg[n], XmNleftOffset, resource.scll_bar_lftoff ); n++;
1174 XtSetArg( arg[n], XmNtopAttachment, XmATTACH_FORM ); n++;
1175 XtSetArg( arg[n], XmNbottomAttachment, XmATTACH_FORM ); n++;
1176 sc = XmCreateScrollBar( base, name, arg, n );
1177 XtManageChild( sc );
1178 XtAddCallback( sc, XmNvalueChangedCallback,
1179 (XtCallbackProc)_scbase_cb, (XtPointer)sbproc);