Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / GDIPlus / 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         // m_bUseCustomDraw = FALSE;            // Don't use custom draw for menu items\r
81 \r
82         // call the base class function\r
83         CFrame::OnCreate();\r
84 }\r
85 \r
86 void CMainFrame::OnInitialUpdate()\r
87 {\r
88         // The frame is now created.\r
89         // Place any additional startup code here.\r
90 \r
91         TRACE(_T("Frame created\n"));\r
92 }\r
93 \r
94 void CMainFrame::OnFileOpen()\r
95 {\r
96         // Bring up the file open dialog\r
97         CFile File;\r
98         CString str = File.OpenFileDialog(0, 0, 0, 0);\r
99 \r
100         // TODO:\r
101         // Add your own code here. Refer to the tutorial for additional information \r
102 }\r
103 \r
104 void CMainFrame::OnFileSave()\r
105 {\r
106         // Bring up the file save dialog.\r
107         CFile File;\r
108         CString str = File.SaveFileDialog(0, 0, 0, 0, 0);\r
109 \r
110         // TODO:\r
111         // Add your own code here. Refer to the tutorial for additional information \r
112 }\r
113 \r
114 void CMainFrame::OnFilePrint()\r
115 {\r
116         // Bring up a dialog to choose the printer\r
117         PRINTDLG pd = {0};\r
118         pd.lStructSize = sizeof( pd );\r
119         pd.Flags = PD_RETURNDC;\r
120         pd.hwndOwner = m_hWnd;\r
121 \r
122         // Retrieve the printer DC\r
123         PrintDlg( &pd );\r
124         \r
125         // TODO:\r
126         // Add your own code here. Refer to the tutorial for additional information \r
127 }\r
128 \r
129 LRESULT CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam)\r
130 {\r
131         // Process notification messages sent by child windows\r
132 //      switch(((LPNMHDR)lParam)->code)\r
133 //      {\r
134                 //Add case statments for each notification message here\r
135 //      }\r
136 \r
137         // Some notifications should return a value when handled\r
138         return CFrame::OnNotify(wParam, lParam);\r
139 }\r
140 \r
141 void CMainFrame::SetupToolBar()\r
142 {\r
143         // Set the Resource IDs for the toolbar buttons\r
144         AddToolBarButton( IDM_FILE_NEW   );\r
145         AddToolBarButton( IDM_FILE_OPEN  );\r
146         AddToolBarButton( IDM_FILE_SAVE  );\r
147         \r
148         AddToolBarButton( 0 );                          // Separator\r
149         AddToolBarButton( IDM_EDIT_CUT,   FALSE );      // disabled button\r
150         AddToolBarButton( IDM_EDIT_COPY,  FALSE );      // disabled button\r
151         AddToolBarButton( IDM_EDIT_PASTE, FALSE );      // disabled button\r
152         \r
153         AddToolBarButton( 0 );                          // Separator\r
154         AddToolBarButton( IDM_FILE_PRINT );\r
155         \r
156         AddToolBarButton( 0 );                          // Separator\r
157         AddToolBarButton( IDM_HELP_ABOUT );\r
158 }\r
159 \r
160 LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
161 {\r
162 //      switch (uMsg)\r
163 //      {\r
164 //              Add case statements for each messages to be handled here\r
165 //      }\r
166 \r
167         // pass unhandled messages on for default processing\r
168         return WndProcDefault(uMsg, wParam, lParam);\r
169 }\r
170 \r

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