ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ToggleSwitch.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 namespace cloudViewer {
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 cloudViewer
DrawResult Draw(const DrawContext &context) override
const char * GetText() const
Returns the text of the toggle slider.
void SetText(const char *text)
Sets the text of the toggle slider.
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
void SetOnClicked(std::function< void(bool)> on_clicked)
ImGuiContext * context
Definition: Window.cpp:76
Generic file read and write utility for python interface.