Upstream tarball 9861
[amule.git] / src / TransferWnd.h
blob74c5b513164ef0927b35752097b2443824cc2513
1 //
2 // This file is part of the aMule Project.
3 //
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 )
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.
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.
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
26 #ifndef TRANSFERWND_H
27 #define TRANSFERWND_H
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"
34 class CClientListCtrl;
35 class CDownloadListCtrl;
36 class CMuleNotebook;
37 class wxListCtrl;
38 class wxSplitterEvent;
39 class wxCommandEvent;
40 class wxMouseEvent;
41 class wxEvent;
42 class wxMenu;
46 /**
47 * This class takes care of managing the lists and other controls contained
48 * in the transfer-window. It's primary function is to manage the user-defined
49 * categories.
51 class CTransferWnd : public wxPanel
53 public:
54 /**
55 * Constructor.
57 CTransferWnd(wxWindow* pParent = NULL);
59 /**
60 * Destructor.
62 ~CTransferWnd();
65 /**
66 * Adds the specified category to the end of the list.
68 * @param category A pointer to the new category.
70 * This function should be called after a category has been
71 * added to the lists of categories. The new category is assumed
72 * to be the last, and thus will be appended to the end of the tabs
73 * on the category-notebook.
75 void AddCategory( Category_Struct* category );
77 /**
78 * Updates the title of the specified category.
80 * @param index The index of the category on the notebook.
81 * @param titleChanged Set to true if the actual title has changed.
83 * The second paramerter will make the UpdateCategory function signal
84 * to the searchdlg page that the lists of categories has been changed,
85 * and force it to refresh its list of categories.
87 * This however should only be done when the title has actually changed,
88 * since it will cause the user-selection to be reset.
90 void UpdateCategory( int index, bool titleChanged = false );
92 /**
93 * Remove category
95 void RemoveCategory(int index);
96 void RemoveCategoryPage(int index);
98 /**
99 * This functions updates the displayed client-numbers*
101 * @param number The number of clients on the upload queue.
103 * This function updates both the number of clients on the queue,
104 * as well as the number of banned clients.
106 void ShowQueueCount(uint32 number);
109 * This function switches between showing the upload-queue and the list of
110 * client who are currently recieving files.
112 void SwitchUploadList(wxCommandEvent& evt);
115 * Helper-function which updates the displayed titles of all existing categories.
117 void UpdateCatTabTitles();
121 * Call this function before displaying the dialog.
123 * This functions does a few tasks to ensure that the dialog is looking the right way.
125 void Prepare();
127 //! Pointer to the download-queue.
128 CDownloadListCtrl* downloadlistctrl;
129 //! Pointer to the list of clients.
130 CClientListCtrl* clientlistctrl;
132 //! Contains the current (or last if the clientlist is hidden) position of the splitter.
133 int m_splitter;
135 private:
137 * Event-handler for the set status by category menu-item.
139 void OnSetCatStatus( wxCommandEvent& event );
142 * Event-handler for the set priority by category menu-item.
144 void OnSetCatPriority( wxCommandEvent& event );
147 * Event-handler for the "Add Category" menu-item.
149 void OnAddCategory( wxCommandEvent& event );
152 * Event-handler for the "Delete Category" menu-item.
154 void OnDelCategory( wxCommandEvent& event );
157 * Event-handler for the "Edit Category" menu-item.
159 void OnEditCategory( wxCommandEvent& event );
162 * Event-handler for manipulating the default category.
164 void OnSetDefaultCat( wxCommandEvent& event );
167 * Event-handler for the "Clear Completed" button.
169 void OnBtnClearDownloads(wxCommandEvent &evt);
172 * Event-handler for changing categories.
174 void OnCategoryChanged(wxBookCtrlEvent& evt);
177 * Event-handler for displaying the category-popup menu.
179 void OnNMRclickDLtab(wxMouseEvent& evt);
182 * Event-handler for the list-toggle button.
184 void OnToggleClientList( wxCommandEvent& event );
187 * Event-handler for automatic show/hide of the clientlistctrl.
189 void OnSashPositionChanging(wxSplitterEvent& evt);
192 //! Variable used to ensure that the category menu doesn't get displayed twice.
193 wxMenu* m_menu;
195 //! Pointer to the category tabs.
196 CMuleNotebook* m_dlTab;
199 DECLARE_EVENT_TABLE()
202 #endif
204 // File_checked_for_headers