-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomControl.cpp
106 lines (106 loc) · 7.44 KB
/
CustomControl.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// LockControl.cpp
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024 Adrian Maurer. All rights reserved.
// Distributed under the MIT software license (http://www.opensource.org/licenses/mit-license.php).
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "pch.h"
#include "framework.h"
#include "CustomControl.h"
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomButton
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomButton - MESSAGE MAP FUNCTIONS
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CCustomButton, CButton)
ON_WM_LBUTTONUP()
ON_WM_KEYUP()
ON_WM_GETDLGCODE()
END_MESSAGE_MAP()
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomButton::OnLButtonUp(UINT nFlags, CPoint pnt)
{
if (!isLocked()) CButton::OnLButtonUp(nFlags, pnt);
else ::ReleaseCapture();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomButton::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!isLocked())
{
CButton::OnKeyUp(nChar, nRepCnt, nFlags);
}
else
{
SetState(FALSE);
::ReleaseCapture();
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UINT CCustomButton::OnGetDlgCode()
{
return DLGC_BUTTON | DLGC_WANTARROWS | DLGC_WANTTAB;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomComboBox
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomComboBox - MESSAGE MAP FUNCTIONS
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CCustomComboBox, CComboBox)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_WM_KEYDOWN()
ON_WM_CHAR()
END_MESSAGE_MAP()
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomComboBox::OnLButtonDown(UINT nFlags, CPoint pnt)
{
if (!isLocked()) CComboBox::OnLButtonDown(nFlags, pnt);
else SetFocus();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomComboBox::OnLButtonDblClk(UINT nFlags, CPoint pnt)
{
if (!isLocked()) CComboBox::OnLButtonDblClk(nFlags, pnt);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!isLocked()) CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomComboBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!isLocked()) CComboBox::OnChar(nChar, nRepCnt, nFlags);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomListBox
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CCustomListBox - MESSAGE MAP FUNCTIONS
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CCustomListBox, CListBox)
ON_WM_LBUTTONDOWN()
ON_WM_KEYDOWN()
ON_WM_CHAR()
END_MESSAGE_MAP()
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomListBox::OnLButtonDown(UINT nFlags, CPoint pnt)
{
if (!isLocked()) CListBox::OnLButtonDown(nFlags, pnt);
else SetFocus();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!isLocked()) CListBox::OnKeyDown(nChar, nRepCnt, nFlags);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void CCustomListBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!isLocked()) CListBox::OnChar(nChar, nRepCnt, nFlags);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------