summaryrefslogtreecommitdiffstats
path: root/generic/tkFrame.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-01-22 14:32:59 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-01-22 14:32:59 (GMT)
commit52da74a40ec7d58b961beb5f30fa40976bd71587 (patch)
treed36caa6a34005845deeb4fa8eb884defa7bafe80 /generic/tkFrame.c
parentb2bfe80a4f86bf9cd9235f5cd97e3de7181ec0e9 (diff)
downloadtk-52da74a40ec7d58b961beb5f30fa40976bd71587.zip
tk-52da74a40ec7d58b961beb5f30fa40976bd71587.tar.gz
tk-52da74a40ec7d58b961beb5f30fa40976bd71587.tar.bz2
* generic/tkImage.c (Tk_ImageObjCmd): Added check to make sure
that you're not creating an image named the same as .'s command, which refixes 220891, even when the name of the command has been changed with 'rename'. The error message is better too. * generic/tkFrame.c (TkToplevelWindowForCommand): Added way of mapping from command names to tkwins-for-toplevels. * tests/image.test (image-1.10,image-1.11): Updated to match new error message and added test for the rename case. * generic/tclInt.decls: Made TkToplevelWindowForCommand exported privately.
Diffstat (limited to 'generic/tkFrame.c')
-rw-r--r--generic/tkFrame.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 63e8245..f4f0a53 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFrame.c,v 1.14 2003/01/03 22:43:45 hobbs Exp $
+ * RCS: @(#) $Id: tkFrame.c,v 1.15 2003/01/22 14:32:59 dkf Exp $
*/
#include "default.h"
@@ -1933,3 +1933,45 @@ FrameLostSlaveProc(clientData, tkwin)
}
FrameWorldChanged((ClientData) framePtr);
}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkToplevelWindowFromCommandToken --
+ *
+ * If the given command name to the command for a toplevel window
+ * in the given interpreter, return the tkwin for that toplevel
+ * window. Note that this lookup can't be done using the
+ * standard tkwin internal table because the command might have
+ * been renamed.
+ *
+ * Results:
+ * A Tk_Window token, or NULL if the name does not refer to a
+ * toplevel window.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+Tk_Window
+TkToplevelWindowForCommand(interp, cmdName)
+ Tcl_Interp *interp;
+ CONST char *cmdName;
+{
+ Tcl_CmdInfo cmdInfo;
+ Frame *framePtr;
+
+ if (Tcl_GetCommandInfo(interp, cmdName, &cmdInfo) == 0) {
+ return NULL;
+ }
+ if (cmdInfo.objProc != FrameWidgetObjCmd) {
+ return NULL;
+ }
+ framePtr = (Frame *) cmdInfo.objClientData;
+ if (framePtr->type != TYPE_TOPLEVEL) {
+ return NULL;
+ }
+ return framePtr->tkwin;
+}