Remove do-nothing command and add warning about it
[amule.git] / src / SearchDlg.h
blob6b5ff0b6eb20e587d1d4325a31a034ac6505d59e
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.
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.
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 SEARCHDLG_H
27 #define SEARCHDLG_H
29 #include <wx/panel.h> // Needed for wxPanel
30 #include <wx/notebook.h> // needed for wxBookCtrlEvent in wx 2.8
32 #include "Types.h" // Needed for uint16 and uint32
35 class CMuleNotebook;
36 class CSearchListCtrl;
37 class CMuleNotebookEvent;
38 class wxListEvent;
39 class wxSpinEvent;
40 class wxGauge;
41 class CSearchFile;
44 /**
45 * This class represents the Search Dialog, which takes care of
46 * enabling the user to search and to display results in a readable
47 * manner.
49 class CSearchDlg : public wxPanel
51 public:
52 /**
53 * Constructor.
55 * @param pParent The parent widget passed to the wxPanel constructor.
57 CSearchDlg(wxWindow* pParent);
59 /**
60 * Destructor.
62 ~CSearchDlg();
65 /**
66 * Adds the provided result to the right result-list.
68 * Please note that there is no duplicates checking, so the files should
69 * indeed be a new result.
71 void AddResult(CSearchFile* toadd);
73 /**
74 * Updates a changed result.
76 * @param A pointer to the updated CSearchFile.
78 * This function will update the source-count and color of the result, and
79 * if needed, it will also move the result so that the current sorting
80 * is maintained.
82 void UpdateResult(CSearchFile* toupdate);
84 /**
85 * Checks if a result-page with the specified heading exists.
87 * @param searchString The heading to look for.
89 bool CheckTabNameExists(const wxString& searchString);
91 /**
92 * Creates a new tab and displays the specified results.
94 * @param searchString This will be the heading of the new page.
95 * @param nSearchID The results with this searchId will be displayed.
97 void CreateNewTab(const wxString& searchString, wxUIntPtr nSearchID);
101 * Call this function to signify that the local search is over.
103 void LocalSearchEnd();
107 * Call this function to signify that the kad search is over.
109 void KadSearchEnd(uint32 id);
113 * This function updates the category list according to existing categories.
115 void UpdateCatChoice();
119 * This function displays the the hit-count in the heading for the specified page.
121 * @param page The page to have its heading updated.
123 void UpdateHitCount(CSearchListCtrl* page);
126 * Helper function which resets the controls.
128 void ResetControls();
130 // Event handler and helper function
131 void OnBnClickedDownload(wxCommandEvent& ev);
133 CSearchListCtrl* GetSearchList( wxUIntPtr id );
135 void UpdateProgress(uint32 new_value);
137 void StartNewSearch();
139 void FixSearchTypes();
141 private:
142 // Event handlers
143 void OnFieldChanged(wxEvent& evt);
145 void OnListItemSelected(wxListEvent& ev);
146 void OnBnClickedReset(wxCommandEvent& ev);
147 void OnBnClickedClear(wxCommandEvent& ev);
148 void OnExtendedSearchChange(wxCommandEvent& ev);
149 void OnFilterCheckChange(wxCommandEvent& ev);
150 void OnFilteringChange(wxCommandEvent& ev);
152 void OnSearchClosing(wxBookCtrlEvent& evt);
154 void OnBnClickedStart(wxCommandEvent& evt);
155 void OnBnClickedStop(wxCommandEvent& evt);
159 * Event-handler for page-chages which takes care of enabling/disabling the download button.
161 void OnSearchPageChanged(wxBookCtrlEvent& evt);
163 uint32 m_last_search_time;
165 wxGauge* m_progressbar;
167 CMuleNotebook* m_notebook;
169 wxArrayString m_searchchoices;
171 DECLARE_EVENT_TABLE()
174 #endif
175 // File_checked_for_headers