3151bea6c1e8c8355262d87babb310981e4fd7de
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / Frame / src / Mainfrm.cpp
1 ////////////////////////////////////////////////////\r
2 // Mainfrm.cpp\r
3 \r
4 #include "stdafx.h"\r
5 #include "resource.h"\r
6 #include "mainfrm.h"\r
7 \r
8 \r
9 // Definitions for the CMainFrame class\r
10 CMainFrame::CMainFrame()\r
11 {\r
12         // Constructor for CMainFrame. Its called after CFrame's constructor\r
13 \r
14         //Set m_View as the view window of the frame\r
15         SetView(m_View);\r
16 \r
17         // Set the registry key name, and load the initial window position\r
18         // Use a registry key name like "CompanyName\\Application"\r
19         LoadRegistrySettings(_T("Win32++\\Frame"));\r
20 }\r
21 \r
22 CMainFrame::~CMainFrame()\r
23 {\r
24         // Destructor for CMainFrame.\r
25 }\r
26 \r
27 BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)\r
28 {\r
29         // OnCommand responds to menu and and toolbar input\r
30 \r
31         UNREFERENCED_PARAMETER(lParam);\r
32 \r
33         switch(LOWORD(wParam))\r
34         {\r
35         case IDM_FILE_OPEN:\r
36                 // Refer to the tutorial for an example of OnFileOpen\r
37                 OnFileOpen();\r
38                 return TRUE;\r
39         case IDM_FILE_SAVE:\r
40                 // Refer to the tutorial for an example of OnFileSave\r
41                 OnFileSave();\r
42                 return TRUE;\r
43         case IDM_FILE_SAVEAS:\r
44                 // Refer to the tutorial for an example of OnFileSaveAs\r
45                 OnFileSave();\r
46                 return TRUE;\r
47         case IDM_FILE_PRINT:\r
48                 OnFilePrint();\r
49                 return TRUE;\r
50         case IDM_FILE_EXIT:\r
51                 // End the application\r
52                 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);\r
53                 return TRUE;\r
54         case IDW_VIEW_STATUSBAR:\r
55                 OnViewStatusBar();\r
56                 return TRUE;\r
57         case IDW_VIEW_TOOLBAR:\r
58                 OnViewToolBar();\r
59                 return TRUE;\r
60         case IDM_HELP_ABOUT:\r
61                 // Display the help dialog\r
62                 OnHelp();\r
63                 return TRUE;\r
64         }\r
65 \r
66         return FALSE;\r
67 }\r
68 \r
69 void CMainFrame::OnCreate()\r
70 {\r
71         // OnCreate controls the way the frame is created.\r
72         // Overriding CFrame::Oncreate is optional.\r
73         // The default for the following variables is TRUE\r
74 \r
75         // m_bShowIndicatorStatus = FALSE;      // Don't show statusbar indicators\r
76         // m_bShowMenuStatus = FALSE;           // Don't show toolbar or menu status\r
77         // m_bUseReBar = FALSE;                         // Don't use rebars\r
78         // m_bUseThemes = FALSE;            // Don't use themes\r
79         // m_bUseToolBar = FALSE;                       // Don't use a toolbar\r
80 \r
81         // call the base class function\r
82         CFrame::OnCreate();\r
83 }\r
84 \r
85 void CMainFrame::OnInitialUpdate()\r
86 {\r
87         // The frame is now created.\r
88         // Place any additional startup code here.\r
89 \r
90         TRACE(_T("Frame created\n"));\r
91 }\r
92 \r
93 void CMainFrame::OnFileOpen()\r
94 {\r
95         // Bring up the dialog, and open the file\r
96         CFile File;\r
97         CString str = File.OpenFileDialog(0, 0, 0, 0);\r
98 \r
99         // TODO:\r
100         // Add your own code here. Refer to the tutorial for additional information \r
101 }\r
102 \r
103 void CMainFrame::OnFileSave()\r
104 {\r
105         CFile File;\r
106         CString str = File.SaveFileDialog(0, 0, 0, 0, 0);\r
107 \r
108         // TODO:\r
109         // Add your own code here. Refer to the tutorial for additional information \r
110 }\r
111 \r
112 void CMainFrame::OnFilePrint()\r
113 {\r
114         // Bring up a dialog to choose the printer\r
115         PRINTDLG pd = {0};\r
116         pd.lStructSize = sizeof( pd );\r
117         pd.Flags = PD_RETURNDC;\r
118         pd.hwndOwner = m_hWnd;\r
119 \r
120         // Retrieve the printer DC\r
121         PrintDlg( &pd );\r
122         \r
123         // TODO:\r
124         // Add your own code here. Refer to the tutorial for additional information \r
125 }\r
126 \r
127 LRESULT CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam)\r
128 {\r
129         // Process notification messages sent by child windows\r
130 //      switch(((LPNMHDR)lParam)->code)\r
131 //      {\r
132                 //Add case statments for each notification message here\r
133 //      }\r
134 \r
135         // Some notifications should return a value when handled\r
136         return CFrame::OnNotify(wParam, lParam);\r
137 }\r
138 \r
139 void CMainFrame::SetupToolBar()\r
140 {\r
141         // Set the Resource IDs for the toolbar buttons\r
142         AddToolBarButton( IDM_FILE_NEW   );\r
143         AddToolBarButton( IDM_FILE_OPEN  );\r
144         AddToolBarButton( IDM_FILE_SAVE  );\r
145         \r
146         AddToolBarButton( 0 );                          // Separator\r
147         AddToolBarButton( IDM_EDIT_CUT,   FALSE );      // disabled button\r
148         AddToolBarButton( IDM_EDIT_COPY,  FALSE );      // disabled button\r
149         AddToolBarButton( IDM_EDIT_PASTE, FALSE );      // disabled button\r
150         \r
151         AddToolBarButton( 0 );                          // Separator\r
152         AddToolBarButton( IDM_FILE_PRINT );\r
153         \r
154         AddToolBarButton( 0 );                          // Separator\r
155         AddToolBarButton( IDM_HELP_ABOUT );\r
156 }\r
157 \r
158 LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
159 {\r
160 //      switch (uMsg)\r
161 //      {\r
162 //              Add case statements for each messages to be handled here\r
163 //      }\r
164 \r
165         // pass unhandled messages on for default processing\r
166         return WndProcDefault(uMsg, wParam, lParam);\r
167 }\r
168 \r

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