neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
file_dialog.hpp
Go to the documentation of this file.
1// file_dialog.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 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
9 (at your option) 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, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include <string>
24#include <vector>
25#include <optional>
26
27namespace neogfx
28{
29 class i_widget;
30
31 // todo: use std::filesystem
32
33 using file_path = std::string;
34 using file_paths = std::vector<file_path>;
35 using optional_file_path = std::optional<file_path>;
36 using optional_file_paths = std::optional<file_paths>;
37
38 using filter_pattern = std::string;
39 using filter_patterns = std::vector<filter_pattern>;
40
42 {
43 std::optional<std::string> title;
46 std::optional<std::string> filterPatternDescription;
47 };
48
50 optional_file_paths open_file_dialog(file_dialog_spec const& aSpec = {}, bool aAllowMultipleSelection = false);
51 optional_file_path select_folder_dialog(std::optional<std::string> const& aTitle = {}, optional_file_path const& aDefaultPath = {});
52
54 optional_file_paths open_file_dialog(i_widget& aParent, file_dialog_spec const& aSpec = {}, bool aAllowMultipleSelection = false);
55 optional_file_path select_folder_dialog(i_widget& aParent, std::optional<std::string> const& aTitle = {}, optional_file_path const& aDefaultPath = {});
56}
optional_file_path select_folder_dialog(std::optional< std::string > const &aTitle={}, optional_file_path const &aDefaultPath={})
std::optional< file_paths > optional_file_paths
If dialog is cancelled value is std::nullopt.
std::string filter_pattern
optional_file_paths open_file_dialog(file_dialog_spec const &aSpec={}, bool aAllowMultipleSelection=false)
optional_file_path save_file_dialog(file_dialog_spec const &aSpec={})
std::optional< file_path > optional_file_path
If dialog is cancelled value is std::nullopt.
std::string file_path
std::vector< file_path > file_paths
std::vector< filter_pattern > filter_patterns
std::optional< std::string > title
filter_patterns filterPatterns
optional_file_path defaultPathAndFile
std::optional< std::string > filterPatternDescription