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
126
|
// TestCBotView.cpp : implementation of the CTestCBotView class
//
#include "stdafx.h"
#include "TestCBot.h"
#include "TestCBotDoc.h"
#include "TestCBotView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestCBotView
IMPLEMENT_DYNCREATE(CTestCBotView, CView)
BEGIN_MESSAGE_MAP(CTestCBotView, CView)
//{{AFX_MSG_MAP(CTestCBotView)
ON_WM_SIZE()
ON_MESSAGE(WM_ACTWINDOW, ActWindow)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestCBotView construction/destruction
CTestCBotView::CTestCBotView()
{
}
CTestCBotView::~CTestCBotView()
{
}
BOOL CTestCBotView::PreCreateWindow(CREATESTRUCT& cs)
{
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CTestCBotView drawing
void CTestCBotView::OnDraw(CDC* pDC)
{
CTestCBotDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
/////////////////////////////////////////////////////////////////////////////
// CTestCBotView diagnostics
#ifdef _DEBUG
void CTestCBotView::AssertValid() const
{
CView::AssertValid();
}
void CTestCBotView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CTestCBotDoc* CTestCBotView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestCBotDoc)));
return (CTestCBotDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestCBotView message handlers
void CTestCBotView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
{
CTestCBotDoc* pDoc = GetDocument();
// CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp();
if ( pDoc->m_pEdit == NULL)
{
pDoc->m_pEdit = new CEdit();
CRect rect;
GetClientRect( rect );
pDoc->m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL,
rect, this, IDC_EDIT1 );
pDoc->m_pEdit->SetTabStops(12);
pDoc->m_pEdit->SetWindowText(pDoc->m_DocText);
}
if ( !bActivate && !pDoc->Compile() )
{
// comment faire pour r�activer l'ancien document
}
CView::OnActivateView(bActivate, pActivateView, pDeactiveView);
if ( bActivate ) pDoc->m_pEdit->SetFocus();
}
void CTestCBotView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
CTestCBotDoc* pDoc = GetDocument();
if ( pDoc->m_pEdit != NULL )
{
CRect rect;
GetClientRect( rect );
pDoc->m_pEdit->MoveWindow( rect );
pDoc->m_pEdit->SetFocus();
}
}
LONG CTestCBotView::ActWindow(UINT wparam, LONG lparam)
{
// GetParentFrame()->SetActiveView( this, TRUE );
// CMDIChildWnd::OnMDIActivate(1, this, this)
return 0;
}
|