KiCad PCB EDA Suite
Loading...
Searching...
No Matches
native_model_file_picker.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
19 */
20
21#include <wx/event.h>
23
24#if defined( KICAD_NATIVE_MODEL_PREVIEW ) && defined( __WXGTK3__ )
26#elif defined( KICAD_NATIVE_MODEL_PREVIEW ) && defined( __WINDOWS__ )
28#else
30#include <wx/filedlg.h>
31#endif
32
33
35{
36#if defined( KICAD_NATIVE_MODEL_PREVIEW ) && defined( __WXGTK3__ )
37 return ShowNativeModelFilePickerGtk( aOptions );
38#elif defined( KICAD_NATIVE_MODEL_PREVIEW ) && defined( __WINDOWS__ )
39 return ShowNativeModelFilePickerWindows( aOptions );
40#else
41 wxFileDialog dialog( aOptions.parent, aOptions.title, aOptions.directory, aOptions.filename, aOptions.wildcard,
42 aOptions.style );
43 FILEDLG_HOOK_EMBED_FILE embedHook( aOptions.embedFile );
44 dialog.SetCustomizeHook( embedHook );
45
46 dialog.SetFilterIndex( aOptions.filterIndex );
48
49 if( dialog.ShowModal() == wxID_OK )
50 {
51 selected.accepted = true;
52 selected.path = dialog.GetPath();
53 selected.filterIndex = dialog.GetFilterIndex();
54 selected.embedFile = embedHook.GetEmbed();
55 }
56
57 return selected;
58#endif
59}
NATIVE_MODEL_FILE_PICKER_RESULT ShowNativeModelFilePicker(const NATIVE_MODEL_FILE_PICKER_OPTIONS &aOptions)
NATIVE_MODEL_FILE_PICKER_RESULT ShowNativeModelFilePickerWindows(const NATIVE_MODEL_FILE_PICKER_OPTIONS &aOptions)