1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XMenuPost.c,v 10.5 86/02/01 16:15:27 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: /*
   7:  * XMenu:	MIT Project Athena, X Window system menu package
   8:  *
   9:  *	XMenuPost -	Maps a given menu to the display and activates
  10:  *			the menu for user selection.  The user is allowed to
  11:  *			specify the mouse button event mask that will be used
  12:  *			to identify a selection request.  When a selection
  13:  *			request is recieved (i.e., when the specified mouse
  14:  *			event occurs) the data  returned will be either the
  15:  *			data associated with the particular selection active
  16:  *			at the time of the selection request or NULL if no
  17:  *			selection was active.  A menu selection is shown to
  18:  *			be active by placing a highlight box around the
  19:  *			selection as the mouse cursor enters its active
  20:  *			region.  Inactive selections will not be highlighted.
  21:  *			As the mouse cursor moved from one menu pane
  22:  *			to another menu pane the pane being entered is raised
  23:  *			and activated and the pane being left is inactivated.
  24:  *			If an error occurs NULL will be returned with the
  25:  *			p_num set to POST_ERROR, s_num set to
  26:  *			NO_SELECTION and _XMErrorCode set to an
  27:  *			appropriate value.
  28:  *			Every time the routine returns successfully the
  29:  *			p_num and s_num indices will be set to indicate
  30:  *			the currently active pane and/or selection.  If the
  31:  *			mouse was not in a selection window at the time
  32:  *			s_num will be set to NO_SELECTION.
  33:  *
  34:  *	Author:		Tony Della Fera, DEC
  35:  *			August, 1984
  36:  *
  37:  */
  38: 
  39: #include "XMenuInternal.h"
  40: 
  41: char *
  42: XMenuPost(menu, p_num, s_num, x_pos, y_pos, event_mask)
  43:     register XMenu *menu;   /* Menu to post. */
  44:     register int *p_num;    /* Pane number selected. */
  45:     register int *s_num;    /* Selection number selected. */
  46:     register int x_pos;     /* X coordinate of menu position. */
  47:     register int y_pos;     /* Y coordinate of menu position. */
  48:     int event_mask;     /* Mouse button event mask. */
  49: {
  50:     register int stat;      /* Routine call return status. */
  51:     char *data;         /* Return data. */
  52: 
  53:     /*
  54:      * Set up initial pane and selection assumptions.
  55:      */
  56:     *p_num = 0;
  57:     *s_num = 0;
  58: 
  59:     /*
  60:      * Make the proceedure call.
  61:      */
  62:     stat = XMenuActivate(menu, p_num, s_num, x_pos, y_pos, event_mask, &data);
  63: 
  64:     /*
  65:      * Check the return value and return accordingly.
  66:      */
  67:     switch (stat) {
  68:     case XM_FAILURE:
  69:         *p_num = POST_ERROR;
  70:         *s_num = NO_SELECTION;
  71:         return(NULL);
  72:     case XM_NO_SELECT:
  73:     case XM_IA_SELECT:
  74:         *s_num = NO_SELECTION;
  75:         return(NULL);
  76:     case XM_SUCCESS:
  77:     default:
  78:         return(data);
  79:     }
  80: }

Defined functions

XMenuPost defined in line 41; used 1 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 876
Valid CSS Valid XHTML 1.0 Strict