1 /***************************************************************
2  * Name:      DirectoryParamsPanel
3  *
4  * Purpose:   This class is a panel that allows the user to
5  *            set the directory search parameters (dir,
6  *            extensions...).
7  *            It is used in the ThreadSearchView and the
8  *            ThreadSearchConfPanel.
9  *            It does nothing but forwarding events to the
10  *            parent window.
11  *
12  * Author:    Jerome ANTOINE
13  * Created:   2007-10-08
14  * Copyright: Jerome ANTOINE
15  * License:   GPL
16  **************************************************************/
17 
18 #ifndef DIRECTORY_PARAMS_PANEL_H
19 #define DIRECTORY_PARAMS_PANEL_H
20 
21 // begin wxGlade: ::dependencies
22 // end wxGlade
23 
24 #include <wx/string.h>
25 #include <wx/panel.h>
26 
27 class wxWindow;
28 class wxButton;
29 class wxCheckBox;
30 class wxComboBox;
31 class wxCommandEvent;
32 class ThreadSearchFindData;
33 
34 class DirectoryParamsPanel: public wxPanel {
35 public:
36     // begin wxGlade: DirectoryParamsPanel::ids
37     // end wxGlade
38 
39     /** Constructor. */
40     DirectoryParamsPanel(ThreadSearchFindData *findData, wxWindow* parent, int id, const wxPoint& pos=wxDefaultPosition,
41                          const wxSize& size=wxDefaultSize, long style=0);
42 
43     // Getters
44     wxString GetSearchDirPath()        const;
45     bool     GetSearchDirRecursively() const;
46     bool     GetSearchDirHidden()      const;
47     wxString GetSearchMask()           const;
48 
49     // Setters
50     void     SetSearchDirPath(const wxString& sDirPath);
51     void     SetSearchDirRecursively(bool bRecurse);
52     void     SetSearchDirHidden(bool bSearchHidden);
53     void     SetSearchMask(const wxString& sMask);
54 
55     void SetSearchHistory(const wxArrayString& searchDirs, const wxArrayString& searchMasks);
56     wxArrayString GetSearchDirsHistory() const;
57     wxArrayString GetSearchMasksHistory() const;
58 
59     void AddExpressionToCombos(const wxString& path, const wxString& mask);
60 
61 private:
62     // begin wxGlade: DirectoryParamsPanel::methods
63     void set_properties();
64     void do_layout();
65     // end wxGlade
66 
67 protected:
68     // begin wxGlade: DirectoryParamsPanel::attributes
69     wxComboBox* m_pSearchDirPath;
70     wxButton* m_pBtnSelectDir;
71     wxCheckBox* m_pChkSearchDirRecursively;
72     wxCheckBox* m_pChkSearchDirHiddenFiles;
73     wxComboBox* m_pMask;
74     // end wxGlade
75     ThreadSearchFindData *m_pFindData;
76 
77     DECLARE_EVENT_TABLE();
78 
79 private:
80     void OnSearchDirTextEvent(wxCommandEvent &event);
81     void OnSearchDirComboChange(wxCommandEvent &event);
82     void OnSearchMaskTextEvent(wxCommandEvent &event);
83 
84     /** Runs a dialog to set directory path.
85       */
86     void OnBtnDirSelectClick(wxCommandEvent &event); // wxGlade: <event_handler>
87 
88     void OnChkSearchDirRecurse(wxCommandEvent &event);
89     void OnChkSearchDirHidden(wxCommandEvent &event);
90 }; // wxGlade: end class
91 
92 
93 #endif // DIRECTORY_PARAMS_PANEL_H
94