Open3D (C++ API)  0.18.0+252c867
ToggleSwitch.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 namespace open3d {
15 namespace visualization {
16 namespace gui {
17 
18 class ToggleSwitch : public Widget {
19 public:
20  explicit ToggleSwitch(const char* title);
21  ~ToggleSwitch();
22 
24  const char* GetText() const;
26  void SetText(const char* text);
27 
28  bool GetIsOn() const;
29  void SetOn(bool is_on);
30 
32  const Constraints& constraints) const override;
33 
34  DrawResult Draw(const DrawContext& context) override;
35 
39  void SetOnClicked(std::function<void(bool)> on_clicked);
40 
41 private:
42  struct Impl;
43  std::unique_ptr<Impl> impl_;
44 };
45 
46 } // namespace gui
47 } // namespace visualization
48 } // namespace open3d
ImGuiContext * context
Definition: Window.cpp:76
Definition: ToggleSwitch.h:18
void SetText(const char *text)
Sets the text of the toggle slider.
void SetOn(bool is_on)
Definition: ToggleSwitch.cpp:42
ToggleSwitch(const char *title)
Definition: ToggleSwitch.cpp:32
~ToggleSwitch()
Definition: ToggleSwitch.cpp:38
DrawResult Draw(const DrawContext &context) override
Definition: ToggleSwitch.cpp:61
bool GetIsOn() const
Definition: ToggleSwitch.cpp:40
const char * GetText() const
Returns the text of the toggle slider.
void SetOnClicked(std::function< void(bool)> on_clicked)
Definition: ToggleSwitch.cpp:44
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: ToggleSwitch.cpp:48
Definition: Widget.h:49
DrawResult
Definition: Widget.h:95
Definition: PinholeCameraIntrinsic.cpp:16
Definition: ToggleSwitch.cpp:25