SimpleMenu.cpp
/*	Function Name: PositionMenu
 *	Description: Places the menu
 *	Arguments: w - the simple menu widget.
 *                 location - a pointer the the position or NULL.
 *	Returns: none.
 */
Function Name: PositionMenu
Description: Places the menu
Arguments: w - the simple menu widget.
location - a pointer the the position or NULL.
Returns: none.
Function Name : PositionMenu Description : Places the menu Arguments : w - the simple menu widget . location - a pointer the the position or NULL . Returns : none .
static void
PositionMenu(Widget w, XPoint *location)
{
    SimpleMenuWidget smw = (SimpleMenuWidget) w;
    SmeObject entry;
    XPoint t_point;
    if (location == NULL) {
	Window junk1, junk2;
	int root_x, root_y, junkX, junkY;
	unsigned int junkM;
	location = &t_point;
	if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, 
			  &root_x, &root_y, &junkX, &junkY, &junkM) == FALSE) {
	    char error_buf[BUFSIZ];
	    (void) sprintf(error_buf, "%s %s", "Xaw Simple Menu Widget:",
		    "Could not find location of mouse pointer");
	    XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
	    return;
	}
	location->x = (short) root_x;
	location->y = (short) root_y;
    }
    XtRealizeWidget(w);
    location->x -= (Position) w->core.width/2;
    if (smw->simple_menu.popup_entry == NULL)
	entry = smw->simple_menu.label;
    else
	entry = smw->simple_menu.popup_entry;
    if (entry != NULL)
	location->y -= entry->rectangle.y + entry->rectangle.height/2;
    MoveMenu(w, (Position) location->x, (Position) location->y);
}
static void PositionMenu ( Widget w , XPoint * location ) { SimpleMenuWidget smw = ( SimpleMenuWidget ) w ; SmeObject entry ; XPoint t_point ; if ( location == NULL ) { Window junk1 , junk2 ; int root_x , root_y , junkX , junkY ; unsigned int junkM ; location = & t_point ; if ( XQueryPointer ( XtDisplay ( w ) , XtWindow ( w ) , & junk1 , & junk2 , & root_x , & root_y , & junkX , & junkY , & junkM ) == FALSE ) { char error_buf [ BUFSIZ ] ; ( void ) sprintf ( error_buf , " " , " " , " " ) ; XtAppWarning ( XtWidgetToApplicationContext ( w ) , error_buf ) ; return ; } location -> x = ( short ) root_x ; location -> y = ( short ) root_y ; } XtRealizeWidget ( w ) ; location -> x -= ( Position ) w -> core . width / 2 ; if ( smw -> simple_menu . popup_entry == NULL ) entry = smw -> simple_menu . label ; else entry = smw -> simple_menu . popup_entry ; if ( entry != NULL ) location -> y -= entry -> rectangle . y + entry -> rectangle . height / 2 ; MoveMenu ( w , ( Position ) location -> x , ( Position ) location -> y ) ; }
Function Name: PositionMenu
      Description: Places the menu
      Arguments: w - the simple menu widget.
Function Name : PositionMenu Description : Places the menu Arguments : w - the simple menu widget .
/*
     * The width will not be correct unless it is realized.
     */