From 0edfbcc3fd42701475505e6ac7cf6a153bc1e25a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Nov 2016 14:46:15 +0300 Subject: OnBuildMenu - new callback for handling rclicks --- src/mir_core/src/mir_core.def | 2 ++ src/mir_core/src/mir_core64.def | 2 ++ src/mir_core/src/ui_utils.cpp | 14 ++++++++++++++ 3 files changed, 18 insertions(+) (limited to 'src/mir_core') diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 21a64dc25f..5415d0021a 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1031,3 +1031,5 @@ CallFunctionSync @1170 ?Start@CTimer@@QAEXH@Z @1188 NONAME ?Stop@CTimer@@QAEXXZ @1189 NONAME ?AddTimer@CDlgBase@@IAEXPAVCTimer@@@Z @1190 NONAME +??0CCtrlBase@@AAE@PAUHWND__@@@Z @1191 NONAME +?FindControl@CDlgBase@@AAEPAVCCtrlBase@@PAUHWND__@@@Z @1192 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 50b1d8ed5d..1d24a768ff 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1031,3 +1031,5 @@ CallFunctionSync @1170 ?Start@CTimer@@QEAAXH@Z @1188 NONAME ?Stop@CTimer@@QEAAXXZ @1189 NONAME ?AddTimer@CDlgBase@@IEAAXPEAVCTimer@@@Z @1190 NONAME +??0CCtrlBase@@AEAA@PEAUHWND__@@@Z @1191 NONAME +?FindControl@CDlgBase@@AEAAPEAVCCtrlBase@@PEAUHWND__@@@Z @1192 NONAME diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index dc53f9dd71..ef726b6c49 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -210,6 +210,11 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } return FALSE; + case WM_CONTEXTMENU: + if (CCtrlBase *ctrl = FindControl(HWND(wParam))) + ctrl->OnBuildMenu(ctrl); + break; + case WM_SIZE: if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_SIZEBOX)) Utils_ResizeDialog(m_hwnd, m_hInst, MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer); @@ -297,6 +302,15 @@ CCtrlBase* CDlgBase::FindControl(int idCtrl) return m_controls.find(&search); } +CCtrlBase* CDlgBase::FindControl(HWND hwnd) +{ + for (int i = 0; i < m_controls.getCount(); i++) + if (m_controls[i]->GetHwnd() == hwnd) + return m_controls[i]; + + return NULL; +} + void CDlgBase::AddTimer(CTimer *timer) { m_timers.insert(timer); -- cgit v1.2.3