-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTableView.cpp
More file actions
executable file
·125 lines (99 loc) · 2.38 KB
/
Copy pathTableView.cpp
File metadata and controls
executable file
·125 lines (99 loc) · 2.38 KB
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
120
121
122
123
124
125
// TableView.cpp : implementation file
//
#include "stdafx.h"
#include "..\HDFPlugin.h"
#include "TableView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTableView
IMPLEMENT_DYNCREATE(CTableView, CBaseView)
CTableView::CTableView()
{
m_pGridCtrl = NULL;
m_pDataset = NULL;
}
CTableView::~CTableView()
{
if (m_pGridCtrl)
{
delete m_pGridCtrl;
m_pGridCtrl = NULL;
}
}
BEGIN_MESSAGE_MAP(CTableView, CBaseView)
//{{AFX_MSG_MAP(CTableView)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTableView drawing
void CTableView::OnInitialUpdate()
{
CBaseView::OnInitialUpdate();
// TODO: calculate the total size of this view
if (!m_pGridCtrl)
{
RECT rect;
GetClientRect(&rect);
m_pGridCtrl = new CGridCtrl;
m_pGridCtrl->CreateGrid(WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, rect,this,1024);
}
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
void CTableView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CTableView diagnostics
#ifdef _DEBUG
void CTableView::AssertValid() const
{
CBaseView::AssertValid();
}
void CTableView::Dump(CDumpContext& dc) const
{
CBaseView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTableView message handlers
CDataset* CTableView::GetDataset()
{
return m_pDataset;
}
void CTableView::SetDataset(CDataset* pDataset)
{
if (pDataset==NULL ||
pDataset == m_pDataset)
return;
if(!pDataset->ReadData())
{
char msg[80];
strcpy(msg, "Failed to read data from \n");
strcat(msg, pDataset->GetFullName());
AfxMessageBox(msg, MB_ICONEXCLAMATION);
return;
}
m_pDataset = pDataset;
m_pGridCtrl->m_pDataset = pDataset;
m_pGridCtrl->OnSetup();
}
void CTableView::OnSize(UINT nType, int cx, int cy)
{
CBaseView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if (m_pGridCtrl)
{
RECT rect;
GetClientRect(&rect);
m_pGridCtrl->MoveWindow(&rect);
}
}