diff options
author | hobbs <hobbs> | 2001-08-29 23:22:24 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-08-29 23:22:24 (GMT) |
commit | e3a110a35f440dc46497f8855d741f173ed1caab (patch) | |
tree | b404a0f0e067dd1a6d688e026ad74d4ead531b81 /generic/tkFrame.c | |
parent | 55991e0edd4f43e955b9087fa9a0f94752aecac7 (diff) | |
download | tk-e3a110a35f440dc46497f8855d741f173ed1caab.zip tk-e3a110a35f440dc46497f8855d741f173ed1caab.tar.gz tk-e3a110a35f440dc46497f8855d741f173ed1caab.tar.bz2 |
* tests/config.test: added config-14.1 to test namespace import
evaluation of widgets.
* generic/tkButton.c (ButtonCreate):
* generic/tkFrame.c (CreateFrame):
* generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
* generic/tkPlace.c (Tk_PlaceObjCmd):
* generic/tkScale.c (Tk_ScaleObjCmd):
* generic/tkMessage.c (Tk_MessageObjCmd):
* generic/tkEntry.c (Tk_EntryObjCmd, Tk_SpinboxObjCmd):
* generic/tkSquare.c (SquareObjCmd): redid the handling of
optionTables in widgets to allow them to be imported into other
namespaces. [Bug #456632]
Diffstat (limited to 'generic/tkFrame.c')
-rw-r--r-- | generic/tkFrame.c | 67 |
1 files changed, 20 insertions, 47 deletions
diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 6b70e62..9c6f84b 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.8 2001/05/28 16:56:02 pspjuth Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.9 2001/08/29 23:22:24 hobbs Exp $ */ #include "default.h" @@ -309,7 +309,7 @@ TkCreateFrame(clientData, interp, argc, argv, toplevel, appName) static int CreateFrame(clientData, interp, objc, objv, type, appName) - ClientData clientData; /* Either NULL or pointer to option table. */ + ClientData clientData; /* NULL. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ @@ -330,31 +330,19 @@ CreateFrame(clientData, interp, objc, objv, type, appName) Colormap colormap; Visual *visual; - optionTable = (Tk_OptionTable) clientData; - if (optionTable == NULL) { - Tcl_CmdInfo info; - char *name; - - /* - * We haven't created the option table for this widget class - * yet. Do it now and save the table as the clientData for - * the command, so we'll have access to it in future - * invocations of the command. - */ - - optionTable = Tk_CreateOptionTable(interp, optionSpecs[type]); - name = Tcl_GetString(objv[0]); - Tcl_GetCommandInfo(interp, name, &info); - info.objClientData = (ClientData) optionTable; - Tcl_SetCommandInfo(interp, name, &info); - } - if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?"); return TCL_ERROR; } /* + * Create the option table for this widget class. If it has already + * been created, the cached pointer will be returned. + */ + + optionTable = Tk_CreateOptionTable(interp, optionSpecs[type]); + + /* * Pre-process the argument list. Scan through it to find any * "-class", "-screen", "-visual", and "-colormap" options. These * arguments need to be processed specially, before the window @@ -482,34 +470,19 @@ CreateFrame(clientData, interp, objc, objv, type, appName) * in the widget record from the special options. */ - framePtr = (Frame *) ckalloc(sizeof(Frame)); - framePtr->tkwin = new; - framePtr->display = Tk_Display(new); - framePtr->interp = interp; - framePtr->widgetCmd = Tcl_CreateObjCommand(interp, + framePtr = (Frame *) ckalloc(sizeof(Frame)); + memset((void *) framePtr, 0, (sizeof(Frame))); + framePtr->tkwin = new; + framePtr->display = Tk_Display(new); + framePtr->interp = interp; + framePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(new), FrameWidgetObjCmd, (ClientData) framePtr, FrameCmdDeletedProc); - framePtr->optionTable = optionTable; - framePtr->className = NULL; - framePtr->type = type; - framePtr->screenName = NULL; - framePtr->visualName = NULL; - framePtr->colormapName = NULL; - framePtr->menuName = NULL; - framePtr->colormap = colormap; - framePtr->border = NULL; - framePtr->borderWidth = 0; - framePtr->relief = TK_RELIEF_FLAT; - framePtr->highlightWidth = 0; - framePtr->highlightBgColorPtr = NULL; - framePtr->highlightColorPtr = NULL; - framePtr->width = 0; - framePtr->height = 0; - framePtr->cursor = None; - framePtr->takeFocus = NULL; - framePtr->isContainer = 0; - framePtr->useThis = NULL; - framePtr->flags = 0; + framePtr->optionTable = optionTable; + framePtr->type = type; + framePtr->colormap = colormap; + framePtr->relief = TK_RELIEF_FLAT; + framePtr->cursor = None; /* * Store backreference to frame widget in window structure. |