2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef SHAREDFILESCTRL_H
27 #define SHAREDFILESCTRL_H
29 #include "MuleListCtrl.h" // Needed for CMuleListCtrl
32 class CSharedFileList
;
38 * This class represents the widget used to list shared files.
40 class CSharedFilesCtrl
: public CMuleListCtrl
46 * @see CMuleListCtrl::CMuleListCtrl
48 CSharedFilesCtrl(wxWindow
* parent
, int id
, const wxPoint
& pos
, wxSize size
, int flags
);
57 /** Reloads the list of shared files. */
62 * Adds the specified file to the list, updating filecount and more.
64 * @param file The new file to be shown.
66 * Note that the item is inserted in sorted order.
68 void ShowFile(CKnownFile
* file
);
71 * Removes a file from the list.
73 * @param toremove The file to be removed.
75 void RemoveFile(CKnownFile
* toremove
);
78 * Updates a file on the list.
80 * @param toupdate The file to be updated.
82 void UpdateItem(CKnownFile
* toupdate
);
85 * Updates the number of shared files displayed above the list.
87 void ShowFilesCount();
91 * Adds the specified file to the list.
93 * If 'batch' is true, the item will be inserted last,
94 * and the files-count will not be updated, nor is
95 * the list checked for dupes.
97 void DoShowFile(CKnownFile
* file
, bool batch
);
100 * Draws the graph of file-part availability.
102 * @param file The file to make a graph over.
103 * @param dc The wcDC to draw on.
104 * @param rect The drawing area.
106 * This function draws a barspan showing the availability of the parts of
107 * a file, for both Part-files and Known-files. Availability for Part-files
108 * is determined using the currently known sources, while availability for
109 * Known-files is determined using the sources requesting that file.
111 void DrawAvailabilityBar( CKnownFile
* file
, wxDC
* dc
, const wxRect
& rect
) const;
114 * Overloaded function needed to do custom drawing of the items.
116 virtual void OnDrawItem(int item
, wxDC
* dc
, const wxRect
& rect
, const wxRect
& rectHL
, bool highlighted
);
120 * @see CMuleListCtrl::GetTTSText
122 virtual wxString
GetTTSText(unsigned item
) const;
128 * @see wxListCtrl::SortItems
130 static int wxCALLBACK
SortProc(wxUIntPtr item1
, wxUIntPtr item2
, long sortData
);
133 * Function that specifies which columns have alternate sorting.
135 * @see CMuleListCtrl::AltSortAllowed
137 virtual bool AltSortAllowed(unsigned column
) const;
141 * Event-handler for right-clicks on the list-items.
143 void OnRightClick(wxListEvent
& event
);
146 * Event-handler for right-clicks on the list-items.
148 void OnGetFeedback(wxCommandEvent
& event
);
151 * Event-handler for the Set Priority menu items.
153 void OnSetPriority( wxCommandEvent
& event
);
156 * Event-handler for the Auto-Priority menu item.
158 void OnSetPriorityAuto( wxCommandEvent
& event
);
161 * Event-handler for the Create ED2K/Magnet URI items.
163 void OnCreateURI( wxCommandEvent
& event
);
166 * Event handler for get-razorback stats menu item
168 void OnGetRazorStats( wxCommandEvent
& evt
);
171 * Event-handler for the Edit Comment menu item.
173 void OnEditComment( wxCommandEvent
& event
);
176 * Event-handler for the Rename menu item.
178 void OnRename( wxCommandEvent
& event
);
181 * Checks for renaming via F2.
183 void OnKeyPressed( wxKeyEvent
& event
);
186 * Adds links in a collection to transfers
188 void OnAddCollection( wxCommandEvent
& WXUNUSED(evt
) );
190 //! Pointer used to ensure that the menu isn't displayed twice.
194 DECLARE_EVENT_TABLE()
198 // File_checked_for_headers