forked from gopa810/gcal-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditClipboarded.cpp
90 lines (76 loc) · 1.66 KB
/
EditClipboarded.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// EditClipboarded.cpp : implementation file
//
#include "stdafx.h"
#include "vcal5beta.h"
#include "EditClipboarded.h"
/////////////////////////////////////////////////////////////////////////////
// CEditClipboarded
CEditClipboarded::CEditClipboarded()
{
m_bKeyCtrl = FALSE;
m_bKeyShift = FALSE;
}
CEditClipboarded::~CEditClipboarded()
{
}
BEGIN_MESSAGE_MAP(CEditClipboarded, CEdit)
//{{AFX_MSG_MAP(CEditClipboarded)
ON_WM_KEYDOWN()
ON_WM_KEYUP()
ON_WM_SETFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditClipboarded message handlers
void CEditClipboarded::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case VK_CONTROL:
m_bKeyCtrl = TRUE;
break;
case VK_SHIFT:
m_bKeyShift = TRUE;
break;
case 'C':
case 'X':
if (m_bKeyCtrl == TRUE)
{
GetParent()->GetParent()->SendMessage(WM_COMMAND, ID_EDIT_COPY);
}
break;
case 'P':
if (m_bKeyCtrl == TRUE)
{
GetParent()->GetParent()->SendMessage(WM_COMMAND, ID_FILE_PRINT);
}
break;
default:
break;
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CEditClipboarded::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case VK_CONTROL:
m_bKeyCtrl = FALSE;
break;
case VK_SHIFT:
m_bKeyShift = FALSE;
break;
default:
break;
}
CEdit::OnKeyUp(nChar, nRepCnt, nFlags);
}
void CEditClipboarded::OnSetFocus(CWnd* pOldWnd)
{
CEdit::OnSetFocus(pOldWnd);
m_bKeyCtrl = FALSE;
m_bKeyShift = FALSE;
// GetParent()->GetParent()->SetFocus();
}