KiCad PCB EDA Suite
dialog_file_dir_picker.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 CERN
3  * Author: Maciej Suminski <maciej.suminski@cern.ch>
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 // inspired by David Hart's FileDirDlg widget (4Pane project)
20 
21 #ifndef __DIALOG_FILE_DIR_PICKER_H__
22 #define __DIALOG_FILE_DIR_PICKER_H__
23 
24 #include <dialog_shim.h>
25 #include "wx/dirctrl.h"
26 
27 
29 {
30  FD_MULTIPLE = 0x0001,
31  FD_SHOW_HIDDEN = 0x0002,
33 };
34 
39 {
40 public:
41  DIALOG_FILE_DIR_PICKER( wxWindow* parent, const wxString& message, const wxString& defaultPath,
42  const wxString& wildcard, int style = FD_MULTIPLE | FD_SHOW_HIDDEN );
43 
44  void SetDirectory( const wxString& aDirectory ) const;
45 
46  wxString GetDirectory() const;
47 
52  void SetFilter( const wxString& aFilter )
53  {
54  m_GDC->SetFilter( aFilter );
55  }
56 
57  // Get multiple filepaths. Returns number found
58  size_t GetFilenames( wxArrayString& aFilepaths );
59 
60 protected:
61  void onHidden( wxCommandEvent& event );
62 
64  wxGenericDirCtrl* m_GDC;
65  wxCheckBox* m_showHidden;
66 
67 };
68 
69 #endif //__DIALOG_FILE_DIR_PICKER_H__
DIALOG_FILE_DIR_PICKER(wxWindow *parent, const wxString &message, const wxString &defaultPath, const wxString &wildcard, int style=FD_MULTIPLE|FD_SHOW_HIDDEN)
void SetFilter(const wxString &aFilter)
Sets the wildcard filter.
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:82
FILE_DIR_PICKER_STYLE
size_t GetFilenames(wxArrayString &aFilepaths)
Dialog that can select both files and directories.
void SetDirectory(const wxString &aDirectory) const
void onHidden(wxCommandEvent &event)