ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TextEdit.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 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 cloudViewer
const char * GetText() const
Returns the current text value displayed.
Definition: TextEdit.cpp:52
virtual bool ValidateNewText(const char *text)
Definition: TextEdit.cpp:74
void SetPlaceholderText(const char *text)
Sets the text to display if the text value is empty.
Definition: TextEdit.cpp:60
DrawResult Draw(const DrawContext &context) override
Definition: TextEdit.cpp:83
void SetOnValueChanged(std::function< void(const char *)> on_value_changed)
Definition: TextEdit.cpp:69
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: TextEdit.cpp:76
const char * GetPlaceholderText() const
Returns the text displayed if the text value is empty.
Definition: TextEdit.cpp:56
void SetOnTextChanged(std::function< void(const char *)> on_text_changed)
Definition: TextEdit.cpp:64
ImGuiContext * context
Definition: Window.cpp:76
Generic file read and write utility for python interface.