diff options
Diffstat (limited to 'win/tkWinEmbed.c')
-rw-r--r-- | win/tkWinEmbed.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 1aca63f..371d5c3 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.15 2004/12/20 15:30:43 chengyemao Exp $ + * RCS: @(#) $Id: tkWinEmbed.c,v 1.16 2004/12/28 08:45:31 chengyemao Exp $ */ #include "tkWinInt.h" @@ -33,6 +33,7 @@ typedef struct Container { * window, or NULL if the * embedded application isn't in * this process. */ + HWND embeddedMenuHWnd; /* Tk's embedded menu window handler */ struct Container *nextPtr; /* Next in list of all containers in * this process. */ } Container; @@ -416,6 +417,7 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam) break; case TK_DETACHWINDOW: + containerPtr->embeddedMenuHWnd = NULL; containerPtr->embeddedHWnd = NULL; containerPtr->parentPtr->flags &= ~TK_BOTH_HALVES; break; @@ -475,7 +477,13 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam) result = TkpWinToplevelOverrideRedirect(containerPtr->parentPtr, wParam); break; - /* + case TK_SETMENU: + containerPtr->embeddedMenuHWnd = (HWND)lParam; + TkWinSetMenu((Tk_Window)containerPtr->parentPtr, (HMENU)wParam); + result = 1; + break; + + /* * Return 0 since the current Tk container implementation * is unable to provide following services. * @@ -653,6 +661,41 @@ Tk_GetEmbeddedHWnd(winPtr) } return NULL; } + +/* + *---------------------------------------------------------------------- + * + * Tk_GetEmbeddedMenuHWND -- + * + * This function returns the embedded menu window id. + * + * Results: + * If winPtr is a container, the return value is the HWND for the + * embedded menu window. Otherwise it returns NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +HWND +Tk_GetEmbeddedMenuHWND(tkwin) + Tk_Window tkwin; +{ + TkWindow *winPtr = (TkWindow*)tkwin; + Container *containerPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; + containerPtr = containerPtr->nextPtr) { + if (containerPtr->parentPtr == winPtr) { + return containerPtr->embeddedMenuHWnd; + } + } + return NULL; +} /* *---------------------------------------------------------------------- |