Skip to content

Commit 87d8dd7

Browse files
committed
插件鼠标事件中增加滚轮事件
1 parent 23ab562 commit 87d8dd7

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

TrafficMonitor/TaskBarDlg.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ BEGIN_MESSAGE_MAP(CTaskBarDlg, CDialogEx)
5252
ON_WM_LBUTTONUP()
5353
ON_MESSAGE(WM_EXITMENULOOP, &CTaskBarDlg::OnExitmenuloop)
5454
ON_MESSAGE(WM_TABLET_QUERYSYSTEMGESTURESTATUS, &CTaskBarDlg::OnTabletQuerysystemgesturestatus)
55+
ON_WM_MOUSEWHEEL()
5556
END_MESSAGE_MAP()
5657

5758
// CTaskBarDlg 消息处理程序
@@ -1634,3 +1635,31 @@ afx_msg LRESULT CTaskBarDlg::OnTabletQuerysystemgesturestatus(WPARAM wParam, LPA
16341635
{
16351636
return 0;
16361637
}
1638+
1639+
1640+
BOOL CTaskBarDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
1641+
{
1642+
if (zDelta >= 120 || zDelta <= -120)
1643+
{
1644+
CPoint point = pt;
1645+
ScreenToClient(&point);
1646+
ITMPlugin* plugin{};
1647+
bool is_plugin_item_clicked = (CheckClickedItem(point) && m_clicked_item.is_plugin && m_clicked_item.plugin_item != nullptr);
1648+
if (is_plugin_item_clicked)
1649+
{
1650+
plugin = theApp.m_plugins.GetPluginByItem(m_clicked_item.plugin_item);
1651+
if (plugin != nullptr && plugin->GetAPIVersion() >= 3)
1652+
{
1653+
IPluginItem::MouseEventType type;
1654+
if (zDelta > 0)
1655+
type = IPluginItem::MT_WHEEL_UP;
1656+
else
1657+
type = IPluginItem::MT_WHEEL_DOWN;
1658+
if (m_clicked_item.plugin_item->OnMouseEvent(type, point.x, point.y, (void*)GetSafeHwnd(), IPluginItem::MF_TASKBAR_WND) != 0)
1659+
return TRUE;
1660+
}
1661+
}
1662+
}
1663+
1664+
return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
1665+
}

TrafficMonitor/TaskBarDlg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,6 @@ class CTaskBarDlg : public CDialogEx
229229
protected:
230230
afx_msg LRESULT OnExitmenuloop(WPARAM wParam, LPARAM lParam);
231231
afx_msg LRESULT OnTabletQuerysystemgesturestatus(WPARAM wParam, LPARAM lParam);
232+
public:
233+
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
232234
};

include/PluginInterface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class IPluginItem
9393
MT_LCLICKED, /**< 点击了鼠标左键 */
9494
MT_RCLICKED, /**< 点击了鼠标右键 */
9595
MT_DBCLICKED, /**< 双击了鼠标左键 */
96+
MT_WHEEL_UP, /**< 向上滚动了鼠标滚轮 */
97+
MT_WHEEL_DOWN, /**< 向下滚动了鼠标滚轮 */
9698
};
9799

98100
enum MouseEventFlag

0 commit comments

Comments
 (0)