#pragma once
#include "telescopinglist.h"

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

	void Add(Group * group);
	void EditAdd(Group * group);
	void Delete(Group * group);
	void EditDelete(Group* group);
	int Create(HWND parent = 0);
	void UpdateGroup(ListItem * item);

	void OnNotify(int id, int reason);

	void DeepRefresh(int memoize = 1);
	void DeepRefreshEdit(int memoize = 1);
	void ClearList();
	void ClearEditList();
	void UpdateActiveCount();

	LRESULT DisplayContextMenu(Group * group);
	
	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 group list
	Appearance Active;
	Appearance Idle;
	Appearance EmptyStyle;
	// List item appearances for the editing list
	Appearance Checked;
	Appearance Unchecked;
	Appearance EditEmptyStyle;

	int nActiveGroups;

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