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

#include <menu_item.h>

Inheritance diagram for esphome::display_menu_base::MenuItem:
esphome::display_menu_base::MenuItemCommand esphome::display_menu_base::MenuItemEditable esphome::display_menu_base::MenuItemMenu esphome::display_menu_base::MenuItemCustom esphome::display_menu_base::MenuItemNumber esphome::display_menu_base::MenuItemSelect esphome::display_menu_base::MenuItemSwitch

Public Member Functions

 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
 
virtual bool get_immediate_edit () const
 
virtual bool has_value () const
 
virtual std::string get_value_text () const
 
virtual bool select_next ()
 
virtual bool select_prev ()
 
void on_enter ()
 
void on_leave ()
 

Protected Member Functions

void on_value_ ()
 

Protected Attributes

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 40 of file menu_item.h.

Constructor & Destructor Documentation

◆ MenuItem()

esphome::display_menu_base::MenuItem::MenuItem ( MenuItemType  t)
inlineexplicit

Definition at line 42 of file menu_item.h.

Member Function Documentation

◆ add_on_enter_callback()

void esphome::display_menu_base::MenuItem::add_on_enter_callback ( std::function< void()> &&  cb)
inline

Definition at line 47 of file menu_item.h.

◆ add_on_leave_callback()

void esphome::display_menu_base::MenuItem::add_on_leave_callback ( std::function< void()> &&  cb)
inline

Definition at line 48 of file menu_item.h.

◆ add_on_value_callback()

void esphome::display_menu_base::MenuItem::add_on_value_callback ( std::function< void()> &&  cb)
inline

Definition at line 49 of file menu_item.h.

◆ get_immediate_edit()

virtual bool esphome::display_menu_base::MenuItem::get_immediate_edit ( ) const
inlinevirtual

Reimplemented in esphome::display_menu_base::MenuItemEditable.

Definition at line 52 of file menu_item.h.

◆ get_parent()

MenuItemMenu* esphome::display_menu_base::MenuItem::get_parent ( )
inline

Definition at line 44 of file menu_item.h.

◆ get_text()

std::string esphome::display_menu_base::MenuItem::get_text ( ) const
inline

Definition at line 51 of file menu_item.h.

◆ get_type()

MenuItemType esphome::display_menu_base::MenuItem::get_type ( ) const
inline

Definition at line 45 of file menu_item.h.

◆ get_value_text()

virtual std::string esphome::display_menu_base::MenuItem::get_value_text ( ) const
inlinevirtual

◆ has_value()

virtual bool esphome::display_menu_base::MenuItem::has_value ( ) const
inlinevirtual

◆ on_enter()

void esphome::display_menu_base::MenuItem::on_enter ( )

Definition at line 31 of file menu_item.cpp.

◆ on_leave()

void esphome::display_menu_base::MenuItem::on_leave ( )

Definition at line 33 of file menu_item.cpp.

◆ on_value_()

void esphome::display_menu_base::MenuItem::on_value_ ( )
protected

Definition at line 35 of file menu_item.cpp.

◆ select_next()

virtual bool esphome::display_menu_base::MenuItem::select_next ( )
inlinevirtual

◆ select_prev()

virtual bool esphome::display_menu_base::MenuItem::select_prev ( )
inlinevirtual

◆ set_parent()

void esphome::display_menu_base::MenuItem::set_parent ( MenuItemMenu parent)
inline

Definition at line 43 of file menu_item.h.

◆ set_text()

template<typename V >
void esphome::display_menu_base::MenuItem::set_text ( val)
inline

Definition at line 46 of file menu_item.h.

Field Documentation

◆ item_type_

MenuItemType esphome::display_menu_base::MenuItem::item_type_
protected

Definition at line 65 of file menu_item.h.

◆ on_enter_callbacks_

CallbackManager<void()> esphome::display_menu_base::MenuItem::on_enter_callbacks_ {}
protected

Definition at line 69 of file menu_item.h.

◆ on_leave_callbacks_

CallbackManager<void()> esphome::display_menu_base::MenuItem::on_leave_callbacks_ {}
protected

Definition at line 70 of file menu_item.h.

◆ on_value_callbacks_

CallbackManager<void()> esphome::display_menu_base::MenuItem::on_value_callbacks_ {}
protected

Definition at line 71 of file menu_item.h.

◆ parent_

MenuItemMenu* esphome::display_menu_base::MenuItem::parent_ {nullptr}
protected

Definition at line 66 of file menu_item.h.

◆ text_

TemplatableValue<std::string, const MenuItem *> esphome::display_menu_base::MenuItem::text_
protected

Definition at line 67 of file menu_item.h.


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