diff options
-rw-r--r-- | generic/tkMenu.c | 14 | ||||
-rw-r--r-- | generic/tkMenu.h | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 8 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 16 | ||||
-rw-r--r-- | win/tkWinMenu.c | 22 |
5 files changed, 32 insertions, 32 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c index e798337..2c0f9a9 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -870,10 +870,10 @@ MenuWidgetObjCmd( break; } case MENU_POST: { - int x, y, entry = -1; + int x, y, index = -1; if (objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "x y ?entry?"); + Tcl_WrongNumArgs(interp, 2, objv, "x y ?index?"); goto error; } if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) @@ -881,9 +881,9 @@ MenuWidgetObjCmd( goto error; } if (objc == 5) { - if (Tcl_GetIntFromObj(interp, objv[4], &entry) != TCL_OK) { - goto error; - } + if (TkGetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) { + goto error; + } } /* @@ -898,9 +898,9 @@ MenuWidgetObjCmd( Tcl_AppendResult(interp, "a menubar menu cannot be posted", NULL); return TCL_ERROR; } else if (menuPtr->menuType != TEAROFF_MENU) { - result = TkpPostMenu(interp, menuPtr, x, y, entry); + result = TkpPostMenu(interp, menuPtr, x, y, index); } else { - result = TkpPostTearoffMenu(interp, menuPtr, x, y, entry); + result = TkpPostTearoffMenu(interp, menuPtr, x, y, index); } break; } diff --git a/generic/tkMenu.h b/generic/tkMenu.h index 2c4e051..6d1fe5a 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -543,9 +543,9 @@ MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int entry); + int x, int y, int index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int entry); + int x, int y, int index); MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu *menuPtr); #endif /* _TKMENU */ diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 044b20c..1d3bd34 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -777,7 +777,7 @@ TkpPostMenu( int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ - int entry) + int index) { /* Get the object that holds this Tk Window.*/ Tk_Window root = Tk_MainWindow(interp); @@ -791,7 +791,7 @@ TkpPostMenu( NSView *view = [win contentView]; NSMenu *menu = (NSMenu *) menuPtr->platformData; NSMenuItem *item = nil; - NSInteger index = entry; + NSInteger index = index; NSPoint location = NSMakePoint(x, tkMacOSXZeroScreenHeight - y); int result, oldMode; @@ -823,9 +823,9 @@ TkpPostTearoffMenu( int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ - int entry) + int index) { - return TkpPostMenu(interp, menuPtr, x, y, entry); + return TkpPostMenu(interp, menuPtr, x, y, index); } /* diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index c5c83ce..d7ed873 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -907,9 +907,9 @@ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int entry) + int x, int y, int index) { - return TkpPostTearoffMenu(interp, menuPtr, x, y, entry); + return TkpPostTearoffMenu(interp, menuPtr, x, y, index); } /* @@ -919,7 +919,7 @@ TkpPostMenu( * * Posts a tearoff menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. - * If the entry parameter is negative, the upper left corner of the menu + * If the index parameter is negative, the upper left corner of the menu * itself is placed at the point. On unix this is called when posting * any menu. Adjusts the menu's position so that it fits on the screen, * and maps and raises the menu. @@ -937,17 +937,17 @@ int TkpPostTearoffMenu( Tcl_Interp *interp, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ - int x, int y, int entry) /* The root X,Y coordinates where the + int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; - if (entry >= menuPtr->numEntries) { - entry = menuPtr->numEntries - 1; + if (index >= menuPtr->numEntries) { + index = menuPtr->numEntries - 1; } - if (entry >= 0) { - y -= menuPtr->entries[entry]->y; + if (index >= 0) { + y -= menuPtr->entries[index]->y; } TkActivateMenuEntry(menuPtr, -1); diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index f1ac9b7..af127bf 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -761,7 +761,7 @@ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, - int x, int y, int entry) + int x, int y, int index) { HMENU winMenuHdl = (HMENU) menuPtr->platformData; int result, flags; @@ -781,11 +781,11 @@ TkpPostMenu( return result; } - if (entry >= menuPtr->numEntries) { - entry = menuPtr->numEntries - 1; + if (index >= menuPtr->numEntries) { + index = menuPtr->numEntries - 1; } - if (entry >= 0) { - y -= menuPtr->entries[entry]->y; + if (index >= 0) { + y -= menuPtr->entries[index]->y; } /* @@ -854,7 +854,7 @@ TkpPostMenu( * * Posts a tearoff menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. - * If the entry parameter is negative, the upper left corner of the menu + * If the index parameter is negative, the upper left corner of the menu * itself is placed at the point. Adjusts the menu's position so that it * fits on the screen, and maps and raises the menu. * @@ -871,17 +871,17 @@ int TkpPostTearoffMenu( Tcl_Interp *interp, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ - int x, int y, int entry) /* The root X,Y coordinates where we are + int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; - if (entry >= menuPtr->numEntries) { - entry = menuPtr->numEntries - 1; + if (index >= menuPtr->numEntries) { + index = menuPtr->numEntries - 1; } - if (entry >= 0) { - y -= menuPtr->entries[entry]->y; + if (index >= 0) { + y -= menuPtr->entries[index]->y; } TkActivateMenuEntry(menuPtr, -1); |