diff options
Diffstat (limited to 'generic/tkCmds.c')
-rw-r--r-- | generic/tkCmds.c | 217 |
1 files changed, 216 insertions, 1 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index ffa171f..34d383c 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCmds.c,v 1.10 1999/12/21 23:55:10 hobbs Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.11 2000/02/01 11:41:10 hobbs Exp $ */ #include "tkPort.h" @@ -1508,6 +1508,221 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv) return TCL_OK; } +#if 0 +/* + *---------------------------------------------------------------------- + * + * Tk_WmObjCmd -- + * + * This procedure is invoked to process the "wm" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tk_WmObjCmd(clientData, interp, objc, objv) + ClientData clientData; /* Main window associated with + * interpreter. */ + Tcl_Interp *interp; /* Current interpreter. */ + int objc; /* Number of arguments. */ + Tcl_Obj *CONST objv[]; /* Argument objects. */ +{ + Tk_Window tkwin; + TkWindow *winPtr; + + static char *optionStrings[] = { + "aspect", "client", "command", "deiconify", + "focusmodel", "frame", "geometry", "grid", + "group", "iconbitmap", "iconify", "iconmask", + "iconname", "iconposition", "iconwindow", "maxsize", + "minsize", "overrideredirect", "positionfrom", "protocol", + "resizable", "sizefrom", "state", "title", + "tracing", "transient", "withdraw", (char *) NULL + }; + enum options { + TKWM_ASPECT, TKWM_CLIENT, TKWM_COMMAND, TKWM_DEICONIFY, + TKWM_FOCUSMOD, TKWM_FRAME, TKWM_GEOMETRY, TKWM_GRID, + TKWM_GROUP, TKWM_ICONBMP, TKWM_ICONIFY, TKWM_ICONMASK, + TKWM_ICONNAME, TKWM_ICONPOS, TKWM_ICONWIN, TKWM_MAXSIZE, + TKWM_MINSIZE, TKWM_OVERRIDE, TKWM_POSFROM, TKWM_PROTOCOL, + TKWM_RESIZABLE, TKWM_SIZEFROM, TKWM_STATE, TKWM_TITLE, + TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW + }; + + tkwin = (Tk_Window) clientData; + + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?"); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, + &index) != TCL_OK) { + return TCL_ERROR; + } + + if (index == TKWM_TRACING) { + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + + if ((objc != 2) && (objc != 3)) { + Tcl_WrongNumArgs(interp, 1, objv, "tracing ?boolean?"); + return TCL_ERROR; + } + if (objc == 2) { + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(dispPtr->wmTracing)); + return TCL_OK; + } + return Tcl_GetBooleanFromObj(interp, objv[2], &dispPtr->wmTracing); + } + + if (objc < 3) { + Tcl_WrongNumArgs(interp, 2, objv, "window ?arg?"); + return TCL_ERROR; + } + + winPtr = (TkWindow *) Tk_NameToWindow(interp, + Tcl_GetString(objv[2]), tkwin); + if (winPtr == NULL) { + return TCL_ERROR; + } + if (!(winPtr->flags & TK_TOP_LEVEL)) { + Tcl_AppendResult(interp, "window \"", winPtr->pathName, + "\" isn't a top-level window", (char *) NULL); + return TCL_ERROR; + } + + switch ((enum options) index) { + case TKWM_ASPECT: { + TkpWmAspectCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_CLIENT: { + TkpWmClientCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_COMMAND: { + TkpWmCommandCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_DEICONIFY: { + TkpWmDeiconifyCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_FOCUSMOD: { + TkpWmFocusmodCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_FRAME: { + TkpWmFrameCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_GEOMETRY: { + TkpWmGeometryCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_GRID: { + TkpWmGridCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_GROUP: { + TkpWmGroupCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONBMP: { + TkpWmIconbitmapCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONIFY: { + TkpWmIconifyCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONMASK: { + TkpWmIconmaskCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONNAME: { + /* slight Unix variation */ + TkpWmIconnameCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONPOS: { + /* nearly same - 1 line more on Unix */ + TkpWmIconpositionCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_ICONWIN: { + TkpWmIconwindowCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_MAXSIZE: { + /* nearly same, win diffs */ + TkpWmMaxsizeCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_MINSIZE: { + /* nearly same, win diffs */ + TkpWmMinsizeCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_OVERRIDE: { + /* almost same */ + TkpWmOverrideCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_POSFROM: { + /* Equal across platforms */ + TkpWmPositionfromCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_PROTOCOL: { + /* Equal across platforms */ + TkpWmProtocolCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_RESIZABLE: { + /* almost same */ + TkpWmResizableCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_SIZEFROM: { + /* Equal across platforms */ + TkpWmSizefromCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_STATE: { + TkpWmStateCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_TITLE: { + TkpWmTitleCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_TRANSIENT: { + TkpWmTransientCmd(interp, tkwin, winPtr, objc, objv); + break; + } + case TKWM_WITHDRAW: { + TkpWmWithdrawCmd(interp, tkwin, winPtr, objc, objv); + break; + } + } + + updateGeom: + if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { + Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr); + wmPtr->flags |= WM_UPDATE_PENDING; + } + return TCL_OK; +} +#endif + /* *---------------------------------------------------------------------- * |