Open3D (C++ API)  0.18.0+5c982c7
TextEdit.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 TextEdit : public Widget {
19 public:
20  TextEdit();
21  ~TextEdit();
22 
24  const char* GetText() const;
27  void SetText(const char* text);
28 
30  const char* GetPlaceholderText() const;
32  void SetPlaceholderText(const char* text);
33 
35  const Constraints& constraints) const override;
36 
37  DrawResult Draw(const DrawContext& context) override;
38 
41  void SetOnTextChanged(std::function<void(const char*)> on_text_changed);
44  void SetOnValueChanged(std::function<void(const char*)> on_value_changed);
45 
46 protected:
49  virtual bool ValidateNewText(const char* text);
50 
51 private:
52  struct Impl;
53  std::unique_ptr<Impl> impl_;
54 };
55 
56 } // namespace gui
57 } // namespace visualization
58 } // namespace open3d
ImGuiContext * context
Definition: Window.cpp:76
Definition: TextEdit.h:18
const char * GetText() const
Returns the current text value displayed.
Definition: TextEdit.cpp:52
virtual bool ValidateNewText(const char *text)
Definition: TextEdit.cpp:74
const char * GetPlaceholderText() const
Returns the text displayed if the text value is empty.
Definition: TextEdit.cpp:56
~TextEdit()
Definition: TextEdit.cpp:50
void SetPlaceholderText(const char *text)
Sets the text to display if the text value is empty.
Definition: TextEdit.cpp:60
TextEdit()
Definition: TextEdit.cpp:45
void SetText(const char *text)
Definition: TextEdit.cpp:54
DrawResult Draw(const DrawContext &context) override
Definition: TextEdit.cpp:83
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: TextEdit.cpp:76
void SetOnTextChanged(std::function< void(const char *)> on_text_changed)
Definition: TextEdit.cpp:64
void SetOnValueChanged(std::function< void(const char *)> on_value_changed)
Definition: TextEdit.cpp:69
Definition: Widget.h:49
DrawResult
Definition: Widget.h:95
Definition: PinholeCameraIntrinsic.cpp:16