ESPHome  2024.11.0
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::display_menu_base::MenuItemSwitch Class Reference

#include <menu_item.h>

Inheritance diagram for esphome::display_menu_base::MenuItemSwitch:
esphome::display_menu_base::MenuItemEditable esphome::display_menu_base::MenuItem

Public Member Functions

 MenuItemSwitch ()
 
void set_switch_variable (switch_::Switch *var)
 
void set_on_text (const std::string &t)
 
void set_off_text (const std::string &t)
 
bool has_value () const override
 
std::string get_value_text () const override
 
bool select_next () override
 
bool select_prev () override
 
- Public Member Functions inherited from esphome::display_menu_base::MenuItemEditable
 MenuItemEditable (MenuItemType t)
 
void set_immediate_edit (bool val)
 
bool get_immediate_edit () const override
 
void set_value_lambda (value_getter_t &&getter)
 
- Public Member Functions inherited from esphome::display_menu_base::MenuItem
 MenuItem (MenuItemType t)
 
void set_parent (MenuItemMenu *parent)
 
MenuItemMenuget_parent ()
 
MenuItemType get_type () const
 
template<typename V >
void set_text (V val)
 
void add_on_enter_callback (std::function< void()> &&cb)
 
void add_on_leave_callback (std::function< void()> &&cb)
 
void add_on_value_callback (std::function< void()> &&cb)
 
std::string get_text () const
 
void on_enter ()
 
void on_leave ()
 

Protected Member Functions

bool get_switch_state_ () const
 
bool toggle_switch_ ()
 
- Protected Member Functions inherited from esphome::display_menu_base::MenuItem
void on_value_ ()
 

Protected Attributes

switch_::Switchswitch_var_ {nullptr}
 
std::string switch_on_text_
 
std::string switch_off_text_
 
- Protected Attributes inherited from esphome::display_menu_base::MenuItemEditable
bool immediate_edit_ {false}
 
optional< value_getter_tvalue_getter_ {}
 
- Protected Attributes inherited from esphome::display_menu_base::MenuItem
MenuItemType item_type_
 
MenuItemMenuparent_ {nullptr}
 
TemplatableValue< std::string, const MenuItem * > text_
 
CallbackManager< void()> on_enter_callbacks_ {}
 
CallbackManager< void()> on_leave_callbacks_ {}
 
CallbackManager< void()> on_value_callbacks_ {}
 

Detailed Description

Definition at line 139 of file menu_item.h.

Constructor & Destructor Documentation

◆ MenuItemSwitch()

esphome::display_menu_base::MenuItemSwitch::MenuItemSwitch ( )
inlineexplicit

Definition at line 141 of file menu_item.h.

Member Function Documentation

◆ get_switch_state_()

bool esphome::display_menu_base::MenuItemSwitch::get_switch_state_ ( ) const
protected

Definition at line 156 of file menu_item.cpp.

◆ get_value_text()

std::string esphome::display_menu_base::MenuItemSwitch::get_value_text ( ) const
overridevirtual

Reimplemented from esphome::display_menu_base::MenuItem.

Definition at line 140 of file menu_item.cpp.

◆ has_value()

bool esphome::display_menu_base::MenuItemSwitch::has_value ( ) const
inlineoverridevirtual

Reimplemented from esphome::display_menu_base::MenuItem.

Definition at line 146 of file menu_item.h.

◆ select_next()

bool esphome::display_menu_base::MenuItemSwitch::select_next ( )
overridevirtual

Reimplemented from esphome::display_menu_base::MenuItem.

Definition at line 152 of file menu_item.cpp.

◆ select_prev()

bool esphome::display_menu_base::MenuItemSwitch::select_prev ( )
overridevirtual

Reimplemented from esphome::display_menu_base::MenuItem.

Definition at line 154 of file menu_item.cpp.

◆ set_off_text()

void esphome::display_menu_base::MenuItemSwitch::set_off_text ( const std::string &  t)
inline

Definition at line 144 of file menu_item.h.

◆ set_on_text()

void esphome::display_menu_base::MenuItemSwitch::set_on_text ( const std::string &  t)
inline

Definition at line 143 of file menu_item.h.

◆ set_switch_variable()

void esphome::display_menu_base::MenuItemSwitch::set_switch_variable ( switch_::Switch var)
inline

Definition at line 142 of file menu_item.h.

◆ toggle_switch_()

bool esphome::display_menu_base::MenuItemSwitch::toggle_switch_ ( )
protected

Definition at line 158 of file menu_item.cpp.

Field Documentation

◆ switch_off_text_

std::string esphome::display_menu_base::MenuItemSwitch::switch_off_text_
protected

Definition at line 158 of file menu_item.h.

◆ switch_on_text_

std::string esphome::display_menu_base::MenuItemSwitch::switch_on_text_
protected

Definition at line 157 of file menu_item.h.

◆ switch_var_

switch_::Switch* esphome::display_menu_base::MenuItemSwitch::switch_var_ {nullptr}
protected

Definition at line 156 of file menu_item.h.


The documentation for this class was generated from the following files: