#if !defined(AFX_SELECTQUANTITY_H__FD7AFD8F_7FF7_48B3_BE9B_70568F5343A7__INCLUDED_)
#define AFX_SELECTQUANTITY_H__FD7AFD8F_7FF7_48B3_BE9B_70568F5343A7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SelectQuantity.h : header file
//
#include "resource.h"
#include <StepData.h>
#include <aplNetStepData.h>
#include "ResizableDialog.h" 
#include "CheckTreeCtrl.h"


struct SSelectQuantityItemData
{
	SSelectQuantityItemData(){inst=0;parent_rel=0;item=0;};
	SSelectQuantityItemData(CaplInstance* _inst,CaplInstance* _parent_rel){inst=_inst;parent_rel=_parent_rel;};
	CaplInstance* inst;
	HTREEITEM item;
	CaplInstance* parent_rel;
};

/////////////////////////////////////////////////////////////////////////////
// CSelectQuantity dialog

class CSelectQuantity : public CResizableDialog
{
// Construction
public:
	CSelectQuantity(CWnd* pParent = NULL);   // standard constructor
//	CaplNetStepData * m_data;
//	CaplAutorizationManager * m_appr;
//	CaplCategoryManager * m_catg;
//	CaplCharacteristicManager * m_char;
//	CaplDocManager * m_doc;
//	CaplProductManager * m_prMan;
	CaplEntity * ent;
	CString m_sel;
	aplExtent *ext, *ext_all, *ext_rel;
	bool flag;

	CaplAPI* m_api;

	CaplTAggr <SSelectQuantityItemData*,SSelectQuantityItemData*,APLAGGR_AUTOKILLREF> all_item;

// Dialog Data
	//{{AFX_DATA(CSelectQuantity)
	enum { IDD = IDD_SELECTQUANT };
	CButton	m_BtnExpandAll;
	CButton	m_BtnCollapseAll;
	CButton	m_check;
	CListCtrl	m_listQuant;
	CCheckTreeCtrl	m_tree;
	//}}AFX_DATA

	void InsertItemInTree(SSelectQuantityItemData *data,HTREEITEM parent);

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

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CSelectQuantity)
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnSelectAll();
	afx_msg void OnDeselectAll();
	afx_msg void OnExpandAll();
	afx_msg void OnCollapseAll();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_SELECTQUANTITY_H__FD7AFD8F_7FF7_48B3_BE9B_70568F5343A7__INCLUDED_)
