#pragma once
#include "resource.h"

// CRefApprovalChildDlg dialog

class CRefApprovalChildDlg : public CaplTranslateDialog
{
	DECLARE_DYNAMIC(CRefApprovalChildDlg)

public:
	CRefApprovalChildDlg(CaplAPI *api, CWnd* pParent = NULL);   // standard constructor
	virtual ~CRefApprovalChildDlg();

// Dialog Data
	enum { IDD = IDD_REF_APPR };

	CaplButton m_new;
	CaplButton m_show;
	CaplButton m_del;

	CImageList imageList;
	CSortListCtrl m_list;

	CaplAPI *m_api;
	aplExtent m_aeDelAppr;
	aplExtent m_aeNewAppr;
	CaplInstance *m_ciRef;
	CaplInstance *m_ciTmpRef;

	void InitBtns();
	void InitList();
	void FillList();
	void AddString(CaplInstance *ciAppr, int nIndex = -1);
	void DiscardChanges();
	void UpdateToolBar();
	void SaveRefData(CaplInstance *ciRef, bool bDelTmpInst);

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();
	virtual void OnCancel();
	virtual void OnOK();

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedNew();
	afx_msg void OnBnClickedShow();
	afx_msg void OnBnClickedDel();
	afx_msg void OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult);
};
