root/oldXMenu/Post.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. XMenuPost

     1 /* Copyright    Massachusetts Institute of Technology    1985   */
     2 
     3 /*
     4 
     5 Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
     6 
     7 Permission to use, copy, modify, and distribute this
     8 software and its documentation for any purpose and without
     9 fee is hereby granted, provided that the above copyright
    10 notice appear in all copies and that both that copyright
    11 notice and this permission notice appear in supporting
    12 documentation, and that the name of M.I.T. not be used in
    13 advertising or publicity pertaining to distribution of the
    14 software without specific, written prior permission.
    15 M.I.T. makes no representations about the suitability of
    16 this software for any purpose.  It is provided "as is"
    17 without express or implied warranty.
    18 
    19 */
    20 
    21 
    22 
    23 
    24 /*
    25  * XMenu:       MIT Project Athena, X Window system menu package
    26  *
    27  *      XMenuPost -     Maps a given menu to the display and activates
    28  *                      the menu for user selection.  The user is allowed to
    29  *                      specify the mouse button event mask that will be used
    30  *                      to identify a selection request.  When a selection
    31  *                      request is received (i.e., when the specified mouse
    32  *                      event occurs) the data  returned will be either the
    33  *                      data associated with the particular selection active
    34  *                      at the time of the selection request or NULL if no
    35  *                      selection was active.  A menu selection is shown to
    36  *                      be active by placing a highlight box around the
    37  *                      selection as the mouse cursor enters its active
    38  *                      region.  Inactive selections will not be highlighted.
    39  *                      As the mouse cursor moved from one menu pane
    40  *                      to another menu pane the pane being entered is raised
    41  *                      and activated and the pane being left is deactivated.
    42  *                      If an error occurs NULL will be returned with the
    43  *                      p_num set to POST_ERROR, s_num set to
    44  *                      NO_SELECTION and _XMErrorCode set to an
    45  *                      appropriate value.
    46  *                      Every time the routine returns successfully the
    47  *                      p_num and s_num indices will be set to indicate
    48  *                      the currently active pane and/or selection.  If the
    49  *                      mouse was not in a selection window at the time
    50  *                      s_num will be set to NO_SELECTION.
    51  *
    52  *      Author:         Tony Della Fera, DEC
    53  *                      August, 1984
    54  *
    55  */
    56 
    57 #include "XMenuInt.h"
    58 
    59 char *
    60 XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask)
    61                                 /* Previously opened display. */
    62                                 /* Menu to post. */
    63                                 /* Pane number selected. */
    64                                 /* Selection number selected. */
    65                                 /* X coordinate of menu position. */
    66                                 /* Y coordinate of menu position. */
    67                                 /* Mouse button event mask. */
    68 {
    69     register int stat;          /* Routine call return status. */
    70     char *data;                 /* Return data. */
    71 
    72     /*
    73      * Set up initial pane and selection assumptions.
    74      */
    75 
    76     /*
    77      * Make the procedure call.
    78      */
    79     stat = XMenuActivate(
    80                          display,
    81                          menu,
    82                          p_num, s_num,
    83                          x_pos, y_pos,
    84                          event_mask,
    85                          &data, 0);
    86 
    87     /*
    88      * Check the return value and return accordingly.
    89      */
    90     switch (stat) {
    91         case XM_FAILURE:
    92             *p_num = POST_ERROR;
    93             *s_num = NO_SELECTION;
    94             return(NULL);
    95         case XM_NO_SELECT:
    96         case XM_IA_SELECT:
    97             *s_num = NO_SELECTION;
    98             return(NULL);
    99         case XM_SUCCESS:
   100         default:
   101             return(data);
   102     }
   103 }
   104 

/* [<][>][^][v][top][bottom][index][help] */