//-----------------------------------------------------------------------------
#ifndef WizardSaturationH
#define WizardSaturationH WizardSaturationH
//-----------------------------------------------------------------------------
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>
#include "ValuesFromUserDlg.h"
#include "spinctld.h"

class wxCheckBox;
class wxSlider;
class wxTextCtrl;
class wxToggleButton;

//-----------------------------------------------------------------------------
class WizardSaturation : public OkAndCancelDlg
//-----------------------------------------------------------------------------
{
	DECLARE_EVENT_TABLE()
protected:
	//-----------------------------------------------------------------------------
	enum TWidgetIDs_Saturation
	//-----------------------------------------------------------------------------
	{
		widMainFrame = widFirst,
		widCBEnable,
		widSLSaturation,
		widSCSaturation,
		widTBDetails
	};
	wxCheckBox*							pCBEnable_;
	wxSlider*							pSLSaturation_;
	wxSpinCtrlDbl*						pSCSaturation_;
	wxToggleButton*						pTBDetails_;
	wxTextCtrl*							pTCSaturationHints_;
	wxBoxSizer*							pTopDownSizer_;
	bool								boGUICreated_;

	void ApplySaturation( void );
	virtual void ApplySaturation( const bool boEnable, const double K ) = 0;
	void CreateGUI( void );
	void OnBtnDetails( wxCommandEvent& e )            { ToggleDetails( e.IsChecked() ); }
	virtual void OnBtnCancel( wxCommandEvent& )       { Hide(); }
	virtual void OnBtnOk( wxCommandEvent& )           { Hide(); }
	void OnCBEnable( wxCommandEvent& )                { ApplySaturation(); }
	void OnSLSaturation( wxScrollEvent& e )           { pSCSaturation_->SetValue( static_cast<double>(e.GetPosition()) / 1000. ); ApplySaturation(); }
	void OnSCSaturationChanged( wxSpinEvent& )        { pSLSaturation_->SetValue( static_cast<int>(pSCSaturation_->GetValue() * 1000.) ); ApplySaturation(); }
	void OnSCSaturationTextChanged( wxCommandEvent& ) { pSLSaturation_->SetValue( static_cast<int>(pSCSaturation_->GetValue() * 1000.) ); ApplySaturation(); }
	void ToggleDetails( bool boShow );
public:
	explicit WizardSaturation( wxWindow* pParent, const wxString& title );
	virtual void RefreshControls( void ) = 0;
};

//-----------------------------------------------------------------------------
class WizardSaturationViaColorTwist : public WizardSaturation
//-----------------------------------------------------------------------------
{
	mvIMPACT::acquire::ImageProcessing ip_;
protected:
	virtual void ApplySaturation( const bool boEnable, const double K );
public:
	explicit WizardSaturationViaColorTwist( wxWindow* pParent, const wxString& title, mvIMPACT::acquire::Device* pDev );
	virtual void RefreshControls( void ) { pCBEnable_->SetValue( ( ip_.colorTwistEnable.read() == bTrue ) ? true : false ); WizardSaturation::ApplySaturation(); }
};

//-----------------------------------------------------------------------------
class WizardSaturationViaColorTransformationControl : public WizardSaturation
//-----------------------------------------------------------------------------
{
	mvIMPACT::acquire::GenICam::ColorTransformationControl ctc_;
protected:
	virtual void ApplySaturation( const bool boEnable, const double K );
public:
	explicit WizardSaturationViaColorTransformationControl( wxWindow* pParent, const wxString& title, mvIMPACT::acquire::Device* pDev );
	virtual void RefreshControls( void ) { pCBEnable_->SetValue( ( ctc_.colorTransformationEnable.read() == bTrue ) ? true : false ); WizardSaturation::ApplySaturation(); }
};

#endif // WizardSaturationH
