Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / PropertySheet / src / Mainfrm.cpp
1 ////////////////////////////////////////////////////\r
2 // Mainfrm.cpp\r
3 \r
4 #include "stdafx.h"\r
5 #include "mainfrm.h"\r
6 #include "resource.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++\\PropertySheet Sample"));\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_EXIT:\r
36                 // End the application\r
37                 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);\r
38                 return TRUE;\r
39         case IDM_MODELESS:\r
40                 // Permit only one Modeless property sheet\r
41                 if (!m_ModelessPS.IsWindow())\r
42                 {\r
43                         m_ModelessPS.AddPage(new CButtonPage(IDD_BUTTONS, _T("Buttons")));\r
44                         m_ModelessPS.AddPage(new CComboPage(IDD_COMBOBOXES, _T("Combo Boxes")));\r
45                         m_ModelessPS.SetTitle(_T("Modeless Property Sheet"));\r
46                         m_ModelessPS.Create(this);\r
47                 }\r
48                 return TRUE;\r
49         case IDM_MODAL:\r
50                 {\r
51                         CMyPropertySheet mps(_T("Modal Property Sheet"), this);\r
52                         mps.AddPage(new CButtonPage(IDD_BUTTONS, _T("Buttons")));\r
53                         mps.AddPage(new CComboPage(IDD_COMBOBOXES, _T("Combo Boxes")));\r
54                         mps.DoModal();\r
55                 }\r
56                 return TRUE;\r
57         case IDM_WIZARD:\r
58                 {\r
59                         CMyPropertySheet mps(NULL, this);\r
60                         mps.AddPage(new CButtonPage(IDD_BUTTONS, _T("Buttons")));\r
61                         mps.AddPage(new CComboPage(IDD_COMBOBOXES, _T("Combo Boxes")));\r
62                         mps.SetWizardMode(TRUE);\r
63                         mps.DoModal();\r
64                 }\r
65                 return TRUE;\r
66         case IDW_VIEW_STATUSBAR:\r
67                 OnViewStatusBar();\r
68                 return TRUE;\r
69         case IDW_VIEW_TOOLBAR:\r
70                 OnViewToolBar();\r
71                 return TRUE;\r
72         case IDM_HELP_ABOUT:\r
73                 // Display the help dialog\r
74                 OnHelp();\r
75                 return TRUE;\r
76         }\r
77 \r
78         return FALSE;\r
79 }\r
80 \r
81 void CMainFrame::OnCreate()\r
82 {\r
83         // OnCreate controls the way the frame is created.\r
84         // Overriding CFrame::Oncreate is optional.\r
85         // The default for the following variables is TRUE\r
86 \r
87         // m_bShowIndicatorStatus = FALSE;      // Don't show statusbar indicators\r
88         // m_bShowMenuStatus = FALSE;           // Don't show toolbar or menu status\r
89         // m_bUseReBar = FALSE;                         // Don't use rebars\r
90         // m_bUseThemes = FALSE;            // Don't use themes\r
91         // m_bUseToolBar = FALSE;                       // Don't use a toolbar\r
92         // m_bUseCustomDraw = FALSE;            // Don't use custom draw for menu items\r
93 \r
94         // call the base class function\r
95         CFrame::OnCreate();\r
96 }\r
97 \r
98 void CMainFrame::OnInitialUpdate()\r
99 {\r
100         // The frame is now created.\r
101         // Place any additional startup code here.\r
102 \r
103         TRACE(_T("Frame created\n"));\r
104 }\r
105 \r
106 void CMainFrame::SetupToolBar()\r
107 {\r
108         // Set the Resource IDs for the toolbar buttons\r
109         AddToolBarButton( IDM_FILE_NEW   );\r
110         AddToolBarButton( IDM_FILE_OPEN  );\r
111         AddToolBarButton( IDM_FILE_SAVE  );\r
112         AddToolBarButton( 0 );                          // Separator\r
113         AddToolBarButton( IDM_EDIT_CUT   );\r
114         AddToolBarButton( IDM_EDIT_COPY  );\r
115         AddToolBarButton( IDM_EDIT_PASTE );\r
116         AddToolBarButton( 0 );                          // Separator\r
117         AddToolBarButton( IDM_FILE_PRINT );\r
118         AddToolBarButton( 0 );                          // Separator\r
119         AddToolBarButton( IDM_HELP_ABOUT );\r
120 }\r
121 \r
122 LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
123 {\r
124 //      switch (uMsg)\r
125 //      {\r
126                 // Add case statements for each messages to be handled here\r
127 //      }\r
128 \r
129         // pass unhandled messages on for default processing\r
130         return WndProcDefault(uMsg, wParam, lParam);\r
131 }\r

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