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-2011 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 SHAREDFILESWND_H
27 #define SHAREDFILESWND_H
28 
29 #include <wx/panel.h>		// Needed for wxPanel
30 
31 
32 class CKnownFile;
33 class CSharedFilesCtrl;
34 class CSharedFilePeersListCtrl;
35 class wxListEvent;
36 class wxGauge;
37 class wxSplitterEvent;
38 class wxRadioBox;
39 
40 /**
41  * This class represents the window containing the list of shared files.
42  */
43 class CSharedFilesWnd : public wxPanel
44 {
45 public:
46 	/**
47 	 * Constructor.
48 	 */
49 	CSharedFilesWnd(wxWindow* pParent = NULL);
50 
51 	/**
52 	 * Destructor.
53 	 */
54 	~CSharedFilesWnd();
55 
56 
57 	/**
58 	 * This function updates the statistics of the selected items.
59 	 *
60 	 * Call this function when an item has been selected, or when a
61 	 * selected item changes. It
62 	 */
63 	void SelectionUpdated();
64 
65 
66 	/**
67 	 * Deletes all files and updates widget
68 	 */
69 	void RemoveAllSharedFiles();
70 
71 	/**
72 	 * Call this function before displaying the dialog.
73 	 *
74 	 * This functions does a few tasks to ensure that the dialog is looking the right way.
75 	 */
76 	void	Prepare();
77 
78 	//! Pointer to the widget containing the list of shared files.
79 	CSharedFilesCtrl* sharedfilesctrl;
80 
81 	//! Pointer to the list of clients.
82 	CSharedFilePeersListCtrl*	peerslistctrl;
83 
84 	//! Contains the current (or last if the clientlist is hidden) position of the splitter.
85 	int m_splitter;
86 private:
87 	/**
88 	 * Event-handler for reloading the list of shared files.
89 	 */
90 	void OnBtnReloadShared(wxCommandEvent &evt);
91 
92 	/**
93 	 * Event-handler for showing details about a shared file(s).
94 	 */
95 	void OnItemSelectionChanged(wxListEvent& evt);
96 
97 	/**
98 	 * Event-handler for the list-toggle button.
99 	 */
100 	void OnToggleClientList( wxCommandEvent& event );
101 
102 	/**
103 	 * Event-handler for changes in the sash divider position.
104 	 */
105 	void OnSashPositionChanging(wxSplitterEvent& evt);
106 
107 	/**
108 	 * Event-handler for changes in the clients mode radio box.
109 	 */
110 	void OnSelectClientsMode( wxCommandEvent& WXUNUSED(evt) );
111 
112 	//! Pointer to the gauge used for showing requests ratio.
113 	wxGauge* m_bar_requests;
114 	//! Pointer to the gauge used for showing accepted-requests ratio.
115 	wxGauge* m_bar_accepted;
116 	//! Pointer to the gauge used for showing the transferred ratio.
117 	wxGauge* m_bar_transfer;
118 	//! Pointer to the radio box selecting the client mode.
119 	wxRadioBox* m_radioClientMode;
120 	//! Flag if window has been prepared
121 	bool	m_prepared;
122 	//! Minimum position of splitter bar
123 	static const int s_splitterMin = 90;
124 
125 	/**
126 	 * Mode which clients are shown
127 	 */
128 	enum EClientShow {
129 		ClientShowAll = 0,
130 		ClientShowSelected,
131 		ClientShowUploading
132 	};
133 	EClientShow m_clientShow;
134 
135 
136 	DECLARE_EVENT_TABLE()
137 };
138 
139 #endif
140 // File_checked_for_headers
141