summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorchengyemao <chengyemao>2005-01-07 15:18:02 (GMT)
committerchengyemao <chengyemao>2005-01-07 15:18:02 (GMT)
commitc763ca72e307a3c21c6221848e4e42f1dbefb3c7 (patch)
tree09f4bf18b0aef2a9c29eff89a45b4b08f67cc301 /win
parent60e0fa23ae1d3b202486d2427812fa3e65ecdae2 (diff)
downloadtk-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')
-rw-r--r--win/tkWin.h3
-rw-r--r--win/tkWinEmbed.c14
-rw-r--r--win/tkWinWm.c67
-rw-r--r--win/tkWinX.c3
4 files changed, 78 insertions, 9 deletions
diff --git a/win/tkWin.h b/win/tkWin.h
index c8eca7f..6df0144 100644
--- a/win/tkWin.h
+++ b/win/tkWin.h
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWin.h,v 1.11 2004/12/28 08:45:31 chengyemao Exp $
+ * RCS: @(#) $Id: tkWin.h,v 1.12 2005/01/07 15:18:03 chengyemao Exp $
*/
#ifndef _TKWIN
@@ -49,6 +49,7 @@
#define TK_GETFRAMEWID (WM_USER+9) /* an embedded window requests a frame window id */
#define TK_OVERRIDEREDIRECT (WM_USER+10) /* an embedded window requests to overrideredirect */
#define TK_SETMENU (WM_USER+11) /* an embedded window requests to setup menu */
+#define TK_STATE (WM_USER+12) /* an embedded window sets/gets state */
/*
*--------------------------------------------------------------
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 3a0ccfd..470140b 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinEmbed.c,v 1.18 2005/01/07 01:39:24 chengyemao Exp $
+ * RCS: @(#) $Id: tkWinEmbed.c,v 1.19 2005/01/07 15:18:03 chengyemao Exp $
*/
#include "tkWinInt.h"
@@ -484,6 +484,18 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam)
result = 1;
break;
+ case TK_STATE:
+ /*
+ * 0 - normal state
+ * 1 - withdrawn state
+ * 2 - zoom state
+ * 3 - icon state
+ */
+ if(wParam >= 0 && wParam <= 3) {
+ TkpWmSetState(containerPtr->parentPtr, wParam);
+ }
+ result = TkpWmGetState(containerPtr->parentPtr);
+ break;
/*
* Return 0 since the current Tk container implementation
* is unable to provide following services.
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;
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 2da11fa..41cfc04 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.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: tkWinX.c,v 1.40 2004/12/28 08:45:32 chengyemao Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.41 2005/01/07 15:18:04 chengyemao Exp $
*/
#include "tkWinInt.h"
@@ -822,6 +822,7 @@ TkWinChildProc(hwnd, message, wParam, lParam)
case TK_GETFRAMEWID:
case TK_OVERRIDEREDIRECT:
case TK_SETMENU:
+ case TK_STATE:
result = TkWinEmbeddedEventProc(hwnd, message, wParam, lParam);
break;