Open3D (C++ API)  0.18.0+252c867
Button.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 
11 
12 #include <functional>
13 
15 
16 namespace open3d {
17 namespace visualization {
18 namespace gui {
19 
20 class Button : public Widget {
21 public:
22  explicit Button(const char* title);
23  explicit Button(std::shared_ptr<UIImage> image);
24  ~Button();
25 
28  const char* GetText() const;
30  void SetText(const char* text);
31 
33  float GetHorizontalPaddingEm() const;
34  float GetVerticalPaddingEm() const;
41  void SetPaddingEm(float horiz_ems, float vert_ems);
42 
43  bool GetIsToggleable() const;
44  void SetToggleable(bool toggles);
45 
46  bool GetIsOn() const;
47  void SetOn(bool is_on);
48 
50  const Constraints& constraints) const override;
51 
52  DrawResult Draw(const DrawContext& context) override;
53 
54  void SetOnClicked(std::function<void()> on_clicked);
55 
56 private:
57  struct Impl;
58  std::unique_ptr<Impl> impl_;
59 };
60 
61 } // namespace gui
62 } // namespace visualization
63 } // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
ImGuiContext * context
Definition: Window.cpp:76
Definition: Button.h:20
void SetPaddingEm(float horiz_ems, float vert_ems)
Definition: Button.cpp:60
void SetToggleable(bool toggles)
Definition: Button.cpp:67
~Button()
Definition: Button.cpp:46
void SetOnClicked(std::function< void()> on_clicked)
Definition: Button.cpp:77
float GetHorizontalPaddingEm() const
Returns the padding, in units of ems.
Definition: Button.cpp:52
DrawResult Draw(const DrawContext &context) override
Definition: Button.cpp:115
Button(const char *title)
Definition: Button.cpp:37
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: Button.cpp:81
bool GetIsOn() const
Definition: Button.cpp:69
float GetVerticalPaddingEm() const
Definition: Button.cpp:56
void SetOn(bool is_on)
Definition: Button.cpp:71
void SetText(const char *text)
Sets the text of the button. Do not call if this is an image button.
Definition: Button.cpp:50
bool GetIsToggleable() const
Definition: Button.cpp:65
const char * GetText() const
Definition: Button.cpp:48
Definition: Widget.h:49
DrawResult
Definition: Widget.h:95
Definition: PinholeCameraIntrinsic.cpp:16