SetSel.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright Massachusetts Institute of Technology 1985 */
  2. #include "copyright.h"
  3. /*
  4. * XMenu: MIT Project Athena, X Window system menu package
  5. *
  6. * XMenuSetSelection - Set a menu selection to be active or inactive.
  7. *
  8. * Author: Tony Della Fera, DEC
  9. * August, 1985
  10. *
  11. */
  12. #include "XMenuInt.h"
  13. int
  14. XMenuSetSelection(menu, p_num, s_num, active)
  15. register XMenu *menu; /* Menu object to be modified. */
  16. register int p_num; /* Pane number to be modified. */
  17. register int s_num; /* Selection number to modified. */
  18. int active; /* Make selection active? */
  19. {
  20. register XMPane *p_ptr; /* XMPane pointer. */
  21. register XMSelect *s_ptr; /* XMSelect pointer. */
  22. /*
  23. * Find the right pane.
  24. */
  25. p_ptr = _XMGetPanePtr(menu, p_num);
  26. if (p_ptr == NULL) return(XM_FAILURE);
  27. /*
  28. * Find the right selection.
  29. */
  30. s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
  31. if (s_ptr == NULL) return(XM_FAILURE);
  32. /*
  33. * Set its active switch.
  34. */
  35. s_ptr->active = active;
  36. /*
  37. * Return the selection number just set.
  38. */
  39. _XMErrorCode = XME_NO_ERROR;
  40. return(s_num);
  41. }
  42. /* arch-tag: 79198ae0-c5a4-4d31-adb0-5747f833f56a
  43. (do not change this comment) */