ESPHome 2025.5.0
Loading...
Searching...
No Matches
lvgl_text.h
Go to the documentation of this file.
1#pragma once
2
3#include <utility>
4
9
10namespace esphome {
11namespace lvgl {
12
13class LVGLText : public text::Text {
14 public:
15 void set_control_lambda(std::function<void(const std::string)> control_lambda) {
16 this->control_lambda_ = std::move(control_lambda);
17 if (this->initial_state_.has_value()) {
19 this->initial_state_.reset();
20 }
21 }
22
23 protected:
24 void control(const std::string &value) override {
25 if (this->control_lambda_ != nullptr) {
26 this->control_lambda_(value);
27 } else {
28 this->initial_state_ = value;
29 }
30 }
31 std::function<void(const std::string)> control_lambda_{};
33};
34
35} // namespace lvgl
36} // namespace esphome
std::function< void(const std::string)> control_lambda_
Definition lvgl_text.h:31
void control(const std::string &value) override
Definition lvgl_text.h:24
optional< std::string > initial_state_
Definition lvgl_text.h:32
void set_control_lambda(std::function< void(const std::string)> control_lambda)
Definition lvgl_text.h:15
bool has_value() const
Definition optional.h:87
value_type const & value() const
Definition optional.h:89
Base-class for all text inputs.
Definition text.h:24
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7