1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2011-2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Helper to catch tripple mouse clicks.
30 : m_LastDblClickMsg(0)
31 , m_LastDblClickTime(0)
34 virtual ~CTripleClick() {}
36 virtual void OnLButtonTrippleClick(UINT
/*nFlags*/, CPoint
/*point*/) {}
37 virtual void OnMButtonTrippleClick(UINT
/*nFlags*/, CPoint
/*point*/) {}
38 virtual void OnRButtonTrippleClick(UINT
/*nFlags*/, CPoint
/*point*/) {}
40 BOOL
RelayTrippleClick(MSG
* pMsg
)
42 if ( (pMsg
->message
== WM_LBUTTONDBLCLK
) ||
43 (pMsg
->message
== WM_MBUTTONDBLCLK
) ||
44 (pMsg
->message
== WM_RBUTTONDBLCLK
))
46 m_LastDblClickMsg
= pMsg
->message
;
47 m_LastDblClickTime
= GetTickCount();
50 ((pMsg
->message
== WM_LBUTTONDOWN
)&&(m_LastDblClickMsg
== WM_LBUTTONDBLCLK
)) ||
51 ((pMsg
->message
== WM_MBUTTONDOWN
)&&(m_LastDblClickMsg
== WM_MBUTTONDBLCLK
)) ||
52 ((pMsg
->message
== WM_RBUTTONDOWN
)&&(m_LastDblClickMsg
== WM_RBUTTONDBLCLK
))
55 if ((GetTickCount() - GetDoubleClickTime()) < m_LastDblClickTime
)
57 m_LastDblClickTime
= 0;
58 m_LastDblClickMsg
= 0;
60 pt
.x
= GET_X_LPARAM(pMsg
->lParam
);
61 pt
.y
= GET_Y_LPARAM(pMsg
->lParam
);
62 switch (pMsg
->message
)
65 OnLButtonTrippleClick((UINT
)pMsg
->wParam
, pt
);
68 OnMButtonTrippleClick((UINT
)pMsg
->wParam
, pt
);
71 OnRButtonTrippleClick((UINT
)pMsg
->wParam
, pt
);
80 UINT m_LastDblClickMsg
;
81 DWORD m_LastDblClickTime
;