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 quekky
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 CATDIALOG_H
27 #define CATDIALOG_H
28 
29 #include <wx/dialog.h>		// Needed for wxDialog
30 #include "Types.h"		// Needed for uint32
31 #include "OtherStructs.h"
32 #include "MuleColour.h"
33 
34 class wxStaticBitmap;
35 class wxBitmap;
36 
37 /**
38  * This dialog takes of displaying either existing or new categories, so that
39  * the user can add or change them.
40  *
41  * It is a self-contained entity, and does not rely on the categories staying
42  * the same while the dialog is visble, though it will overwrite any changes
43  * made to the selected category in the mean time. Also, if the selected category
44  * has been deleted then it will simply be readded.
45  *
46  * It does however rely on the Transferwnd keeping its own list of categories up-
47  * to-date.
48  */
49 class CCatDialog : public wxDialog
50 {
51 public:
52 	/**
53 	 * Constructor.
54 	 *
55 	 * @param parent The parent of the new dialog.
56 	 * @param catindex The category to be edited.
57 	 *
58 	 * The parameter catindex can be a valid index, in which case that category
59 	 * will be selected, or it can be less than zero, in which case a new
60 	 * category will be created.
61 	 */
62 	CCatDialog(wxWindow* parent, bool allowbrowse, int catindex = -1 );
63 
64 	/**
65 	 * Destructor.
66 	 */
67 	~CCatDialog();
68 
69 private:
70 	/**
71 	 * Helper function for making the color-preview.
72 	 *
73 	 * This function creates a single-color 16x16 image, using the
74 	 * m_colour member variable.
75 	 */
76 	wxBitmap MakeBitmap();
77 
78 	//! Variable used to store the user-selected color.
79 	CMuleColour			m_colour;
80 
81 	//! Pointer to category to be edited or NULL if we are adding a new category.
82 	Category_Struct*	m_category;
83 
84 
85 	/**
86 	 * Event-handler for selecting incomming dir.
87 	 */
88 	void OnBnClickedBrowse(wxCommandEvent& evt);
89 
90 	/**
91 	 * Event-handler for saving the changes.
92 	 */
93 	void OnBnClickedOk(wxCommandEvent& evt);
94 
95 	/**
96 	 * Event-handler for selecting category color.
97 	 */
98 	void OnBnClickColor(wxCommandEvent& evt);
99 
100 	DECLARE_EVENT_TABLE()
101 };
102 
103 #endif
104 // File_checked_for_headers
105