Module: wine Branch: refs/heads/master Commit: fc2ce6779eaf8bcda42be384a93daacd0cdfdb19 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=fc2ce6779eaf8bcda42be384...
Author: Kevin Koltzau kevin@plop.org Date: Thu Feb 2 13:18:20 2006 +0100
riched20: Handle context menu.
---
dlls/riched20/editor.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 9b741a8..5111807 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -852,6 +852,29 @@ ME_KeyDown(ME_TextEditor *editor, WORD n return FALSE; }
+static void ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) +{ + CHARRANGE selrange; + HMENU menu; + int seltype = 0; + if(!editor->lpOleCallback) + return; + ME_GetSelection(editor, (int *)&selrange.cpMin, (int *)&selrange.cpMax); + if(selrange.cpMin == selrange.cpMax) + seltype |= SEL_EMPTY; + else + { + /* FIXME: Handle objects */ + seltype |= SEL_TEXT; + if(selrange.cpMax-selrange.cpMin > 1) + seltype |= SEL_MULTICHAR; + } + if(SUCCEEDED(IRichEditOleCallback_GetContextMenu(editor->lpOleCallback, seltype, NULL, &selrange, &menu))) + { + TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, GetParent(editor->hWnd), NULL); + DestroyMenu(menu); + } +}
ME_TextEditor *ME_MakeEditor(HWND hWnd) { ME_TextEditor *ed = ALLOC_OBJ(ME_TextEditor); @@ -1842,6 +1865,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND case WM_LBUTTONDBLCLK: ME_SelectWord(editor); break; + case WM_CONTEXTMENU: + ME_ShowContextMenu(editor, (short)LOWORD(lParam), (short)HIWORD(lParam)); + break; case WM_PAINT: if (editor->bRedraw) {