#if !defined(AFX_BPINSTDLG_H__D6216713_53A9_47E7_B030_18445E14F864__INCLUDED_)
#define AFX_BPINSTDLG_H__D6216713_53A9_47E7_B030_18445E14F864__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BPInstDlg.h : header file
//
#include "resource.h"
#include <apl_gui.h>
#include "ResizableDialog.h" 
#include "apl_api.h"

#include "aplCharactView.h"
#include "aplApprovalView.h"
#include "aplDocsView.h"
#include "aplAccessView.h"
/////////////////////////////////////////////////////////////////////////////
// CBPInstDlg dialog

class CBPInstDlg : public CResizableDialog
{
// Construction
protected:
	aplExtent m_bp_inst_ref_contexts;
	bool m_context_changed;
	bool m_changed_aggr;
	CBitmap m_name_bmp;
	CBitmap m_name_qm_bmp;
	CBitmap m_ico_bmp;
public:
	CBPInstDlg(CWnd* pParent = NULL);   // standard constructor
	CaplInstance *m_bp_inst_ref;
	CaplAPI *m_api;
	CaplInstance *m_inst;
	CaplInstance *m_bp,*m_item,*m_context,*m_base_bp_inst;
	bool m_add_mode;
	bool m_ReadOnly;

	void UpdateElements();
	bool SaveChanges();
	void SetReadOnlyItems();
	bool CreateSubBPInst();


	CString			m_csAccessString;

	BOOL			SetAnchors(void);
	BOOL			InitViews(void);
	void			ChangeViewBtnsState(BOOL bDis,BOOL bHide);
	void			GetAccessString(void);

// Dialog Data
	//{{AFX_DATA(CBPInstDlg)
	enum { IDD = IDD_BP_INST_DLG };
	CDateTimeCtrl	m_time_ctrl;
	CDateTimeCtrl	m_date_ctrl;
	CButton	m_bp_sel_btn;
	CEdit	m_bp_ctrl;
	CEdit	m_context_names_ctrl;
	CListCtrl	m_elements;
	CStatic	m_st_bp_name;
	CStatic	m_st_action_ico;
	CaplButton	m_add_btn;
	CaplButton	m_bottom_btn;
	CaplButton	m_context_sel_btn;
	CaplButton	m_top_btn;
	CaplButton	m_cancel_btn;
	CaplButton	m_ok_btn;
	CStatic	m_context_text_ctrl;
	CEdit	m_name_ctrl;
	CEdit	m_id_ctrl;
	CEdit	m_descr_ctrl;
	CString	m_id;
	CString	m_descr;
	CString	m_name;
	CString	m_bp_id;
	CaplTabCtrl	m_Tab;
	CaplButton	m_bPropsProps;
	CaplButton	m_bPropsDel;
	CaplButton	m_bPropsAdd;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBPInstDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	bool PointToVal(CPoint *point, int &i,CaplInstance **inst);
	// Generated message map functions
	//{{AFX_MSG(CBPInstDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnContextSel();
	virtual void OnOK();
	afx_msg void OnSelectBpBtn();
	afx_msg void OnElBottom();
	afx_msg void OnElTop();
	afx_msg void OnAddBpInst();
	afx_msg void OnDblclkElements(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnStActionName();
	afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBPropsAddBpi();
	afx_msg void OnBPropsDelBpi();
	afx_msg void OnBPropsPropsBpi();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BPINSTDLG_H__D6216713_53A9_47E7_B030_18445E14F864__INCLUDED_)
