ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
FileDialog.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <functional>
11 
13 
14 #define GUI_USE_NATIVE_FILE_DIALOG 1
15 
16 namespace cloudViewer {
17 namespace visualization {
18 namespace gui {
19 
20 struct Theme;
21 
22 class FileDialog : public Dialog {
23  using Super = Dialog;
24 
25 public:
26  enum class Mode { OPEN, SAVE };
27 
28  FileDialog(Mode type, const char *title, const Theme &theme);
29  virtual ~FileDialog();
30 
34  void SetPath(const char *path);
35 
41  void AddFilter(const char *filter, const char *description);
42 
44  void SetOnCancel(std::function<void()> on_cancel);
46  void SetOnDone(std::function<void(const char *)> on_done);
47 
49  const Constraints &constraints) const override;
50 
51  void OnWillShow() override;
52 
53 protected:
54  void OnDone();
55 
56 private:
57  struct Impl;
58  std::unique_ptr<Impl> impl_;
59 };
60 
61 } // namespace gui
62 } // namespace visualization
63 } // namespace cloudViewer
char type
Base class for dialogs.
Definition: Dialog.h:19
FileDialog(Mode type, const char *title, const Theme &theme)
Definition: FileDialog.cpp:212
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: FileDialog.cpp:397
void SetOnCancel(std::function< void()> on_cancel)
The OnCancel and OnDone callbacks must be specified.
Definition: FileDialog.cpp:358
void SetOnDone(std::function< void(const char *)> on_done)
The OnCancel and OnDone callbacks must be specified.
Definition: FileDialog.cpp:362
void AddFilter(const char *filter, const char *description)
Definition: FileDialog.cpp:339
ImGuiContext * context
Definition: Window.cpp:76
const Theme * theme
Definition: Window.cpp:74
static const std::string path
Definition: PointCloud.cpp:59
Generic file read and write utility for python interface.