SetSel.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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(register XMenu *menu, register int p_num, register int s_num, int active)
  15. /* Menu object to be modified. */
  16. /* Pane number to be modified. */
  17. /* Selection number to modified. */
  18. /* 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. }