-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogPane.cpp
120 lines (91 loc) · 2.45 KB
/
LogPane.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
107
108
109
110
111
112
113
114
115
116
117
118
119
// LogPane.cpp : implementation file
//
#include "stdafx.h"
#include "kb.h"
#include "VisualText.h"
#include "Utils.h"
#include "LogPane.h"
// CLogPane
IMPLEMENT_DYNCREATE(CLogPane, CWnd)
CLogPane::CLogPane()
{
}
CLogPane::~CLogPane()
{
}
BEGIN_MESSAGE_MAP(CLogPane, CWnd)
//{{AFX_MSG_MAP(CLogPane)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
ON_WM_SETFOCUS()
ON_NOTIFY(NM_RCLICK, NM_RCLICK, OnRButtonDown)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLogPane message handlers
static int arColWidths[] = {
200,
600
};
static CString arColLabels[] = {
_T("Operation"),
_T("Description"),
};
int CLogPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (m_listCtrl.GetSafeHwnd() == 0)
{
// Define the default style for the output list controls.
//DWORD dwStyle = LVS_REPORT | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS |
// WS_CHILD | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE | LVS_EX_FULLROWSELECT;
DWORD dwStyle = LVS_REPORT | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS |
WS_CHILD | WS_VSCROLL | WS_TABSTOP|WS_VISIBLE;
// Create the list control.
if (!m_listCtrl.Create( dwStyle, CRect(0,0,0,0), this, 0xff ))
{
TRACE0( "Failed to create list control.\n" );
return FALSE;
}
// initialize the list control.
// Insert the columns.
m_listCtrl.BuildColumns(_countof(arColWidths), arColWidths, arColLabels);
// Subclass the flat header control.
m_listCtrl.SubclassHeader();
// lock the first two colums from sizing operations.
CXTPHeaderCtrl* pHeaderCtrl = m_listCtrl.XTPGetHeaderCtrl( );
if ( pHeaderCtrl != NULL )
{
//pHeaderCtrl->FreezeColumn(0);
// enable autosizing for columns.
pHeaderCtrl->EnableAutoSize();
}
ListView_SetExtendedListViewStyle(
m_listCtrl.m_hWnd, LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT);
m_listCtrl.AutoSaveColumns(_T("LogListColumns"));
m_listCtrl.SetMenuID(IDR_LOG);
}
return 0;
}
void CLogPane::OnRButtonDown(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint point, ptScreen;
::GetCursorPos(&ptScreen);
point = ptScreen;
m_listCtrl.ScreenToClient(&point);
logmsg(_T("CLogPane::OnRbuttonDown")); // 05/14/08 AM.
PopupContextMenu(this,IDR_FIND,point);
}
void CLogPane::OnSize(UINT nType, int cx, int cy)
{
CWnd::OnSize(nType, cx, cy);
if (m_listCtrl.GetSafeHwnd())
{
m_listCtrl.MoveWindow(0, 0, cx, cy);
}
}
void CLogPane::OnSetFocus(CWnd* /*pOldWnd*/)
{
m_listCtrl.SetFocus();
}