
// GUIComplexCalcView.h : CGUIComplexCalcView 類別的介面
//

#pragma once

#include "Complex.h"

class CGUIComplexCalcView : public CView
{
protected: // 僅從序列化建立
	CGUIComplexCalcView();
	DECLARE_DYNCREATE(CGUIComplexCalcView)

// 屬性
public:
	CGUIComplexCalcDoc* GetDocument() const;

// 作業
public:

// 覆寫
public:
	virtual void OnDraw(CDC* pDC);  // 覆寫以描繪此檢視
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 程式碼實作
public:
	virtual ~CGUIComplexCalcView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// 產生的訊息對應函式
protected:
	afx_msg void OnFilePrintPreview();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	DECLARE_MESSAGE_MAP()
public:
    virtual void OnInitialUpdate();
private:
    double m_cxInch, m_cyInch;
    CRect m_rectClient;
    CRect m_rectHit;
    Complex m_endPt, m_startPt, m_resultPt;
    int m_typeOfOperation;
    Complex pointToComplex(CPoint point);
public:
    virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnAdd();
    afx_msg void OnUpdateAdd(CCmdUI *pCmdUI);
    afx_msg void OnDivide();
    afx_msg void OnUpdateDivide(CCmdUI *pCmdUI);
    afx_msg void OnMultiply();
    afx_msg void OnUpdateMultiply(CCmdUI *pCmdUI);
    afx_msg void OnSubtract();
    afx_msg void OnUpdateSubtract(CCmdUI *pCmdUI);
    afx_msg void OnAppExit();
    afx_msg void OnAppAbout();
};

#ifndef _DEBUG  // GUIComplexCalcView.cpp 中的偵錯版本
inline CGUIComplexCalcDoc* CGUIComplexCalcView::GetDocument() const
   { return reinterpret_cast<CGUIComplexCalcDoc*>(m_pDocument); }
#endif

