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

#ifndef AudStylePanelH
#define AudStylePanelH

#include "StylePanel.h"
#include "StyleSelPanel.h"
//---------------------------------------------------------------------------
class TAudStylePanel : public TStylePanel
{
private:
	bool IsCollected( UINT idLoc, UINT idStyle );
	DWORD GetStyleOptions( TPROSTYLE* info );
	void RefreshList();
	void StyleRename();

	int m_iListType;
	int m_nBtnCount;
	bool m_bDoubleClick;

	TTimer *m_RenameTimer;

protected:
	TStyleSelPanel *m_SearchPanel;      //搜索面板

	void SetDownload( TCommonItem *pItem );
	TStyleItem* CreateInstrumentItem( TPROSTYLE* info, bool bCollected, bool bAuthority );
	TStyleItem* CreateStyleItem( TPROSTYLE* info, bool bCollected, bool bAuthority );
	void InsertStyleItem( TStyleItem* pStyItem, int index );
	TStyleItem* __fastcall AddStyleItem( TPROSTYLE* info, bool bCollected );

	virtual void Init();
	virtual bool StartDrag();
	virtual void SetScrollTimer(TPoint ptNew){};
	virtual void PlayDemo( TCommonItem *pItem, int tempo );
	virtual void DeleteItem( TCommonItem *pItem, int iLine );
	virtual String ChargeTip( TStyleItem* pItem );
	virtual bool CanVSplit(){ return true; };

	void __fastcall CMClick(System::TObject* Sender);           //pngbutton 按下
	void __fastcall ListTypeClick( TObject *Sender );
	void __fastcall RenameTimerProc(System::TObject* Sender);
	void __fastcall EditMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
																			int X, int Y);
	void __fastcall EditMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
																			int X, int Y);
	void __fastcall EditMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
	void __fastcall EditKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
	void __fastcall EditChange(TObject *Sender);

	virtual void __fastcall RenameTiming(int op); //重命名
	virtual void __fastcall DoRename(TObject* Sender);
	virtual void __fastcall DoCollect(TObject* Sender);
	virtual void __fastcall DoubleClick(TObject* sender);

	MESSAGE void __fastcall OnNetworkError(TMessage &msg);
	MESSAGE void __fastcall OnNetworkMessage(TMessage &msg);
	MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);    //add
	MESSAGE void __fastcall UMSearchStyle(TMessage &msg);

	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER(MSG_NETWORKERROR, TMessage, OnNetworkError)
		MESSAGE_HANDLER(MSG_NETWORKMESSAGE, TMessage, OnNetworkMessage)
		MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)                       //add
		MESSAGE_HANDLER(UM_SEARCH,TMessage,UMSearchStyle);
	END_MESSAGE_MAP(TStylePanel)

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

	void __fastcall ReloadLocalStyle( bool bShow=true );
};

#endif
