-
Notifications
You must be signed in to change notification settings - Fork 1
/
VectorsPane.cpp
88 lines (61 loc) · 1.91 KB
/
VectorsPane.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
// VectorsPane.cpp : implementation file
//
#include "stdafx.h"
#include "Rs.h"
#include "VectorsPane.h"
#include "RsDoc.h"
// CVectorsPane
CListCtrl CVectorsPane::m_ctrlVectorList;
IMPLEMENT_DYNAMIC(CVectorsPane, CDockablePane)
CVectorsPane::CVectorsPane()
{
}
CVectorsPane::~CVectorsPane()
{
}
BEGIN_MESSAGE_MAP(CVectorsPane, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
ON_NOTIFY(LVN_ITEMCHANGED, IDD_VECTORLIST, &CVectorsPane::OnCtrlItemChanged)
END_MESSAGE_MAP()
// CVectorsPane message handlers
int CVectorsPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_ctrlVectorList.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT/*|LVS_NOCOLUMNHEADER*/, CRect(0, 0, 0, 0), this, IDD_VECTORLIST))
{
TRACE0("幹秀唹�双燕払移\n");
return -1;
}
m_ctrlVectorList.InsertColumn(0, _T("文楚双燕"));
m_ctrlVectorList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
m_ctrlVectorList.SetColumnWidth(0, 500);
return 0;
}
void CVectorsPane::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
if (m_ctrlVectorList.GetSafeHwnd() != NULL)
{
CRect rectClient;
GetClientRect(rectClient);
m_ctrlVectorList.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), rectClient.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
}
}
CListCtrl& CVectorsPane::GetListCtrl()
{
return m_ctrlVectorList;
}
void CVectorsPane::OnCtrlItemChanged(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
CFrameWnd* pMainFrm = (CFrameWnd*)AfxGetApp()->GetMainWnd();
CFrameWnd* pChildFrm = pMainFrm->GetActiveFrame();
CRsDoc* pDoc = reinterpret_cast<CRsDoc*>(pChildFrm->GetActiveDocument());
if (pNMItemActivate->uOldState != 0)
{
pDoc->SetVectorState(pNMItemActivate->iItem, m_ctrlVectorList.GetCheck(pNMItemActivate->iItem));
}
*pResult = 0;
}