diff options
author | chengyemao <chengyemao> | 2005-01-07 15:18:02 (GMT) |
---|---|---|
committer | chengyemao <chengyemao> | 2005-01-07 15:18:02 (GMT) |
commit | c763ca72e307a3c21c6221848e4e42f1dbefb3c7 (patch) | |
tree | 09f4bf18b0aef2a9c29eff89a45b4b08f67cc301 /win/tkWinWm.c | |
parent | 60e0fa23ae1d3b202486d2427812fa3e65ecdae2 (diff) | |
download | tk-c763ca72e307a3c21c6221848e4e42f1dbefb3c7.zip tk-c763ca72e307a3c21c6221848e4e42f1dbefb3c7.tar.gz tk-c763ca72e307a3c21c6221848e4e42f1dbefb3c7.tar.bz2 |
Implemented TK_STAT message to support {wm state} for embedded window
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r-- | win/tkWinWm.c | 67 |
1 files changed, 61 insertions, 6 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 3f0d4f8..7593863 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.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: tkWinWm.c,v 1.87 2005/01/04 02:09:46 chengyemao Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.88 2005/01/07 15:18:03 chengyemao Exp $ */ #include "tkWinInt.h" @@ -2204,6 +2204,7 @@ UpdateWrapper(winPtr) { SendMessage(wmPtr->wrapper, TK_GEOMETRYREQ, Tk_ReqWidth((Tk_Window)winPtr), Tk_ReqHeight((Tk_Window)winPtr)); + SendMessage(wmPtr->wrapper, TK_SETMENU, (WPARAM)wmPtr->hMenu, 0); } } @@ -2431,6 +2432,28 @@ TkpWmSetState(winPtr, state) } /* + *---------------------------------------------------------------------- + * + * TkpWinGetState -- + * + * This function returns state value of a toplevel window. + * + * Results: + * none + * + * Side effects: + * May deiconify the toplevel window. + * + *---------------------------------------------------------------------- + */ + +int TkpWmGetState(winPtr) + TkWindow *winPtr; +{ + return winPtr->wmInfoPtr->hints.initial_state; +} + +/* *-------------------------------------------------------------- * * TkWmDeadWindow -- @@ -4791,10 +4814,8 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv) (char *) NULL); return TCL_ERROR; } - if (winPtr->flags & TK_EMBEDDED) { - Tcl_AppendResult(interp, "can't change state of ", - winPtr->pathName, ": it is an embedded window", - (char *) NULL); + if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, + &index) != TCL_OK) { return TCL_ERROR; } @@ -4803,6 +4824,35 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv) return TCL_ERROR; } + if (winPtr->flags & TK_EMBEDDED) { + int state; + switch(index) { + case OPT_NORMAL: + state = NormalState; + break; + + case OPT_ICONIC: + state = IconicState; + break; + + case OPT_WITHDRAWN: + state = WithdrawnState; + break; + + case OPT_ZOOMED: + state = ZoomState; + break; + } + + if(state != SendMessage(wmPtr->wrapper, TK_STATE, state, 0)) { + Tcl_AppendResult(interp, "can't change state of ", + winPtr->pathName, ": it is an embedded window", + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; + } + if (index == OPT_NORMAL) { wmPtr->flags &= ~WM_WITHDRAWN; TkpWmSetState(winPtr, NormalState); @@ -4837,7 +4887,12 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv) if (wmPtr->iconFor != NULL) { Tcl_SetResult(interp, "icon", TCL_STATIC); } else { - switch (wmPtr->hints.initial_state) { + int state; + if(winPtr->flags & TK_EMBEDDED) + state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1); + else + state = wmPtr->hints.initial_state; + switch (state) { case NormalState: Tcl_SetResult(interp, "normal", TCL_STATIC); break; |