Upstream tarball 10143
[amule.git] / src / CatDialog.h
blob69ee4bcc972e1bad4a93f97588b823df1f8482ed
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-2008 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.
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 CATDIALOG_H
27 #define CATDIALOG_H
29 #include <wx/dialog.h> // Needed for wxDialog
30 #include "Types.h" // Needed for uint32
31 #include "OtherStructs.h"
32 #include "MuleColour.h"
34 class wxStaticBitmap;
35 class wxBitmap;
37 /**
38 * This dialog takes of displaying either existing or new categories, so that
39 * the user can add or change them.
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.
46 * It does however rely on the Transferwnd keeping its own list of categories up-
47 * to-date.
49 class CCatDialog : public wxDialog
51 public:
52 /**
53 * Constructor.
55 * @param parent The parent of the new dialog.
56 * @param catindex The category to be edited.
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.
62 CCatDialog(wxWindow* parent, bool allowbrowse, int catindex = -1 );
64 /**
65 * Destructor.
67 ~CCatDialog();
69 private:
70 /**
71 * Helper function for making the color-preview.
73 * This function creates a single-color 16x16 image, using the
74 * m_colour member variable.
76 wxBitmap MakeBitmap();
78 //! Variable used to store the user-selected color.
79 CMuleColour m_colour;
81 //! Pointer to category to be edited or NULL if we are adding a new category.
82 Category_Struct* m_category;
85 /**
86 * Event-handler for selecting incomming dir.
88 void OnBnClickedBrowse(wxCommandEvent& evt);
90 /**
91 * Event-handler for saving the changes.
93 void OnBnClickedOk(wxCommandEvent& evt);
95 /**
96 * Event-handler for selecting category color.
98 void OnBnClickColor(wxCommandEvent& evt);
100 DECLARE_EVENT_TABLE()
103 #endif
104 // File_checked_for_headers