Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / MDIFrame / src / MainMDIfrm.cpp
1 ////////////////////////////////////////////////////\r
2 // MainMDIfrm.cpp  - definitions for the CMainMDIFrame class\r
3 \r
4 #include "stdafx.h"\r
5 #include "mainMDIfrm.h"\r
6 #include "SimpleMDIChild.h"\r
7 #include "resource.h"\r
8 \r
9 \r
10 CMainMDIFrame::CMainMDIFrame()\r
11 {\r
12         // Set the registry key name, and load the initial window position\r
13         // Use a registry key name like "CompanyName\\Application"\r
14         LoadRegistrySettings(_T("Win32++\\MDI Frame"));\r
15 }\r
16 \r
17 CMainMDIFrame::~CMainMDIFrame()\r
18 {\r
19 }\r
20 \r
21 void CMainMDIFrame::OnFileOpen()\r
22 {\r
23         // Bring up the file open dialog\r
24         CFile File;\r
25         CString str = File.OpenFileDialog(0, 0, 0, 0);\r
26 \r
27         // TODO:\r
28         // Add your own code here. Refer to the tutorial for additional information \r
29 }\r
30 \r
31 void CMainMDIFrame::OnFileSave()\r
32 {\r
33         // Bring up the file save dialog.\r
34         CFile File;\r
35         CString str = File.SaveFileDialog(0, 0, 0, 0, 0);\r
36 \r
37         // TODO:\r
38         // Add your own code here. Refer to the tutorial for additional information \r
39 }\r
40 \r
41 void CMainMDIFrame::OnFilePrint()\r
42 {\r
43         // Bring up a dialog to choose the printer\r
44         PRINTDLG pd = {0};\r
45         pd.lStructSize = sizeof( pd );\r
46         pd.Flags = PD_RETURNDC;\r
47         pd.hwndOwner = m_hWnd;\r
48 \r
49         // Retrieve the printer DC\r
50         PrintDlg( &pd );\r
51         \r
52         // TODO:\r
53         // Add your own code here. Refer to the tutorial for additional information \r
54 }\r
55 \r
56 \r
57 void CMainMDIFrame::OnInitialUpdate()\r
58 {\r
59         TRACE(_T("MDI Frame started \n"));\r
60         //The frame is now created.\r
61         //Place any additional startup code here.\r
62 }\r
63 \r
64 BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)\r
65 {\r
66         switch (LOWORD(wParam))\r
67         {\r
68         case IDM_FILE_NEW:\r
69                 AddMDIChild(new CSimpleMDIChild); // CMDIFrame::RemoveMDIChild deletes this pointer\r
70                 return TRUE;\r
71         case IDM_FILE_CLOSE:          // Close the active MDI window\r
72                 GetActiveMDIChild()->SendMessage(WM_CLOSE, 0, 0);\r
73                 return TRUE;\r
74         case IDM_FILE_OPEN:\r
75                 OnFileOpen();\r
76                 return TRUE;\r
77         case IDM_FILE_SAVE:\r
78                 // Refer to the tutorial for an example of OnFileSave()\r
79                 return TRUE;\r
80         case IDM_FILE_SAVEAS:\r
81                 // Refer to the tutorial for an example of OnFileSaveAs()\r
82                 return TRUE;\r
83         case IDM_FILE_PRINT:\r
84                 OnFilePrint();\r
85                 return TRUE;\r
86         case IDW_VIEW_STATUSBAR:\r
87                 OnViewStatusBar();\r
88                 break;\r
89         case IDW_VIEW_TOOLBAR:\r
90                 OnViewToolBar();\r
91                 break;\r
92         case IDW_MDI_ARRANGE:\r
93                 MDIIconArrange();\r
94                 break;\r
95         case IDW_MDI_CASCADE:\r
96                 MDICascade();\r
97                 break;\r
98         case IDW_MDI_CLOSEALL:\r
99                 RemoveAllMDIChildren();\r
100                 break;\r
101         case IDW_MDI_TILE:\r
102                 MDITile();\r
103                 break;\r
104         default:    // Pass to active child...\r
105                 {\r
106                         if (GetActiveMDIChild())\r
107                                 GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);\r
108                 }\r
109                 break ;\r
110         case IDM_FILE_EXIT:\r
111                 SendMessage(WM_CLOSE, 0, 0);\r
112                 return TRUE;\r
113         case IDM_HELP_ABOUT:\r
114                 OnHelp();\r
115                 return TRUE;\r
116         }\r
117         return FALSE;\r
118 }\r
119 \r
120 void CMainMDIFrame::OnCreate()\r
121 {\r
122         // OnCreate controls the way the frame is created.\r
123         // Overriding CFrame::Oncreate is optional.\r
124         // The default for the following variables is TRUE\r
125 \r
126         // m_bShowIndicatorStatus = FALSE;      // Don't show statusbar indicators\r
127         // m_bShowMenuStatus = FALSE;           // Don't show toolbar or menu status\r
128         // m_bUseReBar = FALSE;                         // Don't use rebars\r
129         // m_bUseThemes = FALSE;            // Don't use themes\r
130         // m_bUseToolBar = FALSE;                       // Don't use a toolbar\r
131         // m_bUseCustomDraw = FALSE;            // Don't use custom draw for menu items\r
132 \r
133         // call the base class function\r
134         CMDIFrame::OnCreate();\r
135 }\r
136 \r
137 void CMainMDIFrame::SetupToolBar()\r
138 {\r
139         // Define the resource IDs for the toolbar\r
140         AddToolBarButton( IDM_FILE_NEW   );\r
141         AddToolBarButton( IDM_FILE_OPEN  );\r
142         AddToolBarButton( IDM_FILE_SAVE  );\r
143         AddToolBarButton( 0 );                          // Separator\r
144         AddToolBarButton( IDM_EDIT_CUT   );\r
145         AddToolBarButton( IDM_EDIT_COPY  );\r
146         AddToolBarButton( IDM_EDIT_PASTE );\r
147         AddToolBarButton( 0 );                          // Separator\r
148         AddToolBarButton( IDM_FILE_PRINT );\r
149         AddToolBarButton( 0 );                          // Separator\r
150         AddToolBarButton( IDM_HELP_ABOUT );\r
151 }\r
152 \r
153 LRESULT CMainMDIFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
154 {\r
155 //      switch (uMsg)\r
156 //      {\r
157 //              Add case statements for each messages to be handled here\r
158 //      }\r
159 \r
160 //      pass unhandled messages on for default processing\r
161         return WndProcDefault(uMsg, wParam, lParam);\r
162 }\r
163 \r

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