--- /dev/null
+//////////////////////////////////////////////\r
+// SimpleMDIChild.cpp\r
+// Definitions for the CSimpleView and CSimpleMDIChild classes\r
+\r
+#include "stdafx.h"\r
+#include "Files.h"\r
+#include "Output.h"\r
+#include "SimpleMDIChild.h"\r
+#include "resource.h"\r
+\r
+\r
+// CSimpleView definitions\r
+CSimpleView::CSimpleView() : m_Color(RGB(0,0,255))\r
+{\r
+}\r
+\r
+void CSimpleView::OnDraw(CDC* pDC)\r
+{\r
+ //Centre some text in our view window\r
+ CRect rc = GetClientRect();\r
+ pDC->SetTextColor(m_Color);\r
+ pDC->DrawText(_T("View Window"), -1, rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);\r
+}\r
+\r
+LRESULT CSimpleView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
+{\r
+ switch (uMsg)\r
+ {\r
+ case WM_SIZE:\r
+ // Force the window to be repainted\r
+ Invalidate();\r
+ break; // Also do default processing\r
+ }\r
+\r
+ // Do default processing for other messages\r
+ return WndProcDefault(uMsg, wParam, lParam);\r
+}\r
+\r
+// CSimpleMDIChild definitions\r
+CSimpleMDIChild::CSimpleMDIChild()\r
+{\r
+ // Set m_View as the view window of the MDI child\r
+ SetView(m_View);\r
+ \r
+ // Set the menu for this MDI child\r
+ SetHandles(LoadMenu(GetApp()->GetResourceHandle(), _T("MdiMenuView")), NULL);\r
+}\r
+\r
+CSimpleMDIChild::~CSimpleMDIChild()\r
+{\r
+}\r
+\r
+void CSimpleMDIChild::OnInitialUpdate()\r
+{\r
+ // Set the window caption\r
+ SetWindowText(_T("Simple Window"));\r
+ \r
+ // Set the window icons\r
+ SetIconLarge(IDI_VIEW);\r
+ SetIconSmall(IDI_VIEW);\r
+\r
+ // Add Child dockers\r
+ DWORD dwStyle = DS_CLIENTEDGE | DS_NO_CAPTION | DS_NO_UNDOCK;\r
+ m_View.SetDockStyle(dwStyle);\r
+ CDocker* pDockLeft = m_View.AddDockedChild(new CDockOutput, DS_DOCKED_LEFT | dwStyle, 200, 0);\r
+ CDocker* pDockRight = m_View.AddDockedChild(new CDockOutput, DS_DOCKED_RIGHT | dwStyle, 200, 0);\r
+ pDockLeft->AddDockedChild(new CDockFiles, DS_DOCKED_CONTAINER | dwStyle, 0, 0);\r
+ pDockRight->AddDockedChild(new CDockFiles, DS_DOCKED_CONTAINER | dwStyle, 0, 0);\r
+ \r
+}\r
+\r
+BOOL CSimpleMDIChild::OnCommand(WPARAM wParam, LPARAM lParam)\r
+{\r
+ // Respond to menu and toolbar input\r
+\r
+ UNREFERENCED_PARAMETER(lParam);\r
+ CDockSimple* pDockSimple = (CDockSimple*)GetView();\r
+ CSimpleView* pView = (CSimpleView*)pDockSimple->GetView();\r
+\r
+ switch (LOWORD(wParam))\r
+ {\r
+ case IDM_COLOR_BLACK:\r
+ pView->SetColor(RGB(0,0,0));\r
+ pView->Invalidate();\r
+ return TRUE;\r
+ case IDM_COLOR_RED:\r
+ pView->SetColor(RGB(255, 0, 0));\r
+ pView->Invalidate();\r
+ return TRUE;\r
+ case IDM_COLOR_GREEN:\r
+ pView->SetColor(RGB(0, 255, 0));\r
+ pView->Invalidate();\r
+ return TRUE;\r
+ case IDM_COLOR_BLUE:\r
+ pView->SetColor(RGB(0, 0, 255));\r
+ pView->Invalidate();\r
+ return TRUE;\r
+ case IDM_COLOR_WHITE:\r
+ pView->SetColor(RGB(255, 255, 255));\r
+ pView->Invalidate();\r
+ return TRUE; \r
+ } \r
+\r
+ return FALSE;\r
+}\r
+\r
+LRESULT CSimpleMDIChild::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
+{\r
+ switch (uMsg)\r
+ {\r
+ case WM_SIZE:\r
+ CDocker* pDock = (CDocker*)GetView();\r
+ pDock->RecalcDockLayout();\r
+ break;\r
+ }\r
+\r
+ // Do default processing for other messages\r
+ return WndProcDefault(uMsg, wParam, lParam);\r
+}\r