| Line | |
|---|
| 1 | // |
|---|
| 2 | // C++ Interface: kadNodesListView |
|---|
| 3 | // |
|---|
| 4 | // Description: list of kad contacts in the routing zone |
|---|
| 5 | // |
|---|
| 6 | // |
|---|
| 7 | // Author: MKVore <mkvore@mail.i2p>, (C) 2008 |
|---|
| 8 | // |
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
|---|
| 10 | // |
|---|
| 11 | // |
|---|
| 12 | |
|---|
| 13 | #ifndef _KAD_NODES_LIST_VIEW_H_ |
|---|
| 14 | #define _KAD_NODES_LIST_VIEW_H_ |
|---|
| 15 | |
|---|
| 16 | #include <wx/wx.h> |
|---|
| 17 | #include <wx/listctrl.h> |
|---|
| 18 | #include "GuiEvents.h" |
|---|
| 19 | #include <vector> |
|---|
| 20 | #include <map> |
|---|
| 21 | |
|---|
| 22 | namespace Kademlia |
|---|
| 23 | { |
|---|
| 24 | class CContact ; |
|---|
| 25 | class CUInt128 ; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | class KadNodesListView : public wxListView |
|---|
| 29 | { |
|---|
| 30 | public: |
|---|
| 31 | 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); |
|---|
| 32 | |
|---|
| 33 | void AddNode ( Kademlia::CContact * contact ); |
|---|
| 34 | void DeleteNode ( Kademlia::CContact * contact ); |
|---|
| 35 | void OnColumnLClick( wxListEvent & event ); |
|---|
| 36 | |
|---|
| 37 | protected: |
|---|
| 38 | virtual wxString OnGetItemText(long item, long column) const; |
|---|
| 39 | virtual wxListItemAttr * OnGetItemAttr(long item) const; |
|---|
| 40 | private : |
|---|
| 41 | void SortItems(); |
|---|
| 42 | std::map<Kademlia::CUInt128, long> _contacts_map; |
|---|
| 43 | std::vector<Kademlia::CContact> _contacts_list ; |
|---|
| 44 | std::vector<Kademlia::CContact> _sorted_contacts_list ; |
|---|
| 45 | |
|---|
| 46 | DECLARE_EVENT_TABLE() |
|---|
| 47 | }; |
|---|
| 48 | #endif |
|---|