ESPHome
2026.5.1
Loading...
Searching...
No Matches
esphome
components
lvgl
text
lvgl_text.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/text/text.h
"
4
#include "
esphome/core/automation.h
"
5
#include "
esphome/core/component.h
"
6
7
namespace
esphome::lvgl
{
8
9
class
LVGLText
:
public
text::Text
{
10
public
:
11
void
set_control_lambda
(
const
std::function<
void
(std::string)> &control_lambda) {
12
this->
control_lambda_
= control_lambda;
13
if
(this->
initial_state_
.has_value()) {
14
this->
control_lambda_
(this->
initial_state_
.value());
15
this->
initial_state_
.reset();
16
}
17
}
18
19
protected
:
20
void
control
(
const
std::string &value)
override
{
21
if
(this->
control_lambda_
!=
nullptr
) {
22
this->
control_lambda_
(value);
23
}
else
{
24
this->
initial_state_
= value;
25
}
26
}
27
std::function<void(std::string)>
control_lambda_
{};
28
optional<std::string>
initial_state_
{};
29
};
30
31
}
// namespace esphome::lvgl
esphome::lvgl::LVGLText
Definition
lvgl_text.h:9
esphome::lvgl::LVGLText::control
void control(const std::string &value) override
Definition
lvgl_text.h:20
esphome::lvgl::LVGLText::control_lambda_
std::function< void(std::string)> control_lambda_
Definition
lvgl_text.h:27
esphome::lvgl::LVGLText::initial_state_
optional< std::string > initial_state_
Definition
lvgl_text.h:28
esphome::lvgl::LVGLText::set_control_lambda
void set_control_lambda(const std::function< void(std::string)> &control_lambda)
Definition
lvgl_text.h:11
esphome::text::Text
Base-class for all text inputs.
Definition
text.h:21
component.h
automation.h
esphome::lvgl
Definition
lvgl_light.h:7
text.h
Generated by
1.12.0