Open3D (C++ API)  0.18.0
FileDialog.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.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 open3d {
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, OPEN_DIR };
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 open3d
ImGuiContext * context
Definition: Window.cpp:76
const Theme * theme
Definition: Window.cpp:74
Base class for dialogs.
Definition: Dialog.h:19
Dialog(const char *title)
Definition: Dialog.cpp:23
Definition: FileDialog.h:22
void SetOnCancel(std::function< void()> on_cancel)
The OnCancel and OnDone callbacks must be specified.
Definition: FileDialog.cpp:365
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: FileDialog.cpp:410
void SetPath(const char *path)
Definition: FileDialog.cpp:318
void OnDone()
Definition: FileDialog.cpp:375
void OnWillShow() override
Definition: FileDialog.cpp:373
FileDialog(Mode type, const char *title, const Theme &theme)
Definition: FileDialog.cpp:218
void AddFilter(const char *filter, const char *description)
Definition: FileDialog.cpp:346
Mode
Definition: FileDialog.h:26
void SetOnDone(std::function< void(const char *)> on_done)
The OnCancel and OnDone callbacks must be specified.
Definition: FileDialog.cpp:369
virtual ~FileDialog()
Definition: FileDialog.cpp:316
Definition: Widget.h:49
char type
Definition: FilePCD.cpp:41
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Theme.h:20