1
#ifndef _SEARCHALLPROFILESDIALOG_H_
2
#define _SEARCHALLPROFILESDIALOG_H_
6
class wxStdDialogButtonSizer;
9
* A "Search All Profiles" dialog
11
class SearchAllProfilesDialog: public wxDialog
13
DECLARE_DYNAMIC_CLASS(SearchAllProfilesDialog)
17
SearchAllProfilesDialog();
18
SearchAllProfilesDialog(wxWindow* parent,
19
wxWindowID id = wxID_ANY,
20
const wxString& caption = _("Search All Profiles"),
21
const wxPoint& pos = wxDefaultPosition,
22
const wxSize& size = wxSize(400, 300),
23
long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
26
bool Create(wxWindow* parent,
27
wxWindowID id = wxID_ANY,
28
const wxString& caption = _("Search All Profiles"),
29
const wxPoint& pos = wxDefaultPosition,
30
const wxSize& size = wxSize(400, 300),
31
long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX );
32
void CreateControls();
33
void OnSearch(wxCommandEvent& event);
34
void OnListBoxDClick (wxCommandEvent& event);
35
void DoSearch(const wxString& searchString);
38
void SetProfileDirectory (const wxString& dir) { mProfileDirectory = dir; }
39
void SetEditorExecutable (const wxString& exec) { mEditorExecutable = exec; }
40
void SetSearchText (const wxString& searchString) { mpSearchPhraseTextCtrl->SetValue(searchString); }
43
wxFlexGridSizer* mpSearchPhraseSizer;
44
wxStaticText* mpSearchStaticText;
45
wxTextCtrl* mpSearchPhraseTextCtrl;
46
wxButton* mpSearchButton;
47
wxListBox* mpSearchResultsListBox;
48
wxStdDialogButtonSizer* mpOKButtonSizer;
49
wxString mProfileDirectory;
50
wxString mEditorExecutable;
51
wxString mSearchedPhrase;
55
* The "Search All" traverser
57
class SearchAllProfilesTraverser : public wxDirTraverser
60
SearchAllProfilesTraverser (const wxString& search, wxListBox *rBox)
61
: searchString(search),
63
virtual wxDirTraverseResult OnFile(const wxString& filename)
65
if (!tmpFile.Open(filename))
66
return wxDIR_CONTINUE;
68
if (!tmpFile.ReadAll(&tmpString))
69
return wxDIR_CONTINUE;
71
if (tmpString.Find(searchString) != -1)
72
resultsBox->Append(filename);
74
return wxDIR_CONTINUE;
77
virtual wxDirTraverseResult OnDir(const wxString& dirname)
79
return wxDIR_CONTINUE;
82
wxString searchString;
83
wxListBox *resultsBox;
91
ID_SEARCH_ALL_PROFILES_BUTTON = 15599,
92
ID_SEARCH_ALL_PROFILES_LIST_BOX