//---------------------------------------------------------------------------

#ifndef ChordPanelH
#define ChordPanelH

#include "ContentPanelUnit.h"
#include "ToolpalPanel.h"
#include "TextButton.h"

enum CONCORD_TYPE{
	c_Type_Maj,
	c_Type_Min,
	c_Type_Dom7,
	c_Type_Min7,
	c_Type_Sus2,
	c_Type_Sus4,
	c_Type_Sus6,
	c_Type_Maj7,
	c_Type_Num
};
//---------------------------------------------------------------------------

class TChordPanel : public TToolpalPanel
{
private:
	TContentPanel* m_pContentPanel; //ÄÚÈÝÃæ°å¾ä±ú

	TTextButton	*m_aMainKeys[7],
				*m_aAdjustKeys[2],
				*m_aChordTypes[c_Type_Num];
	TLabel *m_lblName,
			*m_lblType;

	int m_nTextHeight;
	int m_iMainKey, m_iAdjustKey, m_iChordType, m_iMelodyKey;
	bool m_bEnable;

	void EnableAdjustKey( int iMainKey, int iAdjustKey );
	void EnableChordType( int iMainKey );
	int MainKeyTag( int index );
	int GetChordKey();


	void __fastcall MainKeyClick( TObject* Sender );
	void __fastcall AdjustKeyClick( TObject* Sender );
	void __fastcall ChordTypeClick( TObject* Sender );
	void __fastcall KeyModeClick( TObject* Sender );
protected:
	MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
	END_MESSAGE_MAP(TToolpalPanel)

	virtual void __fastcall CreateWnd();

public:
	__fastcall virtual TChordPanel(System::Classes::TComponent* AOwner);
	__fastcall ~TChordPanel();

	void SetKeyMode( bool bAlpha );
	void __fastcall SetMelodyKey( int iKey );
	void __fastcall SetContentPanel( TContentPanel* pPanel ){ m_pContentPanel=pPanel; };
	void __fastcall SetChord( int iMainKey, int iAdjustKey, int iChordType );
	void __fastcall EnableChordModify( bool bEnable, int iBarKey, int iChordKey, int iChordType );
};

//---------------------------------------------------------------------------

#endif
