//
//  mainfrm.h - main form class header file
//
//  $Id: mainfrm.h 54 2014-04-11 01:06:56Z brian $ 
//
//  Copyright (c) 1999-2014 by Precision Micro Control Corp. All rights reserved.
//
#ifndef MAINFRM_H
#define MAINFRM_H

/// <summary>
/// Mainframe object
/// </summary>
class CMainFrame : public CMDIFrameWnd
{
	DECLARE_DYNAMIC(CMainFrame)
public:
	/// <summary>Constructor.</summary>
	CMainFrame() {}
	/// <summary>Destructor.</summary>
	virtual ~CMainFrame() {}
	
	/// <summary>Override default to save window size.</summary>
	BOOL						DestroyWindow(void);
	/// <summary>Initial update handler.</summary>
	void						InitialUpdate(void);

#ifdef _DEBUG
	/// <summary>Debug frame check handler.</summary>
	virtual void				AssertValid() const { CMDIFrameWnd::AssertValid(); }
	/// <summary>Debug context dump handler.</summary>
	virtual void				Dump(CDumpContext& dc) const { CMDIFrameWnd::Dump(dc); }
#endif

protected:
	/// <summary>OnCreate message handler.</summary>
	/// <param name="create_struct">Creation parameter structure.</param>
	afx_msg int					OnCreate(LPCREATESTRUCT create_struct);
	/// <summary>OnTimer message handler.</summary>
	/// <param name="nIDEvent">Timer ID.</param>
	afx_msg void				OnTimer(UINT nIDEvent);
	/// <summary>OnFileLoad message handler.</summary>
	afx_msg void				OnFileLoad();

	/// <summary>Update X Zero message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateXZero(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateXZero(pCmdUI); }
	/// <summary>Update Y Zero message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateYZero(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateYZero(pCmdUI); }
	/// <summary>Update Z Zero message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateZZero(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateZZero(pCmdUI); }
	
	/// <summary>Update X Plus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateXPlus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateXPlus(pCmdUI); }
	/// <summary>Update Y Plus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateXMinus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateXMinus(pCmdUI); }
	/// <summary>Update Z Plus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateYPlus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateYPlus(pCmdUI); }

	/// <summary>Update X Minus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateYMinus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateYMinus(pCmdUI); }
	/// <summary>Update Y Minus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateZPlus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateZPlus(pCmdUI); }
	/// <summary>Update Z Minus message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateZMinus(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateZMinus(pCmdUI); }
	
	/// <summary>Start message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateStart(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateStart(pCmdUI); }
	/// <summary>Block message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateBlock(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateBlock(pCmdUI); }
	/// <summary>Feedhold message handler.</summary>
	/// <param name="pCmdUI">UI element.</param>
	void						OnUpdateFhold(CCmdUI* pCmdUI) { m_wndControlPanel.OnUpdateFhold(pCmdUI); }
	
	/// <summary>Feed override focus message handler.</summary>
	void						OnKillfocusFeedOverride() { m_wndControlPanel.OnKillfocusFeedOverride(); }
	/// <summary>Rapid override focus message handler.</summary>
	void						OnKillfocusRapidOverride() { m_wndControlPanel.OnKillfocusRapidOverride(); }
	/// <summary>Spindle override focus message handler.</summary>
	void						OnKillfocusSpindleOverride() { m_wndControlPanel.OnKillfocusSpindleOverride(); }

protected:
	AppSettings					m_app_settings;					///< global application settings
	CStatusBar					m_wndStatusBar;					///< status bar
	CToolBar					m_wndToolBar;					///< tool bar
	ControlPanel				m_wndControlPanel;				///< control panel

	DECLARE_MESSAGE_MAP()
};

#endif			// MAINFRM_H

