#pragma once
#include "resource.h"

// CRefCharactChildDlg dialog

class CRefCharactChildDlg : public CaplTranslateDialog
{
	DECLARE_DYNAMIC(CRefCharactChildDlg)

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

// Dialog Data
	enum { IDD = IDD_REF_CHARACT };

	CaplButton m_new;
	CaplButton m_show;
	CaplButton m_del;

	CImageList imageList;
	CSortListCtrl m_list;

	CaplAPI *m_api;
	aplExtent m_aeDelCharact;
	aplExtent m_aeNewCharact;
	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()

	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);
};
