#pragma once
#include "afxwin.h"
#include "PMSetting.h"


// CSettingOptionPage 대화 상자입니다.

class CSettingOptionPage : public CPropertyPage
{
    DECLARE_DYNAMIC(CSettingOptionPage)

public:

    CSettingOptionPage(CPMSetting& pmSetting, CPropertySheet& ownerSheet);

    virtual ~CSettingOptionPage();

// 대화 상자 데이터입니다.
    enum { IDD = IDD_SETTING_OPTION };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 지원입니다.

    DECLARE_MESSAGE_MAP()

public:

    CPMSetting& GetPMSetting() { return m_pmSettingOption; }
    bool IsEmptyOption();

    // bSaveAndValidate가 true면,  셋업 맵의 데이터를 컨트롤로 저장
    // bSaveAndValidate가 false면, 컨트롤의 데이터를 셋업 맵으로 저장
    void UpdateSetupData(bool bSaveAndValidate = true);

private:

    virtual BOOL OnInitDialog();
    virtual BOOL OnSetActive();
    virtual BOOL OnKillActive();

    afx_msg void OnBnClickedBtnOptOldPkg();
    afx_msg void OnBnClickedBtnOptNewClient();
    afx_msg void OnBnClickedBtnOptNewPkg();
    afx_msg void OnBnClickedBtnOptManualPatchFile();
    afx_msg void OnBnClickedBtnOptManualSfxFile();

    afx_msg void OnBnClickedSaveSetup();
    afx_msg void OnBnClickedLoadSetup();
    afx_msg void OnCbnSelchangeCbOptOldPkgPos();
    
    afx_msg LRESULT OnEnableAutoPatchOption(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnDisableAutoPatchOption(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnEnableManualPatchOption(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnDisableManualPatchOption(WPARAM wParam, LPARAM lParam);

    void SetAutoPatchOption(bool bEnable);
    void SetManualPatchOption(bool bEnable);

    CComboBox   m_cbPatchType;

    CEdit       m_edOldPkgPos;
    CEdit       m_edNewClientPos;
    CEdit       m_edNewPkgPos;
    CEdit       m_edMaxPkgSize;
    
    CComboBox   m_cbPkgPos;
    CEdit       m_edFTPAddr;
    CEdit       m_edFTPPort;
    CButton     m_bFTPPassive;

    CEdit       m_edManualPatchFolder;
    CEdit       m_edManualPatchSFXFile;
    CEdit       m_edManualPatchMinVer;
    DWORD       m_dwManualPatchMinVer;

    CPMSetting&     m_pmSettingOption;
    CPropertySheet& m_OwnerSheet;
public:
    afx_msg void OnDestroy();
};
