comparison lwlib/lwlib-Xm.c @ 4521:383ab474a241

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