#ifndef __WNDCONTACT_H
#define __WNDCONTACT_H

#include <libicq2000/Client.h>
#include <vdr/osd.h>
#include <vdr/menuitems.h>
#include "Window.h"

class cVdrIcqOsd;
class SimpleClient;
class cStatusbarWnd;
class cEditField;
class cContactWnd;


class cContactWnd : public cWnd
{
  enum EContactWindowMenu
  {
    cwmDefault,
    cwmOnline,
    cwmOffline,
    cwmAwaiting,
    cwmIgnorelist,
    cwmOnlineContact,
    cwmOfflineContact,
    cwmAwaitingContact,
    cwmIgnorelistContact
  };

  enum EShowSearchDialog { ssdNone, ssdByICQNumber, ssdByEMail, ssdByName };

public:
	cContactWnd(int iLeft, int iTop, int iWidth, int iHeight, int iBpP, cOsd *pOsd, cVdrIcqOsd *pVdrIcqOsd, 
              SimpleClient  *pIcqClient, cStatusbarWnd *pStatusbarWnd);
	~cContactWnd();

  tArea GetArea(void);
	void Draw(void);
  eOSState ProcessKey(eKeys Key);
  void SetContactList(ICQ2000::ContactList *pContactList);
  void OnSerchResult(ICQ2000::SearchResultEvent *ev);
  
private:
  tArea         m_Area;
  cOsd        *m_pOsd;
  cVdrIcqOsd    *m_pVdrIcqOsd;
  SimpleClient  *m_pIcqClient;
  cStatusbarWnd *m_pStatusbarWnd;
  unsigned int  m_iSelectedUIN;
  unsigned int  m_iSelectedPos;
  bool          m_bOnlineGroupSchow;
  bool          m_bOfflineGroupSchow;
  bool          m_bAwaitingGroupSchow;
  bool          m_bIgnorelistGroupSchow;
  bool          m_bSearchmenuEnable;
  bool          m_bDrawing;
  ICQ2000::ContactList    *m_pContactList;
  std::list<unsigned int> m_OnlineContactList; 
  std::list<unsigned int> m_OfflineContactList; 
  EContactWindowMenu      m_eActiveMenu;

  EShowSearchDialog       m_eSearchDialog;
  cEditField              *m_pSerchField1;
  cEditField              *m_pSerchField2;
  cEditField              *m_pSerchField3;
  cEditField              *m_pAuthField;
  bool                    m_bWaitForSerchResult;
  ICQ2000::ContactList    *m_pSerchResultCotactList;
  int                     m_iSelectedSerchResult;
  int                     m_iFirsSearchResultListPos;
  int                     m_iLastSearchResultListPos;
  ICQ2000::ContactRef     m_SelectedSerchResultContact;

  eOSState ProcessKeySearch(eKeys Key);
  eOSState ProcessKeySearchResult(eKeys Key);
  eOSState ProcessKeyAuthDialog(eKeys Key);
  void ShowSearchResults(void);
  void ShowAuthDialog(void);
  void SetHelpKeys(void);
  std::list<unsigned int>::iterator FindListpos(std::list<unsigned int> *pList, unsigned int iUIN);
  void ShowSearchDialog(EShowSearchDialog eSearchDialog);
};


#endif // __WNDCONTACT_H
