#pragma once
#include "telescopinglist.h"

class BuddyList :
	public TelescopingList
{
public:
	BuddyList(void);
	~BuddyList(void);

	void Add(Buddy * buddy);
	void EditAdd(Buddy * buddy);
	void Delete(Buddy * buddy);
	void EditDelete(Buddy* buddy);
	int Create(HWND parent = 0);
	void UpdateBuddy(ListItem * item);
	Buddy * GetBuddy(int buddyId);
	Buddy * GetEditBuddy(int buddyId);
	void UpdateOnlineCount();

	void DeepRefresh(int memoize = 1);
	void DeepRefreshEdit(int memoize = 1);
	void ClearList();
	void ClearEditList();
	int Exists(int userId);
	int EditExists(int userId);
	
	virtual void OnListSelect(HWND h, HWND hItem);
	virtual void OnListRightSelect(HWND h, HWND hItem);
	virtual void OnListDblSelect(HWND h, HWND hItem);
	virtual void OnPopupStart(WPARAM wParam, LPARAM lParam);
	virtual void OnPopupEnd(WPARAM wParam, LPARAM lParam);
	virtual void OnTimer();
	virtual void OnButton(HWND h);
	virtual void OnCarriageReturn(HWND h);
	virtual void OnListDeleteItem(WPARAM wParam, LPARAM lParam);
	virtual void OnCustomNotify(int id, Notification& n);
	
	// List Item appearances for the active buddy list
	Appearance Idle5min;
	Appearance Idle15min;
	Appearance Idle30min;
	Appearance Idle;
	Appearance Active;
	Appearance LoggedOff;
	Appearance Away;
	Appearance EmptyStyle;
	// List item appearances for the editing list
	Appearance eIdle5min;
	Appearance eIdle15min;
	Appearance eIdle30min;
	Appearance eIdle;
	Appearance eActive;
	Appearance eLoggedOff;
	Appearance eAway;
	Appearance eAddable;

private:
	int NeedRefresh; // does the list need to call DeepRefresh before displaying?
	int NeedEditRefresh; // does the edit list need to call DeepRefreshEdit before displaying?
};
