#pragma once
#include "../../Resource.h"
namespace ComSupport
{
class CTypeLibraryData
{
public:
	
	CString m_strCLSIDTypeLib;
	CString m_strDescription;
	long m_lMajorVersion;
	long m_lMinorVersion;
};

// CPlamTypeLibBrowserDlg dialog
class CPlamTypeLibBrowserDlg : public CDialog
{
public:
	CPlamTypeLibBrowserDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CPlamTypeLibBrowserDlg();

private:
	CArray<CTypeLibraryData>	m_arr_tld_Category;
	CArray< CComPtr<ITypeInfo> >  m_arr_spti_Objects;

	CString m_strProgID;

	CImageList m_ImgList;
	void InitListColumn();
	void SetElements(const CComPtr<ITypeInfo>& spCoClass);
	void SetElements_internal(const CComPtr<ITypeInfo>& spCurrentTypeInfo);
	enum ICON_TYPES
	{
		_OBJECT_	=0,
		_METHOD_	=1,
		_PROPERTY_	= 2,
	};



	void PopulateCategoryList();
	void ShowCategory(const CTypeLibraryData& oData);
	void ShowCategory(const CComPtr<ITypeLib>& spTypeLib);
	void ShowObject(const CComPtr<ITypeInfo>& spCoClass);


// Dialog Data
	enum { IDD = IDD_PLAMOBJECTBROWSER_DIALOG1 };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	CListBox m_ctrl_lb_Category;
	CListBox m_ctrl_lb_Object;
	CListCtrl m_ctrl_lb_TypeInfo;

	afx_msg void OnLbnSelchangeListCategory();
	afx_msg void OnLbnSelchangeListObject();
	afx_msg void OnBnClickedCancel();
	CString m_str_SampleCode;
	CString m_strTpeLib2Load;
	afx_msg void OnBnClickedButtonLoadtypelib();
	afx_msg void OnLbnSelchangeListTypeinfo(NMHDR *,LRESULT *);
};
};