Loading...
Searching...
No Matches
FileDialog.h
Go to the documentation of this file.
1// Copyright 2025 Dave R. Smith
2// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
3
4#pragma once
5
7#include <string>
8#include <vector>
9
10namespace ml
11{
33 {
34 public:
35 struct Filter
36 {
37 std::string name;
38 std::string spec;
39 };
40
42 static std::string open(
43 const std::vector<Filter>& filters = {},
44 const std::string& defaultPath = "");
45
47 static std::string save(
48 const std::vector<Filter>& filters = {},
49 const std::string& defaultPath = "",
50 const std::string& defaultName = "");
51
53 static std::vector<std::string> openMultiple(
54 const std::vector<Filter>& filters = {},
55 const std::string& defaultPath = "");
56 };
57
58} // namespace ml
Thin wrapper around the native OS file-open / file-save dialog.
Definition FileDialog.h:33
static std::vector< std::string > openMultiple(const std::vector< Filter > &filters={}, const std::string &defaultPath="")
Show a multi-select open dialog. Returns selected paths or {}.
static std::string save(const std::vector< Filter > &filters={}, const std::string &defaultPath="", const std::string &defaultName="")
Show a save-file dialog. Returns the chosen path or "".
static std::string open(const std::vector< Filter > &filters={}, const std::string &defaultPath="")
Show an open-file dialog. Returns the selected path or "".
#define MALENA_API
Definition Component.h:22
std::string spec
Comma-separated extensions, e.g. "json,quiz".
Definition FileDialog.h:38
std::string name
Display label, e.g. "Quiz Files".
Definition FileDialog.h:37