X-Git-Url: https://git.ucc.asn.au/?p=matches%2Fhonours.git;a=blobdiff_plain;f=research%2Ftransmission_spectroscopy%2FTOF%2FWin32%2B%2B%2Fsamples%2FFrame%2Fsrc%2FMainfrm.cpp;fp=research%2Ftransmission_spectroscopy%2FTOF%2FWin32%2B%2B%2Fsamples%2FFrame%2Fsrc%2FMainfrm.cpp;h=3151bea6c1e8c8355262d87babb310981e4fd7de;hp=0000000000000000000000000000000000000000;hb=70a96cca12cb006506461d26cd112bab179fe74c;hpb=8caf60af39689a3546074f0c68d14c3a2e28191e diff --git a/research/transmission_spectroscopy/TOF/Win32++/samples/Frame/src/Mainfrm.cpp b/research/transmission_spectroscopy/TOF/Win32++/samples/Frame/src/Mainfrm.cpp new file mode 100644 index 00000000..3151bea6 --- /dev/null +++ b/research/transmission_spectroscopy/TOF/Win32++/samples/Frame/src/Mainfrm.cpp @@ -0,0 +1,168 @@ +//////////////////////////////////////////////////// +// Mainfrm.cpp + +#include "stdafx.h" +#include "resource.h" +#include "mainfrm.h" + + +// Definitions for the CMainFrame class +CMainFrame::CMainFrame() +{ + // Constructor for CMainFrame. Its called after CFrame's constructor + + //Set m_View as the view window of the frame + SetView(m_View); + + // Set the registry key name, and load the initial window position + // Use a registry key name like "CompanyName\\Application" + LoadRegistrySettings(_T("Win32++\\Frame")); +} + +CMainFrame::~CMainFrame() +{ + // Destructor for CMainFrame. +} + +BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) +{ + // OnCommand responds to menu and and toolbar input + + UNREFERENCED_PARAMETER(lParam); + + switch(LOWORD(wParam)) + { + case IDM_FILE_OPEN: + // Refer to the tutorial for an example of OnFileOpen + OnFileOpen(); + return TRUE; + case IDM_FILE_SAVE: + // Refer to the tutorial for an example of OnFileSave + OnFileSave(); + return TRUE; + case IDM_FILE_SAVEAS: + // Refer to the tutorial for an example of OnFileSaveAs + OnFileSave(); + return TRUE; + case IDM_FILE_PRINT: + OnFilePrint(); + return TRUE; + case IDM_FILE_EXIT: + // End the application + ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); + return TRUE; + case IDW_VIEW_STATUSBAR: + OnViewStatusBar(); + return TRUE; + case IDW_VIEW_TOOLBAR: + OnViewToolBar(); + return TRUE; + case IDM_HELP_ABOUT: + // Display the help dialog + OnHelp(); + return TRUE; + } + + return FALSE; +} + +void CMainFrame::OnCreate() +{ + // OnCreate controls the way the frame is created. + // Overriding CFrame::Oncreate is optional. + // The default for the following variables is TRUE + + // m_bShowIndicatorStatus = FALSE; // Don't show statusbar indicators + // m_bShowMenuStatus = FALSE; // Don't show toolbar or menu status + // m_bUseReBar = FALSE; // Don't use rebars + // m_bUseThemes = FALSE; // Don't use themes + // m_bUseToolBar = FALSE; // Don't use a toolbar + + // call the base class function + CFrame::OnCreate(); +} + +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + TRACE(_T("Frame created\n")); +} + +void CMainFrame::OnFileOpen() +{ + // Bring up the dialog, and open the file + CFile File; + CString str = File.OpenFileDialog(0, 0, 0, 0); + + // TODO: + // Add your own code here. Refer to the tutorial for additional information +} + +void CMainFrame::OnFileSave() +{ + CFile File; + CString str = File.SaveFileDialog(0, 0, 0, 0, 0); + + // TODO: + // Add your own code here. Refer to the tutorial for additional information +} + +void CMainFrame::OnFilePrint() +{ + // Bring up a dialog to choose the printer + PRINTDLG pd = {0}; + pd.lStructSize = sizeof( pd ); + pd.Flags = PD_RETURNDC; + pd.hwndOwner = m_hWnd; + + // Retrieve the printer DC + PrintDlg( &pd ); + + // TODO: + // Add your own code here. Refer to the tutorial for additional information +} + +LRESULT CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam) +{ + // Process notification messages sent by child windows +// switch(((LPNMHDR)lParam)->code) +// { + //Add case statments for each notification message here +// } + + // Some notifications should return a value when handled + return CFrame::OnNotify(wParam, lParam); +} + +void CMainFrame::SetupToolBar() +{ + // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ +// switch (uMsg) +// { +// Add case statements for each messages to be handled here +// } + + // pass unhandled messages on for default processing + return WndProcDefault(uMsg, wParam, lParam); +} +