ARGH
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / Frame / src / View.cpp
1 //////////////////////////////////////////////\r
2 // View.cpp\r
3 //  Definitions for the CView class\r
4 \r
5 #include "stdafx.h"\r
6 #include "view.h"\r
7 \r
8 \r
9 CView::CView()\r
10 {\r
11 }\r
12 \r
13 void CView::OnDraw(CDC* pDC)\r
14 {\r
15         CRect rc = GetClientRect();\r
16 \r
17         // Centre some text in our view window\r
18         pDC->DrawText(_T("View Window"), -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);\r
19 }\r
20 \r
21 void CView::OnInitialUpdate()\r
22 {\r
23         // OnInitialUpdate is called immediately after the window is created\r
24         TRACE(_T("View window created\n"));\r
25 }\r
26 \r
27 void CView::PreCreate(CREATESTRUCT &cs)\r
28 {\r
29         // Here we set the defaults used by the create function for the view window\r
30         // Preforming this is optional, but doing so allows us to\r
31         // take more precise control over the window we create.\r
32 \r
33         // Set the extended style\r
34         cs.dwExStyle = WS_EX_CLIENTEDGE;\r
35 }\r
36 \r
37 void CView::PreRegisterClass(WNDCLASS &wc)\r
38 {\r
39         // Here we set the Window class parameters.\r
40         // Preforming this is optional, but doing so allows us to\r
41         // take more precise control over the type of window we create.\r
42 \r
43         // Set the Window Class name\r
44         wc.lpszClassName = _T("View");\r
45 \r
46         // Set a background brush to white\r
47         wc.hbrBackground = (HBRUSH)::GetStockObject(WHITE_BRUSH);\r
48 \r
49         // Set the default cursor\r
50         wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);\r
51 \r
52         // Set the class style (not to be confused with the window styles set in PreCreate)\r
53         wc.style = CS_DBLCLKS;  // Generate left button double click messages\r
54 }\r
55 \r
56 LRESULT CView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
57 {\r
58         switch (uMsg)\r
59         {\r
60         case WM_SIZE:\r
61                 Invalidate();\r
62                 break;  // Also do default processing\r
63         }\r
64 \r
65         // pass unhandled messages on for default processing\r
66         return WndProcDefault(uMsg, wParam, lParam);\r
67 }\r
68 \r
69 \r
70 \r

UCC git Repository :: git.ucc.asn.au