| 1 | // LAF OS Library |
| 2 | // Copyright (c) 2020-2021 Igara Studio S.A. |
| 3 | // Copyright (c) 2015-2018 David Capello |
| 4 | // |
| 5 | // This file is released under the terms of the MIT license. |
| 6 | // Read LICENSE.txt for more information. |
| 7 | |
| 8 | #ifndef OS_NATIVE_DIALOGS_H_INCLUDED |
| 9 | #define OS_NATIVE_DIALOGS_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "base/paths.h" |
| 13 | #include "os/ref.h" |
| 14 | |
| 15 | #include <string> |
| 16 | |
| 17 | namespace os { |
| 18 | class Window; |
| 19 | class FileDialog; |
| 20 | class NativeDialogs; |
| 21 | using FileDialogRef = Ref<FileDialog>; |
| 22 | |
| 23 | class FileDialog : public RefCount { |
| 24 | public: |
| 25 | enum class Type { |
| 26 | OpenFile, |
| 27 | OpenFiles, |
| 28 | OpenFolder, |
| 29 | SaveFile, |
| 30 | }; |
| 31 | |
| 32 | virtual ~FileDialog() { } |
| 33 | virtual void setType(const Type type) = 0; |
| 34 | virtual void setTitle(const std::string& title) = 0; |
| 35 | virtual void setDefaultExtension(const std::string& extension) = 0; |
| 36 | virtual void addFilter(const std::string& extension, const std::string& description) = 0; |
| 37 | virtual std::string fileName() = 0; |
| 38 | virtual void getMultipleFileNames(base::paths& output) = 0; |
| 39 | virtual void setFileName(const std::string& filename) = 0; |
| 40 | virtual bool show(Window* parent) = 0; |
| 41 | }; |
| 42 | |
| 43 | class NativeDialogs : public RefCount { |
| 44 | public: |
| 45 | virtual ~NativeDialogs() { } |
| 46 | virtual FileDialogRef makeFileDialog() = 0; |
| 47 | }; |
| 48 | |
| 49 | } // namespace os |
| 50 | |
| 51 | #endif |
| 52 | |