MCPcopy Create free account
hub / github.com/SimHacker/micropolis / PostSubmenu

Function PostSubmenu

micropolis-activity/src/tk/tkmenu.c:1978–2016  ·  view source on GitHub ↗
(interp, menuPtr, mePtr)

Source from the content-addressed store, hash-verified

1976 * This procedure arranges for a particular submenu (i.e. the
1977 * menu corresponding to a given cascade entry) to be
1978 * posted.
1979 *
1980 * Results:
1981 * A standard Tcl return result. Errors may occur in the
1982 * Tcl commands generated to post and unpost submenus.
1983 *
1984 * Side effects:
1985 * If there is already a submenu posted, it is unposted.
1986 * The new submenu is then posted.
1987 *
1988 *--------------------------------------------------------------
1989 */
1990
1991static int
1992PostSubmenu(interp, menuPtr, mePtr)
1993 Tcl_Interp *interp; /* Used for invoking sub-commands and
1994 * reporting errors. */
1995 register Menu *menuPtr; /* Information about menu as a whole. */
1996 register MenuEntry *mePtr; /* Info about submenu that is to be
1997 * posted. NULL means make sure that
1998 * no submenu is posted. */
1999{
2000 char string[30];
2001 int result, x, y;
2002
2003 if (mePtr == menuPtr->postedCascade) {
2004 return TCL_OK;
2005 }
2006
2007 if (menuPtr->postedCascade != NULL) {
2008 result = Tcl_VarEval(interp, menuPtr->postedCascade->name,
2009 " unpost", (char *) NULL);
2010 menuPtr->postedCascade = NULL;
2011 if (result != TCL_OK) {
2012 return result;
2013 }
2014 }
2015
2016 if ((mePtr != NULL) && (mePtr->name != NULL)) {
2017 Tk_GetRootCoords(menuPtr->tkwin, &x, &y);
2018 x += Tk_Width(menuPtr->tkwin);
2019 y += mePtr->y;

Callers 4

MenuWidgetCmdFunction · 0.85
DestroyMenuEntryFunction · 0.85
ConfigureMenuEntryFunction · 0.85
ActivateMenuEntryFunction · 0.85

Calls 2

Tk_GetRootCoordsFunction · 0.85
Tcl_VarEvalFunction · 0.50

Tested by

no test coverage detected