Jacek Caban : mshtml: Use IOleCommandTarget::Exec to implement
context menu .
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 11 08:46:36 CDT 2007
Module: wine
Branch: master
Commit: 03342918285d02ba87bb006f078b3d9d7fe151a4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03342918285d02ba87bb006f078b3d9d7fe151a4
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Jun 10 11:38:16 2007 +0200
mshtml: Use IOleCommandTarget::Exec to implement context menu.
---
dlls/mshtml/mshtml_private.h | 2 +-
dlls/mshtml/nsembed.c | 2 +-
dlls/mshtml/olecmd.c | 21 +++++++++++++++++++++
dlls/mshtml/olewnd.c | 19 -------------------
4 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 3f54104..7842e85 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -313,7 +313,7 @@ NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
void NSContainer_Release(NSContainer*);
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
-void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
+void show_context_menu(HTMLDocument*,DWORD,POINT*);
void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
void hide_tooltip(HTMLDocument*);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index c2c7318..a5dd2d5 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -898,7 +898,7 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
FIXME("aContextFlags=%08x\n", aContextFlags);
};
- HTMLDocument_ShowContextMenu(This->doc, dwID, &pt);
+ show_context_menu(This->doc, dwID, &pt);
return NS_OK;
}
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 8c4b8cf..2c30dc7 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -814,6 +814,27 @@ static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
OleCommandTarget_Exec
};
+void show_context_menu(HTMLDocument *This, DWORD dwID, POINT *ppt)
+{
+ HMENU menu_res, menu;
+ DWORD cmdid;
+ HRESULT hres;
+
+ hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt,
+ (IUnknown*)CMDTARGET(This), (IDispatch*)HTMLDOC(This));
+ if(hres == S_OK)
+ return;
+
+ menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
+ menu = GetSubMenu(menu_res, dwID);
+
+ cmdid = TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
+ ppt->x, ppt->y, 0, This->hwnd, NULL);
+ DestroyMenu(menu_res);
+
+ IOleCommandTarget_Exec(CMDTARGET(This), &CGID_MSHTML, cmdid, 0, NULL, NULL);
+}
+
void HTMLDocument_OleCmd_Init(HTMLDocument *This)
{
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
diff --git a/dlls/mshtml/olewnd.c b/dlls/mshtml/olewnd.c
index 45e505a..d91e792 100644
--- a/dlls/mshtml/olewnd.c
+++ b/dlls/mshtml/olewnd.c
@@ -262,25 +262,6 @@ static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
#undef INPLACEWIN_THIS
-void HTMLDocument_ShowContextMenu(HTMLDocument *This, DWORD dwID, POINT *ppt)
-{
- HMENU menu_res, menu;
- HRESULT hres;
-
- hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt,
- (IUnknown*)CMDTARGET(This), (IDispatch*)HTMLDOC(This));
- if(hres == S_OK)
- return;
-
- menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
- menu = GetSubMenu(menu_res, dwID);
-
- TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
- ppt->x, ppt->y, 0, This->hwnd, NULL);
-
- DestroyMenu(menu_res);
-}
-
void HTMLDocument_Window_Init(HTMLDocument *This)
{
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
More information about the wine-cvs
mailing list