//-----------------------------------------------------------------------------
#ifndef ValuesFromUserDlgH
#define ValuesFromUserDlgH ValuesFromUserDlgH
//-----------------------------------------------------------------------------
#include <wx/wx.h>
#include <wx/treectrl.h>
#include <wx/filename.h>
#include <map>
#include <vector>
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>

class wxSpinCtrl;

//-----------------------------------------------------------------------------
class OkAndCancelDlg : public wxDialog
//-----------------------------------------------------------------------------
{
	wxButton*					pBtnOk_;
	wxButton*					pBtnCancel_;
	void OnBtnOk( wxCommandEvent& );
	void OnBtnCancel( wxCommandEvent& );
protected:
	void AddButtons( wxWindow* pWindow, wxSizer* pSizer );
	void FinalizeDlgCreation( wxWindow* pWindow, wxSizer* pSizer );
	//-----------------------------------------------------------------------------
	enum TWidgetIDs
	//-----------------------------------------------------------------------------
	{
		widBtnOk = 1,
		widBtnCancel = 2,
		widFirst = 100,
	};
public:
	explicit OkAndCancelDlg( wxWindow* pParent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("OkAndCancelDlg") );
	// any class wishing to process wxWidgets events must use this macro
	DECLARE_EVENT_TABLE()
};

//-----------------------------------------------------------------------------
struct ValueData
//-----------------------------------------------------------------------------
{
	wxString caption_;
	explicit ValueData( const wxString& caption ) : caption_(caption) {}
	virtual ~ValueData() {}
};

//-----------------------------------------------------------------------------
struct ValueRangeData : public ValueData
//-----------------------------------------------------------------------------
{
	int min_;
	int max_;
	int inc_;
	int def_;
	explicit ValueRangeData( const wxString& caption, int min, int max, int inc, int def ) : ValueData(caption), min_(min), max_(max), inc_(inc), def_(def) {}
};

//-----------------------------------------------------------------------------
struct ValueChoiceData : public ValueData
//-----------------------------------------------------------------------------
{
	wxArrayString choices_;
	explicit ValueChoiceData( const wxString& caption, const wxArrayString& choices ) : ValueData(caption), choices_(choices) {}
};

//-----------------------------------------------------------------------------
class ValuesFromUserDlg : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	std::vector<wxControl*>		ctrls_;
	std::vector<int>			userInputData_;
public:
	explicit ValuesFromUserDlg( wxWindow* pParent, const wxString& title, const std::vector<ValueData*>& inputData );
	const std::vector<wxControl*>& GetUserInputControls( void ) const { return ctrls_; }
};

typedef std::map<wxString, wxString> StringToStringMap;

//-----------------------------------------------------------------------------
class SettingHierarchyDlg : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	void ExpandAll( wxTreeCtrl* pTreeCtrl );
	void ExpandAllChildren( wxTreeCtrl* pTreeCtrl, const wxTreeItemId& item );
	void PopulateTreeCtrl( wxTreeCtrl* pTreeCtrl, wxTreeItemId currentItem, const wxString& currentItemName, const StringToStringMap& settingRelationships );
public:
	explicit SettingHierarchyDlg( wxWindow* pParent, const wxString& title, const StringToStringMap& settingRelationships );
};

//-----------------------------------------------------------------------------
class DriverInformationDlg : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	wxTreeItemId AddComponentListToList( wxTreeCtrl* pTreeCtrl, wxTreeItemId parent, mvIMPACT::acquire::ComponentLocator locator, const char* pName );
	void AddStringPropToList( wxTreeCtrl* pTreeCtrl, wxTreeItemId parent, mvIMPACT::acquire::ComponentLocator locator, const char* pName );
	void ExpandAll( wxTreeCtrl* pTreeCtrl );
	void ExpandAllChildren( wxTreeCtrl* pTreeCtrl, const wxTreeItemId& item );
	void PopulateTreeCtrl( wxTreeCtrl* pTreeCtrl, mvIMPACT::acquire::ComponentIterator itDrivers );
public:
	explicit DriverInformationDlg( wxWindow* pParent, const wxString& title, mvIMPACT::acquire::ComponentIterator itDrivers );
};

class ImageCanvas;

typedef std::map<HOBJ, std::vector<ImageCanvas*>::size_type> SettingToDisplayDict;
typedef std::vector<ImageCanvas*> DisplayWindowContainer;

//-----------------------------------------------------------------------------
class AssignSettingsToDisplaysDlg : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	std::vector<wxControl*> ctrls_;
public:
	explicit AssignSettingsToDisplaysDlg( wxWindow* pParent, const wxString& title, const std::vector<std::pair<std::string, int> >& settings, const SettingToDisplayDict& settingToDisplayDict, size_t displayCount );
	const std::vector<wxControl*>& GetUserInputControls( void ) const { return ctrls_; }
};

class PropViewFrame;

//-----------------------------------------------------------------------------
class RawImageImportDlg : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	PropViewFrame* pParent_;
	wxComboBox* pCBPixelFormat_;
	wxComboBox* pCBBayerParity_;
	wxSpinCtrl* pSCWidth_;
	wxSpinCtrl* pSCHeight_;
public:
	explicit RawImageImportDlg( PropViewFrame* pParent, const wxString& title, const wxFileName& fileName );
	wxString GetFormat( void ) const;
	wxString GetPixelFormat( void ) const { return pCBPixelFormat_->GetValue(); }
	wxString GetBayerParity( void ) const { return pCBBayerParity_->GetValue(); }
	long GetWidth( void ) const;
	long GetHeight( void ) const;
};

#endif // ValuesFromUserDlgH
