mshtml: Use IOleCommandTarget::Exec to implement context menu.
This commit is contained in:
parent
239b86fe8f
commit
0334291828
|
@ -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*);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue