SimpleMenu.cpp
/*      Function Name: GetEventEntry
 *      Description: Gets an entry given an event that has X and Y coords.
 *      Arguments: w - the simple menu widget.
 *                 event - the event.
 *      Returns: the entry that this point is in.
 */
Function Name: GetEventEntry
Description: Gets an entry given an event that has X and Y coords.
Arguments: w - the simple menu widget.
event - the event.
Returns: the entry that this point is in.
Function Name : GetEventEntry Description : Gets an entry given an event that has X and Y coords . Arguments : w - the simple menu widget . event - the event . Returns : the entry that this point is in .
static SmeObject
GetEventEntry(Widget w, XEvent *event)
{
    Position x_loc = 0, y_loc = 0;
    SimpleMenuWidget smw = (SimpleMenuWidget) w;
    SmeObject * entry;
    switch (event->type) {
    case MotionNotify:
	x_loc = event->xmotion.x;
	y_loc = event->xmotion.y;
	break;
    case EnterNotify:
    case LeaveNotify:
	x_loc = event->xcrossing.x;
	y_loc = event->xcrossing.y;
	break;
    case ButtonPress:
    case ButtonRelease:
	x_loc = event->xbutton.x;
	y_loc = event->xbutton.y;
	break;
    default:
	XtAppError(XtWidgetToApplicationContext(w),
		   "Unknown event type in GetEventEntry().");
	break;
    }
    if ( (x_loc < 0) || (x_loc >= (int)smw->core.width) || (y_loc < 0) ||
	(y_loc >= (int)smw->core.height) )
	return(NULL);
    ForAllChildren(smw, entry) {
	if (!XtIsManaged ((Widget) *entry)) continue;
	if ( ((*entry)->rectangle.y < y_loc) &&
	    ((*entry)->rectangle.y + (int) (*entry)->rectangle.height > y_loc) )
	    if ( *entry == smw->simple_menu.label )
		return(NULL);	
	    else
		return(*entry);
    }
    return(NULL);
}
static SmeObject GetEventEntry ( Widget w , XEvent * event ) { Position x_loc = 0 , y_loc = 0 ; SimpleMenuWidget smw = ( SimpleMenuWidget ) w ; SmeObject * entry ; switch ( event -> type ) { case MotionNotify : x_loc = event -> xmotion . x ; y_loc = event -> xmotion . y ; break ; case EnterNotify : case LeaveNotify : x_loc = event -> xcrossing . x ; y_loc = event -> xcrossing . y ; break ; case ButtonPress : case ButtonRelease : x_loc = event -> xbutton . x ; y_loc = event -> xbutton . y ; break ; default : XtAppError ( XtWidgetToApplicationContext ( w ) , " " ) ; break ; } if ( ( x_loc < 0 ) || ( x_loc >= ( int ) smw -> core . width ) || ( y_loc < 0 ) || ( y_loc >= ( int ) smw -> core . height ) ) return ( NULL ) ; ForAllChildren ( smw , entry ) { if ( ! XtIsManaged ( ( Widget ) * entry ) ) continue ; if ( ( ( * entry ) -> rectangle . y < y_loc ) && ( ( * entry ) -> rectangle . y + ( int ) ( * entry ) -> rectangle . height > y_loc ) ) if ( * entry == smw -> simple_menu . label ) return ( NULL ) ; else return ( * entry ) ; } return ( NULL ) ; }
Function Name: GetEventEntry
      Description: Gets an entry given an event that has X and Y coords.
Function Name : GetEventEntry Description : Gets an entry given an event that has X and Y coords .
/* cannot select the label. */