comparison lwlib/lwlib-Xm.c @ 4522:fc7067b7f407

Backout last patch; forgot to specify file.
author Stephen J. Turnbull <stephen@xemacs.org>
date Wed, 29 Oct 2008 03:37:16 +0900
parents 383ab474a241
children 726060ee587c
comparison
equal deleted inserted replaced
4521:383ab474a241 4522:fc7067b7f407
214 Arg al [20]; 214 Arg al [20];
215 int ac = 0; 215 int ac = 0;
216 int type; 216 int type;
217 217
218 /* Don't clobber pixmap types. */ 218 /* Don't clobber pixmap types. */
219 Xt_GET_VALUE (widget, XmNlabelType, &type); 219 XtSetArg (al [0], XmNlabelType, &type);
220 XtGetValues (widget, al, 1);
220 221
221 if (type == XmPIXMAP) 222 if (type == XmPIXMAP)
222 return; 223 return;
223 224
224 if (val->value) 225 if (val->value)
277 278
278 XtFree (value_name); 279 XtFree (value_name);
279 } 280 }
280 } 281 }
281 282
282 Xt_SET_ARG (al [ac], XmNlabelString, built_string); ac++; 283 XtSetArg (al [ac], XmNlabelString, built_string); ac++;
283 Xt_SET_ARG (al [ac], XmNlabelType, XmSTRING); ac++; 284 XtSetArg (al [ac], XmNlabelType, XmSTRING); ac++;
284 } 285 }
285 286
286 if (val->key) 287 if (val->key)
287 { 288 {
288 key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET); 289 key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);
289 Xt_SET_ARG (al [ac], XmNacceleratorText, key_string); ac++; 290 XtSetArg (al [ac], XmNacceleratorText, key_string); ac++;
290 } 291 }
291 292
292 if (ac) 293 if (ac)
293 XtSetValues (widget, al, ac); 294 XtSetValues (widget, al, ac);
294 295
339 /* update of buttons */ 340 /* update of buttons */
340 static void 341 static void
341 xm_update_pushbutton (widget_instance* instance, Widget widget, 342 xm_update_pushbutton (widget_instance* instance, Widget widget,
342 widget_value* UNUSED (val)) 343 widget_value* UNUSED (val))
343 { 344 {
344 Xt_SET_VALUE (widget, XmNalignment, XmALIGNMENT_CENTER); 345 Arg al [1];
346 XtSetArg (al [0], XmNalignment, XmALIGNMENT_CENTER);
347 XtSetValues (widget, al, 1);
345 XtRemoveAllCallbacks (widget, XmNactivateCallback); 348 XtRemoveAllCallbacks (widget, XmNactivateCallback);
346 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); 349 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
347 } 350 }
348 351
349 #ifdef LWLIB_WIDGETS_MOTIF 352 #ifdef LWLIB_WIDGETS_MOTIF
355 int ac = 0; 358 int ac = 0;
356 Dimension height = 0; 359 Dimension height = 0;
357 Dimension width = 0; 360 Dimension width = 0;
358 if (!val->call_data) 361 if (!val->call_data)
359 { 362 {
360 Xt_SET_ARG (al [ac], XmNeditable, False); ac++; 363 XtSetArg (al [ac], XmNeditable, False); ac++;
361 } 364 }
362 else 365 else
363 { 366 {
364 Xt_SET_ARG (al [ac], XmNeditable, val->enabled); ac++; 367 XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
365 } 368 }
366 height = (Dimension) lw_get_value_arg (val, XtNheight); 369 height = (Dimension)lw_get_value_arg (val, XtNheight);
367 width = (Dimension) lw_get_value_arg (val, XtNwidth); 370 width = (Dimension)lw_get_value_arg (val, XtNwidth);
368 if (height > 0) 371 if (height > 0)
369 { 372 {
370 Xt_SET_ARG (al [ac], XmNscaleHeight, height); ac++; 373 XtSetArg (al [ac], XmNscaleHeight, height); ac++;
371 } 374 }
372 if (width > 0) 375 if (width > 0)
373 { 376 {
374 Xt_SET_ARG (al [ac], XmNscaleWidth, width); ac++; 377 XtSetArg (al [ac], XmNscaleWidth, width); ac++;
375 } 378 }
376 379
377 XtSetValues (scale, al, ac); 380 XtSetValues (scale, al, ac);
378 } 381 }
379 #endif /* LWLIB_WIDGETS_MOTIF */ 382 #endif /* LWLIB_WIDGETS_MOTIF */
414 { 417 {
415 Arg al [2]; 418 Arg al [2];
416 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); 419 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
417 XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback, 420 XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback,
418 instance); 421 instance);
419 Xt_SET_ARG (al [0], XmNset, val->selected); 422 XtSetArg (al [0], XmNset, val->selected);
420 Xt_SET_ARG (al [1], XmNalignment, XmALIGNMENT_BEGINNING); 423 XtSetArg (al [1], XmNalignment, XmALIGNMENT_BEGINNING);
421 XtSetValues (widget, al, 1); 424 XtSetValues (widget, al, 1);
422 } 425 }
423 426
424 static void 427 static void
425 xm_update_radiobox (widget_instance* instance, Widget widget, 428 xm_update_radiobox (widget_instance* instance, Widget widget,
442 { 445 {
443 toggle = XtNameToWidget (widget, cur->value); 446 toggle = XtNameToWidget (widget, cur->value);
444 if (toggle) 447 if (toggle)
445 { 448 {
446 Arg al [2]; 449 Arg al [2];
447 Xt_SET_ARG (al [0], XmNsensitive, cur->enabled); 450 XtSetArg (al [0], XmNsensitive, cur->enabled);
448 Xt_SET_ARG (al [1], XmNset, (!val->value && cur->selected ? cur->selected : False)); 451 XtSetArg (al [1], XmNset, (!val->value && cur->selected ? cur->selected : False));
449 XtSetValues (toggle, al, 2); 452 XtSetValues (toggle, al, 2);
450 } 453 }
451 } 454 }
452 455
453 /* The selected was specified by the value slot */ 456 /* The selected was specified by the value slot */
454 if (val->value) 457 if (val->value)
455 { 458 {
456 toggle = XtNameToWidget (widget, val->value); 459 toggle = XtNameToWidget (widget, val->value);
457 if (toggle) 460 if (toggle)
458 Xt_SET_VALUE (toggle, XmNset, True); 461 {
462 Arg al [1];
463 XtSetArg (al [0], XmNset, True);
464 XtSetValues (toggle, al, 1);
465 }
459 } 466 }
460 } 467 }
461 468
462 #if defined (LWLIB_WIDGETS_MOTIF) && XmVERSION > 1 469 #if defined (LWLIB_WIDGETS_MOTIF) && XmVERSION > 1
463 /* update of combo box */ 470 /* update of combo box */
502 /* Allocate the children array */ 509 /* Allocate the children array */
503 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next); 510 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next);
504 children = (Widget*)XtMalloc (num_children * sizeof (Widget)); 511 children = (Widget*)XtMalloc (num_children * sizeof (Widget));
505 512
506 /* tricky way to know if this RowColumn is a menubar or a pulldown... */ 513 /* tricky way to know if this RowColumn is a menubar or a pulldown... */
507 Xt_GET_VALUE (widget, XmNisHomogeneous, &menubar_p); 514 XtSetArg (al [0], XmNisHomogeneous, &menubar_p);
515 XtGetValues (widget, al, 1);
508 516
509 /* add the unmap callback for popups and pulldowns */ 517 /* add the unmap callback for popups and pulldowns */
510 /*** this sounds bogus ***/ 518 /*** this sounds bogus ***/
511 /* probably because it is -- cet */ 519 /* probably because it is -- cet */
512 /* 520 /*
518 num_children = 0; 526 num_children = 0;
519 for (child_index = 0, cur = val; cur; child_index++, cur = cur->next) 527 for (child_index = 0, cur = val; cur; child_index++, cur = cur->next)
520 { 528 {
521 ac = 0; 529 ac = 0;
522 button = 0; 530 button = 0;
523 Xt_SET_ARG (al [ac], XmNsensitive, cur->enabled); ac++; 531 XtSetArg (al [ac], XmNsensitive, cur->enabled); ac++;
524 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 532 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
525 Xt_SET_ARG (al [ac], XmNuserData, cur->call_data); ac++; 533 XtSetArg (al [ac], XmNuserData, cur->call_data); ac++;
526 534
527 switch (cur->type) 535 switch (cur->type)
528 { 536 {
529 case PUSHRIGHT_TYPE: 537 case PUSHRIGHT_TYPE:
530 /* A pushright marker which is not needed for the real Motif 538 /* A pushright marker which is not needed for the real Motif
535 if (cur->value) 543 if (cur->value)
536 { 544 {
537 /* #### - xlwmenu.h supports several types that motif does 545 /* #### - xlwmenu.h supports several types that motif does
538 not. Also, motif supports pixmaps w/ type NO_LINE and 546 not. Also, motif supports pixmaps w/ type NO_LINE and
539 lwlib provides no way to access that functionality. --Stig */ 547 lwlib provides no way to access that functionality. --Stig */
540 Xt_SET_ARG (al [ac], XmNseparatorType, cur->value); ac++; 548 XtSetArg (al [ac], XmNseparatorType, cur->value), ac++;
541 } 549 }
542 button = XmCreateSeparator (widget, "separator", al, ac); 550 button = XmCreateSeparator (widget, "separator", al, ac);
543 break; 551 break;
544 case CASCADE_TYPE: 552 case CASCADE_TYPE:
545 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); 553 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0);
546 make_menu_in_widget (instance, menu, cur->contents); 554 make_menu_in_widget (instance, menu, cur->contents);
547 Xt_SET_ARG (al [ac], XmNsubMenuId, menu); ac++; 555 XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
548 button = XmCreateCascadeButton (widget, cur->name, al, ac); 556 button = XmCreateCascadeButton (widget, cur->name, al, ac);
549 557
550 xm_safe_update_label (instance, button, cur); 558 xm_safe_update_label (instance, button, cur);
551 559
552 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback, 560 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
557 button = XmCreateCascadeButton (widget, cur->name, al, ac); 565 button = XmCreateCascadeButton (widget, cur->name, al, ac);
558 else if (!cur->call_data) 566 else if (!cur->call_data)
559 button = XmCreateLabel (widget, cur->name, al, ac); 567 button = XmCreateLabel (widget, cur->name, al, ac);
560 else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) 568 else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE)
561 { 569 {
562 Xt_SET_ARG (al [ac], XmNindicatorType, 570 XtSetArg (al [ac], XmNindicatorType,
563 (cur->type == TOGGLE_TYPE ? 571 (cur->type == TOGGLE_TYPE ?
564 XmN_OF_MANY : XmONE_OF_MANY)); ac++; 572 XmN_OF_MANY : XmONE_OF_MANY)); ac++;
565 Xt_SET_ARG (al [ac], XmNvisibleWhenOff, True); ac++; 573 XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
566 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); 574 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac);
567 } 575 }
568 else 576 else
569 button = XmCreatePushButtonGadget (widget, cur->name, al, ac); 577 button = XmCreatePushButtonGadget (widget, cur->name, al, ac);
570 578
587 otherwise the menubar ended up only 4 pixels high. That must 595 otherwise the menubar ended up only 4 pixels high. That must
588 have been in the Old World. In the New World it stays the proper 596 have been in the Old World. In the New World it stays the proper
589 height if you don't manage them until after you set this and as a 597 height if you don't manage them until after you set this and as a
590 bonus the Help menu ends up where it is supposed to. */ 598 bonus the Help menu ends up where it is supposed to. */
591 if (button) 599 if (button)
592 Xt_SET_VALUE (widget, XmNmenuHelpWidget, button); 600 {
601 ac = 0;
602 XtSetArg (al [ac], XmNmenuHelpWidget, button); ac++;
603 XtSetValues (widget, al, ac);
604 }
593 605
594 if (num_children) 606 if (num_children)
595 XtManageChildren (children, num_children); 607 XtManageChildren (children, num_children);
596 608
597 XtFree ((char *) children); 609 XtFree ((char *) children);
609 if (val->change == NO_CHANGE) 621 if (val->change == NO_CHANGE)
610 return; 622 return;
611 623
612 /* update the sensitivity and userdata */ 624 /* update the sensitivity and userdata */
613 /* Common to all widget types */ 625 /* Common to all widget types */
614 Xt_SET_ARG (al [0], XmNsensitive, val->enabled); 626 XtSetArg (al [0], XmNsensitive, val->enabled);
615 Xt_SET_ARG (al [1], XmNuserData, val->call_data); 627 XtSetArg (al [1], XmNuserData, val->call_data);
616 XtSetValues (widget, al, 2); 628 XtSetValues (widget, al, 2);
617 629
618 /* update the menu button as a label. */ 630 /* update the menu button as a label. */
619 if (val->change >= VISIBLE_CHANGE) 631 if (val->change >= VISIBLE_CHANGE)
620 { 632 {
628 } 640 }
629 641
630 642
631 /* update the pulldown/pullaside as needed */ 643 /* update the pulldown/pullaside as needed */
632 menu = NULL; 644 menu = NULL;
633 Xt_GET_VALUE (widget, XmNsubMenuId, &menu); 645 XtSetArg (al [0], XmNsubMenuId, &menu);
646 XtGetValues (widget, al, 1);
634 647
635 contents = val->contents; 648 contents = val->contents;
636 649
637 if (!menu) 650 if (!menu)
638 { 651 {
639 if (contents) 652 if (contents)
640 { 653 {
641 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0); 654 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0);
642 make_menu_in_widget (instance, menu, contents); 655 make_menu_in_widget (instance, menu, contents);
643 Xt_SET_VALUE (widget, XmNsubMenuId, menu); 656 ac = 0;
657 XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
658 XtSetValues (widget, al, ac);
644 } 659 }
645 } 660 }
646 else if (!contents) 661 else if (!contents)
647 { 662 {
648 Xt_SET_VALUE (widget, XmNsubMenuId, NULL); 663 ac = 0;
664 XtSetArg (al [ac], XmNsubMenuId, NULL); ac++;
665 XtSetValues (widget, al, ac);
649 XtDestroyWidget (menu); 666 XtDestroyWidget (menu);
650 } 667 }
651 else if (deep_p && contents->change != NO_CHANGE) 668 else if (deep_p && contents->change != NO_CHANGE)
652 xm_update_menu (instance, menu, val, 1); 669 xm_update_menu (instance, menu, val, 1);
653 } 670 }
753 double percent; 770 double percent;
754 double h_water, l_water; 771 double h_water, l_water;
755 Arg al [4]; 772 Arg al [4];
756 773
757 /* First size and position the scrollbar widget. */ 774 /* First size and position the scrollbar widget. */
758 Xt_SET_ARG (al [0], XtNx, data->scrollbar_x); 775 XtSetArg (al [0], XtNx, data->scrollbar_x);
759 Xt_SET_ARG (al [1], XtNy, data->scrollbar_y); 776 XtSetArg (al [1], XtNy, data->scrollbar_y);
760 Xt_SET_ARG (al [2], XtNwidth, data->scrollbar_width); 777 XtSetArg (al [2], XtNwidth, data->scrollbar_width);
761 Xt_SET_ARG (al [3], XtNheight, data->scrollbar_height); 778 XtSetArg (al [3], XtNheight, data->scrollbar_height);
762 XtSetValues (widget, al, 4); 779 XtSetValues (widget, al, 4);
763 780
764 /* Now size the scrollbar's slider. */ 781 /* Now size the scrollbar's slider. */
765 Xt_SET_ARG (al [0], XmNsliderSize, &widget_sliderSize); 782 XtSetArg (al [0], XmNsliderSize, &widget_sliderSize);
766 Xt_SET_ARG (al [1], XmNvalue, &widget_val); 783 XtSetArg (al [1], XmNvalue, &widget_val);
767 XtGetValues (widget, al, 2); 784 XtGetValues (widget, al, 2);
768 785
769 percent = (double) data->slider_size / 786 percent = (double) data->slider_size /
770 (double) (data->maximum - data->minimum); 787 (double) (data->maximum - data->minimum);
771 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent); 788 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);
826 843
827 /* Mark as not edited */ 844 /* Mark as not edited */
828 val->edited = False; 845 val->edited = False;
829 846
830 /* Common to all widget types */ 847 /* Common to all widget types */
831 Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; 848 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
832 Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; 849 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
833 XtSetValues (widget, al, ac); 850 XtSetValues (widget, al, ac);
834 851
835 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF) 852 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF)
836 /* Common to all label like widgets */ 853 /* Common to all label like widgets */
837 xm_safe_update_label (instance, widget, val); 854 xm_safe_update_label (instance, widget, val);
856 } 873 }
857 else if (class_ == xmRowColumnWidgetClass) 874 else if (class_ == xmRowColumnWidgetClass)
858 { 875 {
859 Boolean radiobox = 0; 876 Boolean radiobox = 0;
860 877
861 Xt_GET_VALUE (widget, XmNradioBehavior, &radiobox); 878 XtSetArg (al [0], XmNradioBehavior, &radiobox);
879 XtGetValues (widget, al, 1);
862 880
863 if (radiobox) 881 if (radiobox)
864 xm_update_radiobox (instance, widget, val); 882 xm_update_radiobox (instance, widget, val);
865 #ifdef LWLIB_MENUBARS_MOTIF 883 #ifdef LWLIB_MENUBARS_MOTIF
866 else 884 else
918 break; 936 break;
919 } 937 }
920 938
921 if (class_ == xmToggleButtonWidgetClass || class_ == xmToggleButtonGadgetClass) 939 if (class_ == xmToggleButtonWidgetClass || class_ == xmToggleButtonGadgetClass)
922 { 940 {
923 Xt_GET_VALUE (widget, XmNset, &val->selected); 941 Arg al [1];
942 XtSetArg (al [0], XmNset, &val->selected);
943 XtGetValues (widget, al, 1);
924 val->edited = True; 944 val->edited = True;
925 } 945 }
926 else if (class_ == xmTextWidgetClass) 946 else if (class_ == xmTextWidgetClass)
927 { 947 {
928 if (val->value) 948 if (val->value)
938 val->edited = True; 958 val->edited = True;
939 } 959 }
940 else if (class_ == xmRowColumnWidgetClass) 960 else if (class_ == xmRowColumnWidgetClass)
941 { 961 {
942 Boolean radiobox = 0; 962 Boolean radiobox = 0;
943 963 {
944 Xt_GET_VALUE (widget, XmNradioBehavior, &radiobox); 964 Arg al [1];
965 XtSetArg (al [0], XmNradioBehavior, &radiobox);
966 XtGetValues (widget, al, 1);
967 }
945 968
946 if (radiobox) 969 if (radiobox)
947 { 970 {
948 CompositeWidget radio = (CompositeWidget)widget; 971 CompositeWidget radio = (CompositeWidget)widget;
949 unsigned int i; 972 unsigned int i;
950 for (i = 0; i < radio->composite.num_children; i++) 973 for (i = 0; i < radio->composite.num_children; i++)
951 { 974 {
952 int set = False; 975 int set = False;
953 Widget toggle = radio->composite.children [i]; 976 Widget toggle = radio->composite.children [i];
954 977 Arg al [1];
955 Xt_GET_VALUE (toggle, XmNset, &set); 978
979 XtSetArg (al [0], XmNset, &set);
980 XtGetValues (toggle, al, 1);
956 if (set) 981 if (set)
957 { 982 {
958 if (val->value) 983 if (val->value)
959 free (val->value); 984 free (val->value);
960 val->value = safe_strdup (XtName (toggle)); 985 val->value = safe_strdup (XtName (toggle));
1103 #endif /* ! DND_KLUDGE */ 1128 #endif /* ! DND_KLUDGE */
1104 1129
1105 if (pop_up_p) 1130 if (pop_up_p)
1106 { 1131 {
1107 ac = 0; 1132 ac = 0;
1108 Xt_SET_ARG(al[ac], XmNtitle, shell_title); ac++; 1133 XtSetArg(al[ac], XmNtitle, shell_title); ac++;
1109 Xt_SET_ARG(al[ac], XtNallowShellResize, True); ac++; 1134 XtSetArg(al[ac], XtNallowShellResize, True); ac++;
1110 Xt_SET_ARG(al[ac], XmNdeleteResponse, XmUNMAP); ac++; 1135 XtSetArg(al[ac], XmNdeleteResponse, XmUNMAP); ac++;
1111 result = XmCreateDialogShell (parent, "dialog", al, ac); 1136 result = XmCreateDialogShell (parent, "dialog", al, ac);
1112 1137
1113 Xt_SET_ARG(al[ac], XmNautoUnmanage, FALSE); ac++; 1138 XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
1114 /* Xt_SET_ARG(al[ac], XmNautoUnmanage, TRUE); ac++; */ /* ####is this ok? */ 1139 /* XtSetArg(al[ac], XmNautoUnmanage, TRUE); ac++; */ /* ####is this ok? */
1115 Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1140 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1116 form = XmCreateForm (result, (char *) shell_title, al, ac); 1141 form = XmCreateForm (result, (char *) shell_title, al, ac);
1117 } 1142 }
1118 else 1143 else
1119 { 1144 {
1120 ac = 0; 1145 ac = 0;
1121 Xt_SET_ARG(al[ac], XmNautoUnmanage, FALSE); ac++; 1146 XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
1122 Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1147 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1123 form = XmCreateForm (parent, (char *) shell_title, al, ac); 1148 form = XmCreateForm (parent, (char *) shell_title, al, ac);
1124 result = form; 1149 result = form;
1125 } 1150 }
1126 1151
1127 ac = 0; 1152 ac = 0;
1128 Xt_SET_ARG(al[ac], XmNpacking, XmPACK_COLUMN); ac++; 1153 XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
1129 Xt_SET_ARG(al[ac], XmNorientation, XmVERTICAL); ac++; 1154 XtSetArg(al[ac], XmNorientation, XmVERTICAL); ac++;
1130 Xt_SET_ARG(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++; 1155 XtSetArg(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++;
1131 Xt_SET_ARG(al[ac], XmNmarginWidth, 0); ac++; 1156 XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
1132 Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; 1157 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
1133 Xt_SET_ARG(al[ac], XmNspacing, 13); ac++; 1158 XtSetArg(al[ac], XmNspacing, 13); ac++;
1134 Xt_SET_ARG(al[ac], XmNadjustLast, False); ac++; 1159 XtSetArg(al[ac], XmNadjustLast, False); ac++;
1135 Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; 1160 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
1136 Xt_SET_ARG(al[ac], XmNisAligned, True); ac++; 1161 XtSetArg(al[ac], XmNisAligned, True); ac++;
1137 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; 1162 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1138 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; 1163 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
1139 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1164 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1140 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; 1165 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1141 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1166 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1142 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1167 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1143 Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; 1168 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1144 row = XmCreateRowColumn (form, "row", al, ac); 1169 row = XmCreateRowColumn (form, "row", al, ac);
1145 1170
1146 n_children = 0; 1171 n_children = 0;
1147 for (i = 0; i < left_buttons; i++) 1172 for (i = 0; i < left_buttons; i++)
1148 { 1173 {
1149 char button_name [16]; 1174 char button_name [16];
1150 sprintf (button_name, "button%d", i + 1); 1175 sprintf (button_name, "button%d", i + 1);
1151 ac = 0; 1176 ac = 0;
1152 if (i == 0) 1177 if (i == 0)
1153 { 1178 {
1154 Xt_SET_ARG(al[ac], XmNhighlightThickness, 1); ac++; 1179 XtSetArg(al[ac], XmNhighlightThickness, 1); ac++;
1155 Xt_SET_ARG(al[ac], XmNshowAsDefault, TRUE); ac++; 1180 XtSetArg(al[ac], XmNshowAsDefault, TRUE); ac++;
1156 } 1181 }
1157 Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1182 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1158 children [n_children] = XmCreatePushButton (row, button_name, al, ac); 1183 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
1159 DO_DND_KLUDGE (children [n_children]); 1184 DO_DND_KLUDGE (children [n_children]);
1160 1185
1161 if (i == 0) 1186 if (i == 0)
1162 { 1187 {
1163 button = children [n_children]; 1188 button = children [n_children];
1164 ac = 0; 1189 ac = 0;
1165 Xt_SET_ARG(al[ac], XmNdefaultButton, button); ac++; 1190 XtSetArg(al[ac], XmNdefaultButton, button); ac++;
1166 XtSetValues (row, al, ac); 1191 XtSetValues (row, al, ac);
1167 1192
1168 #ifdef ARMANDACTIVATE_KLUDGE /* See comment above */ 1193 #ifdef ARMANDACTIVATE_KLUDGE /* See comment above */
1169 { 1194 {
1170 XtTranslations losers = XtParseTranslationTable (button_trans); 1195 XtTranslations losers = XtParseTranslationTable (button_trans);
1177 n_children++; 1202 n_children++;
1178 } 1203 }
1179 1204
1180 /* invisible separator button */ 1205 /* invisible separator button */
1181 ac = 0; 1206 ac = 0;
1182 Xt_SET_ARG (al[ac], XmNmappedWhenManaged, FALSE); ac++; 1207 XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;
1183 children [n_children] = XmCreateLabel (row, "separator_button", al, ac); 1208 children [n_children] = XmCreateLabel (row, "separator_button",
1209 al, ac);
1184 DO_DND_KLUDGE (children [n_children]); 1210 DO_DND_KLUDGE (children [n_children]);
1185 n_children++; 1211 n_children++;
1186 1212
1187 for (i = 0; i < right_buttons; i++) 1213 for (i = 0; i < right_buttons; i++)
1188 { 1214 {
1189 char button_name [16]; 1215 char button_name [16];
1190 sprintf (button_name, "button%d", left_buttons + i + 1); 1216 sprintf (button_name, "button%d", left_buttons + i + 1);
1191 ac = 0; 1217 ac = 0;
1192 Xt_SET_ARG(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1218 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1193 children [n_children] = XmCreatePushButton (row, button_name, al, ac); 1219 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
1194 DO_DND_KLUDGE (children [n_children]); 1220 DO_DND_KLUDGE (children [n_children]);
1195 if (! button) button = children [n_children]; 1221 if (! button) button = children [n_children];
1196 n_children++; 1222 n_children++;
1197 } 1223 }
1198 1224
1199 XtManageChildren (children, n_children); 1225 XtManageChildren (children, n_children);
1200 1226
1201 ac = 0; 1227 ac = 0;
1202 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; 1228 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1203 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1229 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1204 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1230 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1205 Xt_SET_ARG(al[ac], XmNbottomWidget, row); ac++; 1231 XtSetArg(al[ac], XmNbottomWidget, row); ac++;
1206 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; 1232 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1207 Xt_SET_ARG(al[ac], XmNleftOffset, 0); ac++; 1233 XtSetArg(al[ac], XmNleftOffset, 0); ac++;
1208 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1234 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1209 Xt_SET_ARG(al[ac], XmNrightOffset, 0); ac++; 1235 XtSetArg(al[ac], XmNrightOffset, 0); ac++;
1210 separator = XmCreateSeparator (form, "", al, ac); 1236 separator = XmCreateSeparator (form, "", al, ac);
1211 1237
1212 ac = 0; 1238 ac = 0;
1213 Xt_SET_ARG(al[ac], XmNlabelType, XmPIXMAP); ac++; 1239 XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++;
1214 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; 1240 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
1215 Xt_SET_ARG(al[ac], XmNtopOffset, 13); ac++; 1241 XtSetArg(al[ac], XmNtopOffset, 13); ac++;
1216 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; 1242 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
1217 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; 1243 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1218 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1244 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1219 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; 1245 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
1220 icon = XmCreateLabel (form, (char *) icon_name, al, ac); 1246 icon = XmCreateLabel (form, (char *) icon_name, al, ac);
1221 DO_DND_KLUDGE (icon); 1247 DO_DND_KLUDGE (icon);
1222 1248
1223 ac = 0; 1249 ac = 0;
1224 Xt_SET_ARG(al[ac], XmNmappedWhenManaged, FALSE); ac++; 1250 XtSetArg(al[ac], XmNmappedWhenManaged, FALSE); ac++;
1225 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; 1251 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1226 Xt_SET_ARG(al[ac], XmNtopOffset, 6); ac++; 1252 XtSetArg(al[ac], XmNtopOffset, 6); ac++;
1227 Xt_SET_ARG(al[ac], XmNtopWidget, icon); ac++; 1253 XtSetArg(al[ac], XmNtopWidget, icon); ac++;
1228 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1254 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1229 Xt_SET_ARG(al[ac], XmNbottomOffset, 6); ac++; 1255 XtSetArg(al[ac], XmNbottomOffset, 6); ac++;
1230 Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; 1256 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1231 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++; 1257 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
1232 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; 1258 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
1233 icon_separator = XmCreateLabel (form, "", al, ac); 1259 icon_separator = XmCreateLabel (form, "", al, ac);
1234 DO_DND_KLUDGE (icon_separator); 1260 DO_DND_KLUDGE (icon_separator);
1235 1261
1236 if (text_input_slot) 1262 if (text_input_slot)
1237 { 1263 {
1238 ac = 0; 1264 ac = 0;
1239 Xt_SET_ARG(al[ac], XmNcolumns, 50); ac++; 1265 XtSetArg(al[ac], XmNcolumns, 50); ac++;
1240 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; 1266 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1241 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1267 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1242 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1268 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1243 Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; 1269 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1244 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; 1270 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1245 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1271 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1246 Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; 1272 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1247 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1273 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1248 Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; 1274 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1249 value = XmCreateTextField (form, "value", al, ac); 1275 value = XmCreateTextField (form, "value", al, ac);
1250 DO_DND_KLUDGE (value); 1276 DO_DND_KLUDGE (value);
1251 } 1277 }
1252 else if (radio_box) 1278 else if (radio_box)
1253 { 1279 {
1254 Widget radio_butt; 1280 Widget radio_butt;
1255 ac = 0; 1281 ac = 0;
1256 Xt_SET_ARG(al[ac], XmNmarginWidth, 0); ac++; 1282 XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
1257 Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; 1283 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
1258 Xt_SET_ARG(al[ac], XmNspacing, 13); ac++; 1284 XtSetArg(al[ac], XmNspacing, 13); ac++;
1259 Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; 1285 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
1260 Xt_SET_ARG(al[ac], XmNorientation, XmHORIZONTAL); ac++; 1286 XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
1261 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1287 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1262 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1288 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1263 Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; 1289 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1264 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; 1290 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1265 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1291 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1266 Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; 1292 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1267 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1293 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1268 Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; 1294 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1269 value = XmCreateRadioBox (form, "radiobutton1", al, ac); 1295 value = XmCreateRadioBox (form, "radiobutton1", al, ac);
1270 ac = 0; 1296 ac = 0;
1271 i = 0; 1297 i = 0;
1272 radio_butt = XmCreateToggleButtonGadget (value, "radio1", al, ac); 1298 radio_butt = XmCreateToggleButtonGadget (value, "radio1", al, ac);
1273 children [i++] = radio_butt; 1299 children [i++] = radio_butt;
1278 XtManageChildren (children, i); 1304 XtManageChildren (children, i);
1279 } 1305 }
1280 else if (list) 1306 else if (list)
1281 { 1307 {
1282 ac = 0; 1308 ac = 0;
1283 Xt_SET_ARG(al[ac], XmNvisibleItemCount, 5); ac++; 1309 XtSetArg(al[ac], XmNvisibleItemCount, 5); ac++;
1284 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; 1310 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1285 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1311 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1286 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1312 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1287 Xt_SET_ARG(al[ac], XmNbottomWidget, separator); ac++; 1313 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1288 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; 1314 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1289 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1315 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1290 Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; 1316 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1291 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1317 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1292 Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; 1318 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1293 value = XmCreateScrolledList (form, "list", al, ac); 1319 value = XmCreateScrolledList (form, "list", al, ac);
1294 1320
1295 /* this is the easiest way I found to have the double click in the 1321 /* this is the easiest way I found to have the double click in the
1296 list activate the default button */ 1322 list activate the default button */
1297 XtAddCallback (value, XmNdefaultActionCallback, activate_button, button); 1323 XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
1298 } 1324 }
1299 /* else add nothing; it's a separator */ 1325 /* else add nothing; it's a separator */
1300 1326
1301 ac = 0; 1327 ac = 0;
1302 Xt_SET_ARG(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1328 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1303 Xt_SET_ARG(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; 1329 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
1304 Xt_SET_ARG(al[ac], XmNtopOffset, 13); ac++; 1330 XtSetArg(al[ac], XmNtopOffset, 13); ac++;
1305 Xt_SET_ARG(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; 1331 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1306 Xt_SET_ARG(al[ac], XmNbottomOffset, 13); ac++; 1332 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1307 Xt_SET_ARG(al[ac], XmNbottomWidget, 1333 XtSetArg(al[ac], XmNbottomWidget,
1308 text_input_slot || radio_box || list ? value : separator); ac++; 1334 text_input_slot || radio_box || list ? value : separator); ac++;
1309 Xt_SET_ARG(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; 1335 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1310 Xt_SET_ARG(al[ac], XmNleftOffset, 13); ac++; 1336 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1311 Xt_SET_ARG(al[ac], XmNleftWidget, icon); ac++; 1337 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1312 Xt_SET_ARG(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1338 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1313 Xt_SET_ARG(al[ac], XmNrightOffset, 13); ac++; 1339 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1314 message = XmCreateLabel (form, "message", al, ac); 1340 message = XmCreateLabel (form, "message", al, ac);
1315 DO_DND_KLUDGE (message); 1341 DO_DND_KLUDGE (message);
1316 1342
1317 if (list) 1343 if (list)
1318 XtManageChild (value); 1344 XtManageChild (value);
1399 Dimension child_height = 0; 1425 Dimension child_height = 0;
1400 Position x; 1426 Position x;
1401 Position y; 1427 Position y;
1402 Arg al [2]; 1428 Arg al [2];
1403 1429
1404 Xt_SET_ARG (al [0], XtNwidth, &child_width); 1430 XtSetArg (al [0], XtNwidth, &child_width);
1405 Xt_SET_ARG (al [1], XtNheight, &child_height); 1431 XtSetArg (al [1], XtNheight, &child_height);
1406 XtGetValues (widget, al, 2); 1432 XtGetValues (widget, al, 2);
1407 1433
1408 Xt_SET_ARG (al [0], XtNwidth, &parent_width); 1434 XtSetArg (al [0], XtNwidth, &parent_width);
1409 Xt_SET_ARG (al [1], XtNheight, &parent_height); 1435 XtSetArg (al [1], XtNheight, &parent_height);
1410 XtGetValues (parent, al, 2); 1436 XtGetValues (parent, al, 2);
1411 1437
1412 x = (Position) ((parent_width - child_width) / 2); 1438 x = (Position) ((parent_width - child_width) / 2);
1413 y = (Position) ((parent_height - child_height) / 2); 1439 y = (Position) ((parent_height - child_height) / 2);
1414 1440
1422 if ((Dimension) (y + child_height) > screen_height) 1448 if ((Dimension) (y + child_height) > screen_height)
1423 y = screen_height - child_height; 1449 y = screen_height - child_height;
1424 if (y < 0) 1450 if (y < 0)
1425 y = 0; 1451 y = 0;
1426 1452
1427 Xt_SET_ARG (al [0], XtNx, x); 1453 XtSetArg (al [0], XtNx, x);
1428 Xt_SET_ARG (al [1], XtNy, y); 1454 XtSetArg (al [1], XtNy, y);
1429 XtSetValues (widget, al, 2); 1455 XtSetValues (widget, al, 2);
1430 } 1456 }
1431 1457
1432 static Widget 1458 static Widget
1433 recycle_instance (destroyed_instance* instance) 1459 recycle_instance (destroyed_instance* instance)
1456 /* shrink the separator label back to their original size */ 1482 /* shrink the separator label back to their original size */
1457 separator = XtNameToWidget (widget, "*separator_button"); 1483 separator = XtNameToWidget (widget, "*separator_button");
1458 if (separator) 1484 if (separator)
1459 { 1485 {
1460 Arg al [2]; 1486 Arg al [2];
1461 Xt_SET_ARG (al [0], XtNwidth, 5); 1487 XtSetArg (al [0], XtNwidth, 5);
1462 Xt_SET_ARG (al [1], XtNheight, 5); 1488 XtSetArg (al [1], XtNheight, 5);
1463 XtSetValues (separator, al, 2); 1489 XtSetValues (separator, al, 2);
1464 } 1490 }
1465 1491
1466 /* Center the dialog in its parent */ 1492 /* Center the dialog in its parent */
1467 recenter_widget (widget); 1493 recenter_widget (widget);
1553 make_menubar (widget_instance* instance) 1579 make_menubar (widget_instance* instance)
1554 { 1580 {
1555 Arg al[10]; 1581 Arg al[10];
1556 int ac = 0; 1582 int ac = 0;
1557 1583
1558 Xt_SET_ARG(al[ac], XmNmarginHeight, 0); ac++; 1584 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
1559 Xt_SET_ARG(al[ac], XmNshadowThickness, 3); ac++; 1585 XtSetArg(al[ac], XmNshadowThickness, 3); ac++;
1560 1586
1561 return XmCreateMenuBar (instance->parent, instance->info->name, al, ac); 1587 return XmCreateMenuBar (instance->parent, instance->info->name, al, ac);
1562 } 1588 }
1563 1589
1564 static void 1590 static void
1594 static XtCallbackRec callbacks[2] = 1620 static XtCallbackRec callbacks[2] =
1595 { {xm_scrollbar_callback, NULL}, {NULL, NULL} }; 1621 { {xm_scrollbar_callback, NULL}, {NULL, NULL} };
1596 1622
1597 callbacks[0].closure = (XtPointer) instance; 1623 callbacks[0].closure = (XtPointer) instance;
1598 1624
1599 Xt_SET_ARG (al[ac], XmNminimum, 1); ac++; 1625 XtSetArg (al[ac], XmNminimum, 1); ac++;
1600 Xt_SET_ARG (al[ac], XmNmaximum, INT_MAX); ac++; 1626 XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
1601 Xt_SET_ARG (al[ac], XmNincrement, 1); ac++; 1627 XtSetArg (al[ac], XmNincrement, 1); ac++;
1602 Xt_SET_ARG (al[ac], XmNpageIncrement, 1); ac++; 1628 XtSetArg (al[ac], XmNpageIncrement, 1); ac++;
1603 Xt_SET_ARG (al[ac], XmNborderWidth, 0); ac++; 1629 XtSetArg (al[ac], XmNborderWidth, 0); ac++;
1604 Xt_SET_ARG (al[ac], XmNorientation, 1630 XtSetArg (al[ac], XmNorientation, vertical ? XmVERTICAL : XmHORIZONTAL); ac++;
1605 vertical ? XmVERTICAL : XmHORIZONTAL); ac++; 1631
1606 1632 XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++;
1607 Xt_SET_ARG (al[ac], XmNdecrementCallback, callbacks); ac++; 1633 XtSetArg (al[ac], XmNdragCallback, callbacks); ac++;
1608 Xt_SET_ARG (al[ac], XmNdragCallback, callbacks); ac++; 1634 XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++;
1609 Xt_SET_ARG (al[ac], XmNincrementCallback, callbacks); ac++; 1635 XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++;
1610 Xt_SET_ARG (al[ac], XmNpageDecrementCallback, callbacks); ac++; 1636 XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++;
1611 Xt_SET_ARG (al[ac], XmNpageIncrementCallback, callbacks); ac++; 1637 XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++;
1612 Xt_SET_ARG (al[ac], XmNtoBottomCallback, callbacks); ac++; 1638 XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++;
1613 Xt_SET_ARG (al[ac], XmNtoTopCallback, callbacks); ac++; 1639 XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++;
1614 Xt_SET_ARG (al[ac], XmNvalueChangedCallback, callbacks); ac++;
1615 1640
1616 return XmCreateScrollBar (instance->parent, instance->info->name, al, ac); 1641 return XmCreateScrollBar (instance->parent, instance->info->name, al, ac);
1617 } 1642 }
1618 1643
1619 static Widget 1644 static Widget
1638 Arg al[20]; 1663 Arg al[20];
1639 int ac = 0; 1664 int ac = 0;
1640 Widget button = 0; 1665 Widget button = 0;
1641 widget_value* val = instance->info->val; 1666 widget_value* val = instance->info->val;
1642 1667
1643 Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; 1668 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1644 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1669 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1645 Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; 1670 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1646 Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1671 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1647 /* The highlight doesn't appear to be dynamically set which makes it 1672 /* The highlight doesn't appear to be dynamically set which makes it
1648 look ugly. I think this may be a LessTif bug but for now we just 1673 look ugly. I think this may be a LessTif bug but for now we just
1649 get rid of it. */ 1674 get rid of it. */
1650 Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; 1675 XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
1651 1676
1652 /* add any args the user supplied for creation time */ 1677 /* add any args the user supplied for creation time */
1653 lw_add_value_args_to_args (val, al, &ac); 1678 lw_add_value_args_to_args (val, al, &ac);
1654 1679
1655 if (!val->call_data) 1680 if (!val->call_data)
1656 button = XmCreateLabel (instance->parent, val->name, al, ac); 1681 button = XmCreateLabel (instance->parent, val->name, al, ac);
1657 1682
1658 else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE) 1683 else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
1659 { 1684 {
1660 Xt_SET_ARG (al [ac], XmNset, val->selected); ac++; 1685 XtSetArg (al [ac], XmNset, val->selected); ac++;
1661 Xt_SET_ARG (al [ac], XmNindicatorType, 1686 XtSetArg (al [ac], XmNindicatorType,
1662 (val->type == TOGGLE_TYPE ? 1687 (val->type == TOGGLE_TYPE ?
1663 XmN_OF_MANY : XmONE_OF_MANY)); ac++; 1688 XmN_OF_MANY : XmONE_OF_MANY)); ac++;
1664 Xt_SET_ARG (al [ac], XmNvisibleWhenOff, True); ac++; 1689 XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
1665 button = XmCreateToggleButton (instance->parent, val->name, al, ac); 1690 button = XmCreateToggleButton (instance->parent, val->name, al, ac);
1666 XtRemoveAllCallbacks (button, XmNvalueChangedCallback); 1691 XtRemoveAllCallbacks (button, XmNvalueChangedCallback);
1667 XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback, 1692 XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback,
1668 (XtPointer)instance); 1693 (XtPointer)instance);
1669 } 1694 }
1688 Dimension width = 0; 1713 Dimension width = 0;
1689 Widget scale = 0; 1714 Widget scale = 0;
1690 widget_value* val = instance->info->val; 1715 widget_value* val = instance->info->val;
1691 if (!val->call_data) 1716 if (!val->call_data)
1692 { 1717 {
1693 Xt_SET_ARG (al [ac], XmNeditable, False); ac++; 1718 XtSetArg (al [ac], XmNeditable, False); ac++;
1694 } 1719 }
1695 else 1720 else
1696 { 1721 {
1697 Xt_SET_ARG (al [ac], XmNeditable, val->enabled); ac++; 1722 XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
1698 } 1723 }
1699 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1724 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1700 Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; 1725 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1701 Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1726 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1702 Xt_SET_ARG (al [ac], XmNorientation, XmHORIZONTAL); ac++; 1727 XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++;
1703 /* The highlight doesn't appear to be dynamically set which makes it 1728 /* The highlight doesn't appear to be dynamically set which makes it
1704 look ugly. I think this may be a LessTif bug but for now we just 1729 look ugly. I think this may be a LessTif bug but for now we just
1705 get rid of it. */ 1730 get rid of it. */
1706 Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; 1731 XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
1707 1732
1708 height = (Dimension)lw_get_value_arg (val, XtNheight); 1733 height = (Dimension)lw_get_value_arg (val, XtNheight);
1709 width = (Dimension)lw_get_value_arg (val, XtNwidth); 1734 width = (Dimension)lw_get_value_arg (val, XtNwidth);
1710 if (height > 0) 1735 if (height > 0)
1711 { 1736 {
1712 Xt_SET_ARG (al [ac], XmNscaleHeight, height); ac++; 1737 XtSetArg (al [ac], XmNscaleHeight, height); ac++;
1713 } 1738 }
1714 if (width > 0) 1739 if (width > 0)
1715 { 1740 {
1716 Xt_SET_ARG (al [ac], XmNscaleWidth, width); ac++; 1741 XtSetArg (al [ac], XmNscaleWidth, width); ac++;
1717 } 1742 }
1718 1743
1719 /* add any args the user supplied for creation time */ 1744 /* add any args the user supplied for creation time */
1720 lw_add_value_args_to_args (val, al, &ac); 1745 lw_add_value_args_to_args (val, al, &ac);
1721 1746
1735 Arg al[20]; 1760 Arg al[20];
1736 int ac = 0; 1761 int ac = 0;
1737 Widget text = 0; 1762 Widget text = 0;
1738 widget_value* val = instance->info->val; 1763 widget_value* val = instance->info->val;
1739 1764
1740 Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; 1765 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1741 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1766 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1742 Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; 1767 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1743 Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1768 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1744 /* The highlight doesn't appear to be dynamically set which makes it 1769 /* The highlight doesn't appear to be dynamically set which makes it
1745 look ugly. I think this may be a LessTif bug but for now we just 1770 look ugly. I think this may be a LessTif bug but for now we just
1746 get rid of it. */ 1771 get rid of it. */
1747 Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; 1772 XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
1748 1773
1749 /* add any args the user supplied for creation time */ 1774 /* add any args the user supplied for creation time */
1750 lw_add_value_args_to_args (val, al, &ac); 1775 lw_add_value_args_to_args (val, al, &ac);
1751 1776
1752 text = XmCreateTextField (instance->parent, val->name, al, ac); 1777 text = XmCreateTextField (instance->parent, val->name, al, ac);
1770 { 1795 {
1771 Arg al[20]; 1796 Arg al[20];
1772 int ac = 0; 1797 int ac = 0;
1773 Widget label = 0; 1798 Widget label = 0;
1774 1799
1775 Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; 1800 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1776 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1801 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1777 Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1802 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1778 /* The highlight doesn't appear to be dynamically set which makes it 1803 /* The highlight doesn't appear to be dynamically set which makes it
1779 look ugly. I think this may be a LessTif bug but for now we just 1804 look ugly. I think this may be a LessTif bug but for now we just
1780 get rid of it. */ 1805 get rid of it. */
1781 Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; 1806 XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
1782 1807
1783 /* add any args the user supplied for creation time */ 1808 /* add any args the user supplied for creation time */
1784 lw_add_value_args_to_args (val, al, &ac); 1809 lw_add_value_args_to_args (val, al, &ac);
1785 1810
1786 label = XmCreateLabel (parent, val->name, al, ac); 1811 label = XmCreateLabel (parent, val->name, al, ac);
1802 Arg al[20]; 1827 Arg al[20];
1803 int ac = 0; 1828 int ac = 0;
1804 Widget combo = 0; 1829 Widget combo = 0;
1805 widget_value* val = instance->info->val; 1830 widget_value* val = instance->info->val;
1806 1831
1807 Xt_SET_ARG (al [ac], XmNsensitive, val->enabled); ac++; 1832 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1808 Xt_SET_ARG (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1833 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1809 Xt_SET_ARG (al [ac], XmNuserData, val->call_data); ac++; 1834 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1810 Xt_SET_ARG (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1835 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1811 /* The highlight doesn't appear to be dynamically set which makes it 1836 /* The highlight doesn't appear to be dynamically set which makes it
1812 look ugly. I think this may be a LessTif bug but for now we just 1837 look ugly. I think this may be a LessTif bug but for now we just
1813 get rid of it. */ 1838 get rid of it. */
1814 Xt_SET_ARG (al [ac], XmNhighlightThickness, (Dimension)0); ac++; 1839 XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
1815 1840
1816 /* add any args the user supplied for creation time */ 1841 /* add any args the user supplied for creation time */
1817 lw_add_value_args_to_args (val, al, &ac); 1842 lw_add_value_args_to_args (val, al, &ac);
1818 1843
1819 combo = XmCreateDropDownComboBox (instance->parent, val->name, al, ac); 1844 combo = XmCreateDropDownComboBox (instance->parent, val->name, al, ac);
1917 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>"; 1942 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>";
1918 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>"; 1943 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>";
1919 if (trans) 1944 if (trans)
1920 { 1945 {
1921 Arg al [1]; 1946 Arg al [1];
1922 Xt_SET_ARG (al [0], XmNmenuPost, trans); 1947 XtSetArg (al [0], XmNmenuPost, trans);
1923 XtSetValues (widget, al, 1); 1948 XtSetValues (widget, al, 1);
1924 } 1949 }
1925 XmMenuPosition (widget, (XButtonPressedEvent *) event); 1950 XmMenuPosition (widget, (XButtonPressedEvent *) event);
1926 } 1951 }
1927 XtManageChild (widget); 1952 XtManageChild (widget);
1936 { 1961 {
1937 short width; 1962 short width;
1938 short height; 1963 short height;
1939 Arg al [2]; 1964 Arg al [2];
1940 1965
1941 Xt_SET_ARG (al [0], XmNwidth, &width); 1966 XtSetArg (al [0], XmNwidth, &width);
1942 Xt_SET_ARG (al [1], XmNheight, &height); 1967 XtSetArg (al [1], XmNheight, &height);
1943 XtGetValues (w, al, 2); 1968 XtGetValues (w, al, 2);
1944 1969
1945 Xt_SET_ARG (al [0], XmNminWidth, width); 1970 XtSetArg (al [0], XmNminWidth, width);
1946 Xt_SET_ARG (al [1], XmNminHeight, height); 1971 XtSetArg (al [1], XmNminHeight, height);
1947 XtSetValues (w, al, 2); 1972 XtSetValues (w, al, 2);
1948 } 1973 }
1949 1974
1950 #endif 1975 #endif
1951 1976
1987 { 2012 {
1988 XtPointer user_data; 2013 XtPointer user_data;
1989 widget_instance* instance = (widget_instance*)closure; 2014 widget_instance* instance = (widget_instance*)closure;
1990 Widget instance_widget; 2015 Widget instance_widget;
1991 LWLIB_ID id; 2016 LWLIB_ID id;
2017 Arg al [1];
1992 2018
1993 if (!instance) 2019 if (!instance)
1994 return; 2020 return;
1995 if (widget->core.being_destroyed) 2021 if (widget->core.being_destroyed)
1996 return; 2022 return;
1999 if (!instance_widget) 2025 if (!instance_widget)
2000 return; 2026 return;
2001 2027
2002 id = instance->info->id; 2028 id = instance->info->id;
2003 user_data = NULL; 2029 user_data = NULL;
2004 Xt_GET_VALUE (widget, XmNuserData, &user_data); 2030 XtSetArg(al [0], XmNuserData, &user_data);
2031 XtGetValues (widget, al, 1);
2005 switch (type) 2032 switch (type)
2006 { 2033 {
2007 case pre_activate: 2034 case pre_activate:
2008 if (instance->info->pre_activate_cb) 2035 if (instance->info->pre_activate_cb)
2009 instance->info->pre_activate_cb (widget, id, user_data); 2036 instance->info->pre_activate_cb (widget, id, user_data);
2051 should change. Yuck but correct. */ 2078 should change. Yuck but correct. */
2052 if (XtClass (widget) == xmToggleButtonWidgetClass 2079 if (XtClass (widget) == xmToggleButtonWidgetClass
2053 || XtClass (widget) == xmToggleButtonGadgetClass) 2080 || XtClass (widget) == xmToggleButtonGadgetClass)
2054 { 2081 {
2055 Boolean check; 2082 Boolean check;
2056 2083 Arg al [1];
2057 Xt_GET_VALUE (widget, XmNset, &check); 2084
2058 Xt_SET_VALUE (widget, XmNset, !check); 2085 XtSetArg (al [0], XmNset, &check);
2086 XtGetValues (widget, al, 1);
2087
2088 XtSetArg (al [0], XmNset, !check);
2089 XtSetValues (widget, al, 1);
2059 } 2090 }
2060 #endif 2091 #endif
2061 lw_internal_update_other_instances (widget, closure, call_data); 2092 lw_internal_update_other_instances (widget, closure, call_data);
2062 do_call (widget, closure, selection); 2093 do_call (widget, closure, selection);
2063 } 2094 }