summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-10-29 13:59:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-10-29 13:59:18 (GMT)
commit637ea03ab047c97e3a8e0c5ed58b010e8142874b (patch)
tree8ed0761ccc67000d150d6e1f472085cd6c52408d
parente4f9fece815b8121b9300c83a9697f2b2ea27e9f (diff)
downloadtk-637ea03ab047c97e3a8e0c5ed58b010e8142874b.zip
tk-637ea03ab047c97e3a8e0c5ed58b010e8142874b.tar.gz
tk-637ea03ab047c97e3a8e0c5ed58b010e8142874b.tar.bz2
Make "menu" a normal command, initialized like any other Tk command.
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkMenu.c42
-rw-r--r--generic/tkWindow.c3
3 files changed, 9 insertions, 40 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 933fa5e..b48647d 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1077,6 +1077,9 @@ MODULE_SCOPE int Tk_ListboxObjCmd(ClientData clientData,
MODULE_SCOPE int Tk_LowerObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
+MODULE_SCOPE int Tk_MenuObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
MODULE_SCOPE int Tk_MenubuttonObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -1148,7 +1151,6 @@ MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin,
MODULE_SCOPE void TkEventInit(void);
MODULE_SCOPE void TkRegisterObjTypes(void);
-MODULE_SCOPE int TkCreateMenuCmd(Tcl_Interp *interp);
MODULE_SCOPE int TkDeadAppCmd(ClientData clientData,
Tcl_Interp *interp, int argc, const char **argv);
MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp,
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 484352a..cd9ff08 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -353,8 +353,6 @@ static int MenuDoXPosition(Tcl_Interp *interp,
static int MenuAddOrInsert(Tcl_Interp *interp,
TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc,
Tcl_Obj *const objv[]);
-static int MenuCmd(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
static void MenuCmdDeletedProc(ClientData clientData);
static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, int index, int type);
static char * MenuVarProc(ClientData clientData,
@@ -385,37 +383,7 @@ static const Tk_ClassProcs menuClass = {
/*
*--------------------------------------------------------------
*
- * TkCreateMenuCmd --
- *
- * Called by Tk at initialization time to create the menu command.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * See the user documentation.
- *
- *--------------------------------------------------------------
- */
-
-int
-TkCreateMenuCmd(
- Tcl_Interp *interp) /* Interpreter we are creating the command
- * in. */
-{
- Tcl_CreateObjCommand(interp, "menu", MenuCmd, NULL, 0);
-
- if (Tcl_IsSafe(interp)) {
- Tcl_HideCommand(interp, "menu", "menu");
- }
-
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * MenuCmd --
+ * Tk_MenuObjCmd --
*
* This function is invoked to process the "menu" Tcl command. See the
* user documentation for details on what it does.
@@ -429,14 +397,14 @@ TkCreateMenuCmd(
*--------------------------------------------------------------
*/
-static int
-MenuCmd(
- ClientData clientData, /* Not used */
+int
+Tk_MenuObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window tkwin = Tk_MainWindow(interp);
+ Tk_Window tkwin = clientData;
Tk_Window newWin;
register TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 91806cf..6f5ee95 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -149,6 +149,7 @@ static const TkCmd commands[] = {
{"label", Tk_LabelObjCmd, ISSAFE},
{"labelframe", Tk_LabelframeObjCmd, ISSAFE},
{"listbox", Tk_ListboxObjCmd, ISSAFE},
+ {"menu", Tk_MenuObjCmd, PASSMAINWINDOW},
{"menubutton", Tk_MenubuttonObjCmd, ISSAFE},
{"message", Tk_MessageObjCmd, ISSAFE},
{"panedwindow", Tk_PanedWindowObjCmd, ISSAFE},
@@ -987,8 +988,6 @@ TkCreateMainWindow(
}
}
- TkCreateMenuCmd(interp);
-
/*
* Set variables for the intepreter.
*/