// win32mineDoc.h : Cwin32mineDoc 類別的介面
//


#pragma once

#include "../GraphicOutput.h"

class Cwin32mineDoc : public CDocument, public CGraphicOutput
{
protected: // 僅從序列化建立
	Cwin32mineDoc();
	DECLARE_DYNCREATE(Cwin32mineDoc)

// 屬性
private:
    int m_width;
    int m_height;

// 作業
public:

// 覆寫
public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
    virtual void OnCloseDocument();

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

protected:

// 產生的訊息對應函式
protected:
	DECLARE_MESSAGE_MAP()
public:
    // width of the game board
    int GetBoardWidth(void);
    // height of the game board
    int GetBoardHeight(void);

private:
    int m_cells[MAXBOARDSIZE][MAXBOARDSIZE];
    int m_mineCount;
    int m_resetStatus;
    int m_clockTicks;
    int m_level;
    int m_mineCountOriginal;

public:
    CELLROWPTR GetCells(void);
    int GetMineCount(void);
    int GetResetStatus(void);
    int GetClockTicks(void);
    void resetBtnPressed(void);
    void resetBtnReleased(void);
    void SetBoardSize(int width, int height);
    CActionHandler * GetHandler(void);
    void SetClock(int tick);

public:
    afx_msg void OnNewgame();
    afx_msg void OnBeginner();
    afx_msg void OnUpdateBeginner(CCmdUI *pCmdUI);
    afx_msg void OnIntermediate();
    afx_msg void OnUpdateIntermediate(CCmdUI *pCmdUI);
    afx_msg void OnAdvanced();
    afx_msg void OnUpdateAdvanced(CCmdUI *pCmdUI);

/* CGraphicOutput */
public:
    void showFrawn();
    void showSmile();
    void showCell(int irow, int icol);
    void showFlag(int irow, int icol);
    void showBlastedMine(int irow, int icol);
    void showMine(int irow, int icol);
    void showQuestionMark(int irow, int icol);
    void showSurroundingMineCount(int count, int irow, int icol);
    void setRemainingMineCount(int count);
    void startClock();
    void stopClock();
    void resetClock();
};
