281a77b7c9405d29c24c56aee9a2396608080a4a
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / MDIFrame / src / SimpleMDIChild.cpp
1 //////////////////////////////////////////////\r
2 // SimpleMDIChild.cpp\r
3 //  Definitions for the CSimpleView and CSimpleMDIChild classes\r
4 \r
5 #include "stdafx.h"\r
6 #include "SimpleMDIChild.h"\r
7 #include "resource.h"\r
8 \r
9 \r
10 // CSimpleView definitions\r
11 CSimpleView::CSimpleView() : m_Color(RGB(0,0,255))\r
12 {\r
13 }\r
14 \r
15 void CSimpleView::OnDraw(CDC* pDC)\r
16 {\r
17         //Centre some text in our view window\r
18         CRect rc = GetClientRect();\r
19         pDC->SetTextColor(m_Color);\r
20         pDC->DrawText(_T("View Window"), -1, rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);\r
21 }\r
22 \r
23 LRESULT CSimpleView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
24 {\r
25         switch (uMsg)\r
26         {\r
27         case WM_SIZE:\r
28                 // Force the window to be repainted\r
29                 ::InvalidateRect(m_hWnd, NULL, TRUE);\r
30                 break;          // Also do default processing\r
31         }\r
32 \r
33         // Do default processing for other messages\r
34         return WndProcDefault(uMsg, wParam, lParam);\r
35 }\r
36 \r
37 // CSimpleMDIChild definitions\r
38 CSimpleMDIChild::CSimpleMDIChild()\r
39 {\r
40     // Set m_View as the view window of the MDI child\r
41         SetView(m_View);\r
42         \r
43         // Set the menu for this MDI child\r
44         HINSTANCE hResource = GetApp()->GetResourceHandle();\r
45         HMENU hChildMenu = LoadMenu(hResource, _T("MdiMenuView"));\r
46         SetHandles(hChildMenu, NULL);\r
47 }\r
48 \r
49 CSimpleMDIChild::~CSimpleMDIChild()\r
50 {\r
51 }\r
52 \r
53 void CSimpleMDIChild::OnInitialUpdate()\r
54 {\r
55     // Set the window caption\r
56         ::SetWindowText(m_hWnd, _T("Simple Window"));\r
57         \r
58     // Set the window icons\r
59     SetIconLarge(IDI_VIEW);\r
60         SetIconSmall(IDI_VIEW);\r
61 }\r
62 \r
63 BOOL CSimpleMDIChild::OnCommand(WPARAM wParam, LPARAM lParam)\r
64 {\r
65     // Respond to menu and toolbar input\r
66 \r
67         UNREFERENCED_PARAMETER(lParam);\r
68 \r
69         switch (LOWORD(wParam))\r
70         {\r
71         case IDM_COLOR_BLACK:\r
72                 m_View.SetColor(RGB(0,0,0));\r
73                 Invalidate();\r
74                 return TRUE;\r
75         case IDM_COLOR_RED:\r
76                 m_View.SetColor(RGB(255, 0, 0));\r
77                 Invalidate();\r
78                 return TRUE;\r
79         case IDM_COLOR_GREEN:\r
80                 m_View.SetColor(RGB(0, 255, 0));\r
81                 Invalidate();\r
82                 return TRUE;\r
83         case IDM_COLOR_BLUE:\r
84                 m_View.SetColor(RGB(0, 0, 255));\r
85                 Invalidate();\r
86                 return TRUE;\r
87         case IDM_COLOR_WHITE:\r
88                 m_View.SetColor(RGB(255, 255, 255));\r
89                 Invalidate();\r
90                 return TRUE;\r
91         }\r
92 \r
93         return FALSE;\r
94 }\r
95 \r
96 LRESULT CSimpleMDIChild::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
97 {\r
98 //      switch (uMsg)\r
99 //      {\r
100 \r
101 //      }\r
102 \r
103         // Do default processing for other messages\r
104         return WndProcDefault(uMsg, wParam, lParam);\r
105 }\r

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