// CfgComboBox.h : header file
//
#if !defined(_CFGCOMBOBOX_H_)
#define _CFGCOMBOBOX_H_

#include <map>
#include "cmString.h"

using namespace std;

/////////////////////////////////////////////////////////////////////////////
// CAsComboBox window

class CCfgComboBox : public CComboBox
{
// Construction
public:
	CCfgComboBox();

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCfgComboBox)
	public:
	virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CCfgComboBox();
	
	void Clear();

	virtual void AddItem(const cmString& s);
	virtual void AddItem(const cmString& s, double sortKey);
	virtual void AddItem(const cmString& s, int sortKey);
	virtual void AddItem(const cmString& s, const cmString& sortKey);

	virtual void SelectItem(double sortKey);
	virtual void SelectItem(int sortKey);
	virtual void SelectItem(const cmString& sortKey);

	virtual bool GetSelKey(double& sortKey);
	virtual bool GetSelKey(int& sortKey);
	virtual bool GetSelKey(cmString& sortKey);
	virtual cmString stringGetSelString();

	// Generated message map functions
protected:
	//{{AFX_MSG(CCfgComboBox)
	afx_msg void OnDropdown();
	afx_msg void OnCloseup();
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnPaint();
	//afx_msg void OnSelchange();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP();
	
	void Draw(CDC* pDC, CRect clientRect);
	void DrawComboButton(CDC* pDC, CRect clientRect);
	void DrawBackground(CDC* pDC, CRect clientRect);
	void BuildList();

	CRect listRect_;
	CRect basicRect_;
	HWND hwndList_;
	bool droppedDown_;
	int dropAreaHeight_;
	CRect buttonArea_;

	map<cmString, cmString> sortKeyToValueMap_;
	map<cmString, cmString> valueToSortKeyMap_;
};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(_CFGCOMBOBOX_H_)
