1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-06 19:48:15 +00:00
transmission/wx/torrent-list.h
Charles Kerr 9296e088f3 * make torrent list's columns sortable.
* remember torrent sort order between sessions.
* torrent list is getting too big; move it into its own file
 --This line, and those below, will be ignored--

M    wx/Makefile.am
A    wx/torrent-list.cc
A    wx/torrent-list.h
M    wx/xmission.cc
2007-07-23 15:20:47 +00:00

62 lines
1.7 KiB
C++

/*
* This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
*
* This file is licensed by the GPL version 2. Works owned by the
* Transmission project are granted a special exemption to clause 2(b)
* so that the bulk of its code can remain under the MIT license.
* This exemption does not extend to derived works not owned by
* the Transmission project.
*/
#ifndef __XMISSION_TORRENT_LIST_H__
#define __XMISSION_TORRENT_LIST_H__
#include <set>
#include <map>
#include <vector>
#include <wx/listctrl.h>
#include <wx/config.h>
#include <libtransmission/transmission.h>
class TorrentListCtrl: public wxListCtrl
{
public:
TorrentListCtrl( tr_handle_t * handle,
wxConfig * config,
wxWindow * parent,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize );
virtual ~TorrentListCtrl();
public:
void Rebuild ();
void Repopulate ();
void Refresh ();
public:
typedef std::vector<tr_torrent_t*> torrents_t;
void Add( const torrents_t& add );
private:
void Sort( int column );
void Resort( );
void OnSort( wxListEvent& );
void RefreshTorrent( tr_torrent_t*, int, const std::vector<int>& );
static int Compare( long, long, long );
/** torrent hash -> the torrent's row in myTorrentList */
typedef std::map<std::string,int> str2int_t;
str2int_t myHashToRow;
private:
tr_handle_t * myHandle;
wxConfig * myConfig;
torrents_t myTorrents;
int prevSortCol;
private:
DECLARE_EVENT_TABLE()
};
#endif