//
// C++ Interface: kadNodesListView
//
// Description: list of kad contacts in the routing zone
//
//
// Author: MKVore <mkvore@mail.i2p>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef _KAD_NODES_LIST_VIEW_H_
#define _KAD_NODES_LIST_VIEW_H_

#include <wx/wx.h>
#include <wx/listctrl.h>
#include "GuiEvents.h"
#include <vector>
#include <map>

namespace Kademlia
{
class CContact ;
class CUInt128 ;
}

class KadNodesListView : public wxListView
{
public:
        KadNodesListView(wxWindow* parent, wxWindowID id=-1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListCtrlNameStr);

        void AddNode       ( Kademlia::CContact * contact  );
        void DeleteNode    ( Kademlia::CContact * contact  );
        void OnColumnLClick( wxListEvent & event );

protected:
        virtual wxString OnGetItemText(long item, long column) const;
        virtual wxListItemAttr * OnGetItemAttr(long item) const;
private :
        void SortItems();
        std::map<Kademlia::CUInt128, long> _contacts_map;
        std::vector<Kademlia::CContact> _contacts_list ;
        std::vector<Kademlia::CContact> _sorted_contacts_list ;

        DECLARE_EVENT_TABLE()
};
#endif
