1// 2// This file is part of the aMule Project. 3// 4// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) 5// Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net ) 6// 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 9// respective authors. 10// 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. 15// 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. 20// 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 24// 25 26#ifndef TRANSFERWND_H 27#define TRANSFERWND_H 28 29#include <wx/panel.h> // Needed for wxPanel 30#include <wx/notebook.h> // needed for wxBookCtrlEvent in wx 2.8 31#include "Types.h" // Needed for uint32 32#include "OtherStructs.h" 33 34class CSourceListCtrl; 35class CDownloadListCtrl; 36class CMuleNotebook; 37class wxListCtrl; 38class wxSplitterEvent; 39class wxCommandEvent; 40class wxMouseEvent; 41class wxEvent; 42class wxMenu; 43 44/** 45 * This class takes care of managing the lists and other controls contained 46 * in the transfer-window. It's primary function is to manage the user-defined 47 * categories. 48 */ 49class CTransferWnd : public wxPanel 50{ 51public: 52 /** 53 * Constructor. 54 */ 55 CTransferWnd(wxWindow* pParent = NULL); 56 57 /** 58 * Destructor. 59 */ 60 ~CTransferWnd(); 61 62 63 /** 64 * Adds the specified category to the end of the list. 65 * 66 * @param category A pointer to the new category. 67 * 68 * This function should be called after a category has been 69 * added to the lists of categories. The new category is assumed 70 * to be the last, and thus will be appended to the end of the tabs 71 * on the category-notebook. 72 */ 73 void AddCategory( Category_Struct* category ); 74 75 /** 76 * Updates the title of the specified category. 77 * 78 * @param index The index of the category on the notebook. -1 will update all categories. 79 */ 80 void UpdateCategory(int index); 81 82 /** 83 * Remove category 84 */ 85 void RemoveCategory(int index); 86 void RemoveCategoryPage(int index); 87 88 /** 89 * Helper-function which updates the displayed titles of all existing categories. 90 */ 91 void UpdateCatTabTitles() { UpdateCategory(-1); } 92 93 94 /** 95 * Call this function before displaying the dialog. 96 * 97 * This functions does a few tasks to ensure that the dialog is looking the right way. 98 */ 99 void Prepare(); 100 101 //! Pointer to the download-queue. 102 CDownloadListCtrl* downloadlistctrl; 103 //! Pointer to the list of clients. 104 CSourceListCtrl* clientlistctrl; 105 106private: 107 //! Contains the current (or last if the clientlist is hidden) position of the splitter. 108 int m_splitter; 109 //! Minimum position of splitter bar 110 static const int s_splitterMin = 90; 111 112 /** 113 * Event-handler for the set status by category menu-item. 114 */ 115 void OnSetCatStatus( wxCommandEvent& event ); 116 117 /** 118 * Event-handler for the set priority by category menu-item. 119 */ 120 void OnSetCatPriority( wxCommandEvent& event ); 121 122 /** 123 * Event-handler for the "Add Category" menu-item. 124 */ 125 void OnAddCategory( wxCommandEvent& event ); 126 127 /** 128 * Event-handler for the "Delete Category" menu-item. 129 */ 130 void OnDelCategory( wxCommandEvent& event ); 131 132 /** 133 * Event-handler for the "Edit Category" menu-item. 134 */ 135 void OnEditCategory( wxCommandEvent& event ); 136 137 /** 138 * Event-handler for manipulating the default category. 139 */ 140 void OnSetDefaultCat( wxCommandEvent& event ); 141 142 /** 143 * Event-handler for the "Clear Completed" button. 144 */ 145 void OnBtnClearDownloads(wxCommandEvent &evt); 146 147 /** 148 * Event-handler for changing categories. 149 */ 150 void OnCategoryChanged(wxBookCtrlEvent& evt); 151 152 /** 153 * Event-handler for displaying the category-popup menu. 154 */ 155 void OnNMRclickDLtab(wxMouseEvent& evt); 156 157 /** 158 * Event-handler for the list-toggle button. 159 */ 160 void OnToggleClientList( wxCommandEvent& event ); 161 162 /** 163 * Event-handler for changes in the sash divider position. 164 */ 165 void OnSashPositionChanging(wxSplitterEvent& evt); 166 167 168 //! Variable used to ensure that the category menu doesn't get displayed twice. 169 wxMenu* m_menu; 170 171 //! Pointer to the category tabs. 172 CMuleNotebook* m_dlTab; 173 174 175 DECLARE_EVENT_TABLE() 176}; 177 178#endif 179 180// File_checked_for_headers 181