ESPHome
2024.10.2
esphome
esphome
components
display_menu_base
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/automation.h
"
4
#include "
display_menu_base.h
"
5
6
namespace
esphome
{
7
namespace
display_menu_base {
8
9
template
<
typename
... Ts>
class
UpAction
:
public
Action
<Ts...> {
10
public
:
11
explicit
UpAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
12
13
void
play
(Ts...
x
)
override
{ this->
menu_
->
up
(); }
14
15
protected
:
16
DisplayMenuComponent
*
menu_
;
17
};
18
19
template
<
typename
... Ts>
class
DownAction
:
public
Action
<Ts...> {
20
public
:
21
explicit
DownAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
22
23
void
play
(Ts...
x
)
override
{ this->
menu_
->
down
(); }
24
25
protected
:
26
DisplayMenuComponent
*
menu_
;
27
};
28
29
template
<
typename
... Ts>
class
LeftAction
:
public
Action
<Ts...> {
30
public
:
31
explicit
LeftAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
32
33
void
play
(Ts...
x
)
override
{ this->
menu_
->
left
(); }
34
35
protected
:
36
DisplayMenuComponent
*
menu_
;
37
};
38
39
template
<
typename
... Ts>
class
RightAction
:
public
Action
<Ts...> {
40
public
:
41
explicit
RightAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
42
43
void
play
(Ts...
x
)
override
{ this->
menu_
->
right
(); }
44
45
protected
:
46
DisplayMenuComponent
*
menu_
;
47
};
48
49
template
<
typename
... Ts>
class
EnterAction
:
public
Action
<Ts...> {
50
public
:
51
explicit
EnterAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
52
53
void
play
(Ts...
x
)
override
{ this->
menu_
->
enter
(); }
54
55
protected
:
56
DisplayMenuComponent
*
menu_
;
57
};
58
59
template
<
typename
... Ts>
class
ShowAction
:
public
Action
<Ts...> {
60
public
:
61
explicit
ShowAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
62
63
void
play
(Ts...
x
)
override
{ this->
menu_
->
show
(); }
64
65
protected
:
66
DisplayMenuComponent
*
menu_
;
67
};
68
69
template
<
typename
... Ts>
class
HideAction
:
public
Action
<Ts...> {
70
public
:
71
explicit
HideAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
72
73
void
play
(Ts...
x
)
override
{ this->
menu_
->
hide
(); }
74
75
protected
:
76
DisplayMenuComponent
*
menu_
;
77
};
78
79
template
<
typename
... Ts>
class
ShowMainAction
:
public
Action
<Ts...> {
80
public
:
81
explicit
ShowMainAction
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
82
83
void
play
(Ts...
x
)
override
{ this->
menu_
->
show_main
(); }
84
85
protected
:
86
DisplayMenuComponent
*
menu_
;
87
};
88
template
<
typename
... Ts>
class
IsActiveCondition
:
public
Condition
<Ts...> {
89
public
:
90
explicit
IsActiveCondition
(
DisplayMenuComponent
*menu) :
menu_
(menu) {}
91
bool
check
(Ts...
x
)
override
{
return
this->
menu_
->
is_active
(); }
92
93
protected
:
94
DisplayMenuComponent
*
menu_
;
95
};
96
97
class
DisplayMenuOnEnterTrigger
:
public
Trigger
<const MenuItem *> {
98
public
:
99
explicit
DisplayMenuOnEnterTrigger
(
MenuItem
*parent) {
100
parent->
add_on_enter_callback
([
this
, parent]() { this->trigger(parent); });
101
}
102
};
103
104
class
DisplayMenuOnLeaveTrigger
:
public
Trigger
<const MenuItem *> {
105
public
:
106
explicit
DisplayMenuOnLeaveTrigger
(
MenuItem
*parent) {
107
parent->
add_on_leave_callback
([
this
, parent]() { this->trigger(parent); });
108
}
109
};
110
111
class
DisplayMenuOnValueTrigger
:
public
Trigger
<const MenuItem *> {
112
public
:
113
explicit
DisplayMenuOnValueTrigger
(
MenuItem
*parent) {
114
parent->
add_on_value_callback
([
this
, parent]() { this->trigger(parent); });
115
}
116
};
117
118
class
DisplayMenuOnNextTrigger
:
public
Trigger
<const MenuItem *> {
119
public
:
120
explicit
DisplayMenuOnNextTrigger
(
MenuItemCustom
*parent) {
121
parent->
add_on_next_callback
([
this
, parent]() { this->trigger(parent); });
122
}
123
};
124
125
class
DisplayMenuOnPrevTrigger
:
public
Trigger
<const MenuItem *> {
126
public
:
127
explicit
DisplayMenuOnPrevTrigger
(
MenuItemCustom
*parent) {
128
parent->
add_on_prev_callback
([
this
, parent]() { this->trigger(parent); });
129
}
130
};
131
132
}
// namespace display_menu_base
133
}
// namespace esphome
esphome::display_menu_base::DisplayMenuOnLeaveTrigger::DisplayMenuOnLeaveTrigger
DisplayMenuOnLeaveTrigger(MenuItem *parent)
Definition:
automation.h:106
esphome::display_menu_base::ShowAction::ShowAction
ShowAction(DisplayMenuComponent *menu)
Definition:
automation.h:61
esphome::display_menu_base::UpAction::UpAction
UpAction(DisplayMenuComponent *menu)
Definition:
automation.h:11
esphome::display_menu_base::ShowAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:66
esphome::display_menu_base::DownAction::DownAction
DownAction(DisplayMenuComponent *menu)
Definition:
automation.h:21
esphome::display_menu_base::ShowAction::play
void play(Ts... x) override
Definition:
automation.h:63
esphome::display_menu_base::DownAction
Definition:
automation.h:19
esphome::display_menu_base::DisplayMenuComponent::up
void up()
Definition:
display_menu_base.cpp:7
esphome::display_menu_base::DisplayMenuComponent::hide
void hide()
Definition:
display_menu_base.cpp:215
x
uint16_t x
Definition:
tt21100.cpp:17
esphome::display_menu_base::DisplayMenuComponent::show
void show()
Definition:
display_menu_base.cpp:199
esphome::display_menu_base::DownAction::play
void play(Ts... x) override
Definition:
automation.h:23
esphome::display_menu_base::UpAction::play
void play(Ts... x) override
Definition:
automation.h:13
automation.h
esphome::display_menu_base::MenuItemCustom
Definition:
menu_item.h:170
esphome::display_menu_base::RightAction::RightAction
RightAction(DisplayMenuComponent *menu)
Definition:
automation.h:41
esphome::display_menu_base::ShowAction
Definition:
automation.h:59
esphome::display_menu_base::MenuItemCustom::add_on_prev_callback
void add_on_prev_callback(std::function< void()> &&cb)
Definition:
menu_item.h:174
esphome::display_menu_base::MenuItem
Definition:
menu_item.h:40
esphome::display_menu_base::IsActiveCondition
Definition:
automation.h:88
esphome::display_menu_base::DisplayMenuOnNextTrigger
Definition:
automation.h:118
esphome::display_menu_base::UpAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:16
esphome::display_menu_base::IsActiveCondition::check
bool check(Ts... x) override
Definition:
automation.h:91
esphome::display_menu_base::HideAction
Definition:
automation.h:69
esphome::display_menu_base::HideAction::play
void play(Ts... x) override
Definition:
automation.h:73
esphome::display_menu_base::LeftAction
Definition:
automation.h:29
esphome::display_menu_base::DisplayMenuComponent::left
void left()
Definition:
display_menu_base.cpp:49
esphome::Action
Definition:
automation.h:121
esphome::display_menu_base::DownAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:26
esphome::Condition
Base class for all automation conditions.
Definition:
automation.h:74
esphome::display_menu_base::EnterAction
Definition:
automation.h:49
esphome::display_menu_base::LeftAction::play
void play(Ts... x) override
Definition:
automation.h:33
esphome::display_menu_base::DisplayMenuComponent::show_main
void show_main()
Definition:
display_menu_base.cpp:169
esphome::display_menu_base::DisplayMenuOnValueTrigger::DisplayMenuOnValueTrigger
DisplayMenuOnValueTrigger(MenuItem *parent)
Definition:
automation.h:113
esphome::display_menu_base::MenuItemCustom::add_on_next_callback
void add_on_next_callback(std::function< void()> &&cb)
Definition:
menu_item.h:173
esphome::display_menu_base::UpAction
Definition:
automation.h:9
esphome::display_menu_base::HideAction::HideAction
HideAction(DisplayMenuComponent *menu)
Definition:
automation.h:71
esphome::display_menu_base::LeftAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:36
esphome::display_menu_base::ShowMainAction::play
void play(Ts... x) override
Definition:
automation.h:83
esphome::display_menu_base::EnterAction::EnterAction
EnterAction(DisplayMenuComponent *menu)
Definition:
automation.h:51
esphome::display_menu_base::LeftAction::LeftAction
LeftAction(DisplayMenuComponent *menu)
Definition:
automation.h:31
esphome::display_menu_base::DisplayMenuOnLeaveTrigger
Definition:
automation.h:104
esphome::display_menu_base::MenuItem::add_on_enter_callback
void add_on_enter_callback(std::function< void()> &&cb)
Definition:
menu_item.h:47
esphome::display_menu_base::DisplayMenuOnPrevTrigger::DisplayMenuOnPrevTrigger
DisplayMenuOnPrevTrigger(MenuItemCustom *parent)
Definition:
automation.h:127
esphome::display_menu_base::DisplayMenuOnNextTrigger::DisplayMenuOnNextTrigger
DisplayMenuOnNextTrigger(MenuItemCustom *parent)
Definition:
automation.h:120
esphome::display_menu_base::DisplayMenuOnEnterTrigger::DisplayMenuOnEnterTrigger
DisplayMenuOnEnterTrigger(MenuItem *parent)
Definition:
automation.h:99
esphome::display_menu_base::MenuItem::add_on_value_callback
void add_on_value_callback(std::function< void()> &&cb)
Definition:
menu_item.h:49
esphome::display_menu_base::ShowMainAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:86
esphome::display_menu_base::DisplayMenuOnPrevTrigger
Definition:
automation.h:125
esphome::display_menu_base::HideAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:76
esphome::display_menu_base::DisplayMenuOnValueTrigger
Definition:
automation.h:111
esphome::display_menu_base::DisplayMenuComponent::right
void right()
Definition:
display_menu_base.cpp:87
esphome::display_menu_base::RightAction
Definition:
automation.h:39
esphome::display_menu_base::ShowMainAction
Definition:
automation.h:79
esphome::display_menu_base::IsActiveCondition::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:94
esphome::display_menu_base::DisplayMenuOnEnterTrigger
Definition:
automation.h:97
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::Trigger
Definition:
automation.h:92
esphome::display_menu_base::DisplayMenuComponent::down
void down()
Definition:
display_menu_base.cpp:28
esphome::display_menu_base::DisplayMenuComponent::enter
void enter()
Definition:
display_menu_base.cpp:116
esphome::display_menu_base::RightAction::play
void play(Ts... x) override
Definition:
automation.h:43
display_menu_base.h
esphome::display_menu_base::MenuItem::add_on_leave_callback
void add_on_leave_callback(std::function< void()> &&cb)
Definition:
menu_item.h:48
esphome::display_menu_base::EnterAction::play
void play(Ts... x) override
Definition:
automation.h:53
esphome::display_menu_base::EnterAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:56
esphome::display_menu_base::DisplayMenuComponent
Class to display a hierarchical menu.
Definition:
display_menu_base.h:22
esphome::display_menu_base::DisplayMenuComponent::is_active
bool is_active() const
Definition:
display_menu_base.h:43
esphome::display_menu_base::ShowMainAction::ShowMainAction
ShowMainAction(DisplayMenuComponent *menu)
Definition:
automation.h:81
esphome::display_menu_base::IsActiveCondition::IsActiveCondition
IsActiveCondition(DisplayMenuComponent *menu)
Definition:
automation.h:90
esphome::display_menu_base::RightAction::menu_
DisplayMenuComponent * menu_
Definition:
automation.h:46
Generated by
1.8.13