1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Original author: Emilio Sandoz
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 __PrefsUnifiedDlg_H__
27 #define __PrefsUnifiedDlg_H__
28 
29 #include <wx/dialog.h>		// Needed for wxDialog
30 
31 
32 class Cfg_Base;
33 class CDirectoryTreeCtrl;
34 
35 class wxWindow;
36 class wxChoice;
37 class wxButton;
38 class wxPanel;
39 class wxListCtrl;
40 
41 class wxCommandEvent;
42 class wxListEvent;
43 class wxSpinEvent;
44 class wxScrollEvent;
45 class wxInitDialogEvent;
46 
47 
48 /**
49  * This class represents a dialog used to display preferences.
50  */
51 class PrefsUnifiedDlg : public wxDialog
52 {
53 public:
54 	/**
55 	 * Constructor.
56 	 *
57 	 * @param parent The parent window.
58 	 *
59 	 * This constructor is a much more simple version of the wxDialog one,
60 	 * which only needs to know the parent of the dialog. Please note that
61 	 * it is private so that we can ensure that only one dialog has been
62 	 * created at one time.
63 	 */
64 	PrefsUnifiedDlg(wxWindow* parent);
65 
66 	/**
67 	 * Updates the widgets with the values of the preference-variables.
68 	 */
69 	bool TransferFromWindow();
70 	/**
71 	 * Updates the prefernce-variables with the values of the widgets.
72 	 */
73 	bool TransferToWindow();
74 
75 
76 protected:
77 	/**
78 	 * Helper functions which checks if a Cfg has has changed.
79 	 */
80 	bool			CfgChanged(int id);
81 
82 	/**
83 	 * Helper functions which returns the Cfg assosiated with the specified id.
84 	 */
85 	Cfg_Base*		GetCfg(int id);
86 
87 
88 	//! Pointer to the shared-files list
89 	CDirectoryTreeCtrl*	m_ShareSelector;
90 
91 	//! Pointer to the color-selector
92 	wxChoice*		m_choiceColor;
93 
94 	//! Pointer to the color-selection button
95 	wxButton*		m_buttonColor;
96 
97 	//! Pointer to the currently shown preference-page
98 	wxPanel*		m_CurrentPanel;
99 
100 	//! hide/show server tab
101 	int				m_IndexServerTab;
102 	bool			m_ServerTabVisible;
103 	wxPanel*		m_ServerWidget;
104 	wxListCtrl*		m_PrefsIcons;
105 	void EnableServerTab(bool enable);
106 
107 	void OnOk(wxCommandEvent &event);
108 	void OnCancel(wxCommandEvent &event);
109 	void OnClose(wxCloseEvent &event);
110 
111 	void OnButtonBrowseApplication(wxCommandEvent &event);
112 	void OnButtonDir(wxCommandEvent& event);
113 	void OnButtonEditAddr(wxCommandEvent& event);
114 	void OnButtonColorChange(wxCommandEvent &event);
115 	void OnButtonIPFilterReload(wxCommandEvent &event);
116 	void OnButtonIPFilterUpdate(wxCommandEvent &event);
117 	void OnColorCategorySelected(wxCommandEvent &event);
118 	void OnCheckBoxChange(wxCommandEvent &event);
119 	void OnPrefsPageChange(wxListEvent& event);
120 	void OnToolTipDelayChange(wxSpinEvent& event);
121 	void OnScrollBarChange( wxScrollEvent& event );
122 	void OnRateLimitChanged( wxSpinEvent& event );
123 	void OnTCPClientPortChange(wxSpinEvent& event);
124 	void OnUserEventSelected(wxListEvent& event);
125 	void OnLanguageChoice(wxCommandEvent &event);
126 	void CreateEventPanels(const int idx, const wxString& vars, wxWindow* parent);
127 
128 	void OnInitDialog( wxInitDialogEvent& evt );
129 
130 	DECLARE_EVENT_TABLE()
131 
132 private:
133 	bool	m_verticalToolbar;
134 	bool	m_toolbarOrientationChanged;
135 };
136 
137 #endif
138 // File_checked_for_headers
139