Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xm.c @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 6b37e6ddd302 |
children | 5a88923fcbfe |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
333 /* update of buttons */ | 333 /* update of buttons */ |
334 static void | 334 static void |
335 xm_update_pushbutton (widget_instance* instance, Widget widget, | 335 xm_update_pushbutton (widget_instance* instance, Widget widget, |
336 widget_value* val) | 336 widget_value* val) |
337 { | 337 { |
338 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, 0); | 338 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL); |
339 XtRemoveAllCallbacks (widget, XmNactivateCallback); | 339 XtRemoveAllCallbacks (widget, XmNactivateCallback); |
340 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); | 340 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); |
341 } | 341 } |
342 | 342 |
343 #ifdef MENUBARS_MOTIF | 343 #ifdef MENUBARS_MOTIF |
381 #else | 381 #else |
382 XtAddCallback (widget, XmNvalueChangedCallback, | 382 XtAddCallback (widget, XmNvalueChangedCallback, |
383 xm_internal_update_other_instances, instance); | 383 xm_internal_update_other_instances, instance); |
384 #endif | 384 #endif |
385 XtVaSetValues (widget, XmNset, val->selected, | 385 XtVaSetValues (widget, XmNset, val->selected, |
386 XmNalignment, XmALIGNMENT_BEGINNING, 0); | 386 XmNalignment, XmALIGNMENT_BEGINNING, NULL); |
387 } | 387 } |
388 | 388 |
389 static void | 389 static void |
390 xm_update_radiobox (widget_instance* instance, Widget widget, | 390 xm_update_radiobox (widget_instance* instance, Widget widget, |
391 widget_value* val) | 391 widget_value* val) |
406 for (cur = val->contents; cur; cur = cur->next) | 406 for (cur = val->contents; cur; cur = cur->next) |
407 { | 407 { |
408 toggle = XtNameToWidget (widget, cur->value); | 408 toggle = XtNameToWidget (widget, cur->value); |
409 if (toggle) | 409 if (toggle) |
410 { | 410 { |
411 XtVaSetValues (toggle, XmNsensitive, cur->enabled, 0); | 411 XtVaSetValues (toggle, XmNsensitive, cur->enabled, NULL); |
412 if (!val->value && cur->selected) | 412 if (!val->value && cur->selected) |
413 XtVaSetValues (toggle, XmNset, cur->selected, 0); | 413 XtVaSetValues (toggle, XmNset, cur->selected, NULL); |
414 if (val->value && strcmp (val->value, cur->value)) | 414 if (val->value && strcmp (val->value, cur->value)) |
415 XtVaSetValues (toggle, XmNset, False, 0); | 415 XtVaSetValues (toggle, XmNset, False, NULL); |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 /* The selected was specified by the value slot */ | 419 /* The selected was specified by the value slot */ |
420 if (val->value) | 420 if (val->value) |
421 { | 421 { |
422 toggle = XtNameToWidget (widget, val->value); | 422 toggle = XtNameToWidget (widget, val->value); |
423 if (toggle) | 423 if (toggle) |
424 XtVaSetValues (toggle, XmNset, True, 0); | 424 XtVaSetValues (toggle, XmNset, True, NULL); |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 #ifdef MENUBARS_MOTIF | 428 #ifdef MENUBARS_MOTIF |
429 | 429 |
566 /* update the sensitivity and userdata */ | 566 /* update the sensitivity and userdata */ |
567 /* Common to all widget types */ | 567 /* Common to all widget types */ |
568 XtVaSetValues (widget, | 568 XtVaSetValues (widget, |
569 XmNsensitive, val->enabled, | 569 XmNsensitive, val->enabled, |
570 XmNuserData, val->call_data, | 570 XmNuserData, val->call_data, |
571 0); | 571 NULL); |
572 | 572 |
573 /* update the menu button as a label. */ | 573 /* update the menu button as a label. */ |
574 if (val->change >= VISIBLE_CHANGE) | 574 if (val->change >= VISIBLE_CHANGE) |
575 { | 575 { |
576 xm_update_label (instance, widget, val); | 576 xm_update_label (instance, widget, val); |
720 XtVaSetValues (widget, | 720 XtVaSetValues (widget, |
721 XtNx, data->scrollbar_x, | 721 XtNx, data->scrollbar_x, |
722 XtNy, data->scrollbar_y, | 722 XtNy, data->scrollbar_y, |
723 XtNwidth, data->scrollbar_width, | 723 XtNwidth, data->scrollbar_width, |
724 XtNheight, data->scrollbar_height, | 724 XtNheight, data->scrollbar_height, |
725 0); | 725 NULL); |
726 | 726 |
727 /* | 727 /* |
728 * Now the size the scrollbar's slider. | 728 * Now the size the scrollbar's slider. |
729 */ | 729 */ |
730 | 730 |
731 XtVaGetValues (widget, | 731 XtVaGetValues (widget, |
732 XmNsliderSize, &widget_sliderSize, | 732 XmNsliderSize, &widget_sliderSize, |
733 XmNvalue, &widget_val, | 733 XmNvalue, &widget_val, |
734 0); | 734 NULL); |
735 | 735 |
736 percent = (double) data->slider_size / | 736 percent = (double) data->slider_size / |
737 (double) (data->maximum - data->minimum); | 737 (double) (data->maximum - data->minimum); |
738 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent); | 738 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent); |
739 | 739 |
788 | 788 |
789 /* Common to all widget types */ | 789 /* Common to all widget types */ |
790 XtVaSetValues (widget, | 790 XtVaSetValues (widget, |
791 XmNsensitive, val->enabled, | 791 XmNsensitive, val->enabled, |
792 XmNuserData, val->call_data, | 792 XmNuserData, val->call_data, |
793 0); | 793 NULL); |
794 | 794 |
795 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF) | 795 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF) |
796 /* Common to all label like widgets */ | 796 /* Common to all label like widgets */ |
797 if (XtIsSubclass (widget, xmLabelWidgetClass)) | 797 if (XtIsSubclass (widget, xmLabelWidgetClass)) |
798 xm_update_label (instance, widget, val); | 798 xm_update_label (instance, widget, val); |
867 break; | 867 break; |
868 } | 868 } |
869 | 869 |
870 if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) | 870 if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) |
871 { | 871 { |
872 XtVaGetValues (widget, XmNset, &val->selected, 0); | 872 XtVaGetValues (widget, XmNset, &val->selected, NULL); |
873 val->edited = True; | 873 val->edited = True; |
874 } | 874 } |
875 #ifdef DIALOGS_MOTIF | 875 #ifdef DIALOGS_MOTIF |
876 else if (class == xmTextWidgetClass) | 876 else if (class == xmTextWidgetClass) |
877 { | 877 { |
901 for (i = 0; i < radio->composite.num_children; i++) | 901 for (i = 0; i < radio->composite.num_children; i++) |
902 { | 902 { |
903 int set = False; | 903 int set = False; |
904 Widget toggle = radio->composite.children [i]; | 904 Widget toggle = radio->composite.children [i]; |
905 | 905 |
906 XtVaGetValues (toggle, XmNset, &set, 0); | 906 XtVaGetValues (toggle, XmNset, &set, NULL); |
907 if (set) | 907 if (set) |
908 { | 908 { |
909 if (val->value) | 909 if (val->value) |
910 free (val->value); | 910 free (val->value); |
911 val->value = safe_strdup (XtName (toggle)); | 911 val->value = safe_strdup (XtName (toggle)); |
1346 Dimension child_width = 0; | 1346 Dimension child_width = 0; |
1347 Dimension child_height = 0; | 1347 Dimension child_height = 0; |
1348 Position x; | 1348 Position x; |
1349 Position y; | 1349 Position y; |
1350 | 1350 |
1351 XtVaGetValues (widget, XtNwidth, &child_width, XtNheight, &child_height, 0); | 1351 XtVaGetValues (widget, XtNwidth, &child_width, XtNheight, &child_height, NULL); |
1352 XtVaGetValues (parent, XtNwidth, &parent_width, XtNheight, &parent_height, | 1352 XtVaGetValues (parent, XtNwidth, &parent_width, XtNheight, &parent_height, |
1353 0); | 1353 NULL); |
1354 | 1354 |
1355 x = (((Position)parent_width) - ((Position)child_width)) / 2; | 1355 x = (((Position)parent_width) - ((Position)child_width)) / 2; |
1356 y = (((Position)parent_height) - ((Position)child_height)) / 2; | 1356 y = (((Position)parent_height) - ((Position)child_height)) / 2; |
1357 | 1357 |
1358 XtTranslateCoords (parent, x, y, &x, &y); | 1358 XtTranslateCoords (parent, x, y, &x, &y); |
1365 if ((Dimension) (y + child_height) > screen_height) | 1365 if ((Dimension) (y + child_height) > screen_height) |
1366 y = screen_height - child_height; | 1366 y = screen_height - child_height; |
1367 if (y < 0) | 1367 if (y < 0) |
1368 y = 0; | 1368 y = 0; |
1369 | 1369 |
1370 XtVaSetValues (widget, XtNx, x, XtNy, y, 0); | 1370 XtVaSetValues (widget, XtNx, x, XtNy, y, NULL); |
1371 } | 1371 } |
1372 | 1372 |
1373 static Widget | 1373 static Widget |
1374 recycle_instance (destroyed_instance* instance) | 1374 recycle_instance (destroyed_instance* instance) |
1375 { | 1375 { |
1395 XmProcessTraversal(focus, XmTRAVERSE_CURRENT); | 1395 XmProcessTraversal(focus, XmTRAVERSE_CURRENT); |
1396 | 1396 |
1397 /* shrink the separator label back to their original size */ | 1397 /* shrink the separator label back to their original size */ |
1398 separator = XtNameToWidget (widget, "*separator_button"); | 1398 separator = XtNameToWidget (widget, "*separator_button"); |
1399 if (separator) | 1399 if (separator) |
1400 XtVaSetValues (separator, XtNwidth, 5, XtNheight, 5, 0); | 1400 XtVaSetValues (separator, XtNwidth, 5, XtNheight, 5, NULL); |
1401 | 1401 |
1402 /* Center the dialog in its parent */ | 1402 /* Center the dialog in its parent */ |
1403 recenter_widget (widget); | 1403 recenter_widget (widget); |
1404 } | 1404 } |
1405 free_destroyed_instance (instance); | 1405 free_destroyed_instance (instance); |
1747 if (event->xbutton.state & Button5Mask) trans = "<Btn5Down>"; | 1747 if (event->xbutton.state & Button5Mask) trans = "<Btn5Down>"; |
1748 else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>"; | 1748 else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>"; |
1749 else if (event->xbutton.state & Button3Mask) trans = "<Btn3Down>"; | 1749 else if (event->xbutton.state & Button3Mask) trans = "<Btn3Down>"; |
1750 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>"; | 1750 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>"; |
1751 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>"; | 1751 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>"; |
1752 if (trans) XtVaSetValues (widget, XmNmenuPost, trans, 0); | 1752 if (trans) XtVaSetValues (widget, XmNmenuPost, trans, NULL); |
1753 XmMenuPosition (widget, (XButtonPressedEvent *) event); | 1753 XmMenuPosition (widget, (XButtonPressedEvent *) event); |
1754 } | 1754 } |
1755 XtManageChild (widget); | 1755 XtManageChild (widget); |
1756 } | 1756 } |
1757 | 1757 |
1762 static void | 1762 static void |
1763 set_min_dialog_size (Widget w) | 1763 set_min_dialog_size (Widget w) |
1764 { | 1764 { |
1765 short width; | 1765 short width; |
1766 short height; | 1766 short height; |
1767 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, 0); | 1767 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, NULL); |
1768 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, 0); | 1768 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, NULL); |
1769 } | 1769 } |
1770 | 1770 |
1771 #endif | 1771 #endif |
1772 | 1772 |
1773 void | 1773 void |
1872 should change. Yuck but correct. */ | 1872 should change. Yuck but correct. */ |
1873 if (XtClass (widget) == xmToggleButtonWidgetClass | 1873 if (XtClass (widget) == xmToggleButtonWidgetClass |
1874 || XtClass (widget) == xmToggleButtonGadgetClass) | 1874 || XtClass (widget) == xmToggleButtonGadgetClass) |
1875 { | 1875 { |
1876 Boolean check; | 1876 Boolean check; |
1877 XtVaGetValues (widget, XmNset, &check, 0); | 1877 XtVaGetValues (widget, XmNset, &check, NULL); |
1878 XtVaSetValues (widget, XmNset, !check, 0); | 1878 XtVaSetValues (widget, XmNset, !check, NULL); |
1879 } | 1879 } |
1880 #endif | 1880 #endif |
1881 lw_internal_update_other_instances (widget, closure, call_data); | 1881 lw_internal_update_other_instances (widget, closure, call_data); |
1882 do_call (widget, closure, selection); | 1882 do_call (widget, closure, selection); |
1883 } | 1883 } |