tcMenu
MenuItemDelegate.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3  * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4  */
5 
6 #ifndef TCMENU_MENUITEMDELEGATE_H
7 #define TCMENU_MENUITEMDELEGATE_H
8 
14 #include <MenuItems.h>
15 
16 namespace tccore {
17 
30  private:
31  MenuItem** itemArray;
32  int numberOfItems;
33  bool internalFlag;
34  public:
39  enum AnyOrAll { ANY, ALL };
40 
44  typedef bool (*ItemDelegateFn)(MenuItem* item, bool internalFlag);
45 
51  MenuItemDelegate(MenuItem** itemArray, int items) : itemArray(itemArray), numberOfItems(items), internalFlag(false) {}
52 
57  void setReadOnly(bool readOnly);
58 
63  void setLocalOnly(bool localOnly);
64 
70  void setVisible(bool visible);
71 
74 
76  void setChangedOnly();
77 
83  bool isReadOnly(AnyOrAll mode);
84 
90  bool isLocalOnly(AnyOrAll mode);
91 
97  bool isVisible(AnyOrAll mode);
98 
104  bool isChanged(AnyOrAll mode);
105 
114  bool onEachItem(ItemDelegateFn itemDelegateFn, AnyOrAll modeAny);
115  };
116 }
117 
118 #endif //TCMENU_MENUITEMDELEGATE_H
In TcMenu, MenuItem storage is shared between program memory and RAM. Usually each MenuItem has assoc...
Definition: MenuItems.h:329
Definition: MenuItemDelegate.h:29
void setChangedAndRemoteSend()
Definition: MenuItemDelegate.cpp:44
bool isChanged(AnyOrAll mode)
Definition: MenuItemDelegate.cpp:71
bool isLocalOnly(AnyOrAll mode)
Definition: MenuItemDelegate.cpp:63
AnyOrAll
Definition: MenuItemDelegate.h:39
bool onEachItem(ItemDelegateFn itemDelegateFn, AnyOrAll modeAny)
Definition: MenuItemDelegate.cpp:10
void setChangedOnly()
Definition: MenuItemDelegate.cpp:52
bool(* ItemDelegateFn)(MenuItem *item, bool internalFlag)
Definition: MenuItemDelegate.h:44
void setVisible(bool visible)
Definition: MenuItemDelegate.cpp:36
bool isReadOnly(AnyOrAll mode)
Definition: MenuItemDelegate.cpp:59
void setLocalOnly(bool localOnly)
Definition: MenuItemDelegate.cpp:28
void setReadOnly(bool readOnly)
Definition: MenuItemDelegate.cpp:20
bool isVisible(AnyOrAll mode)
Definition: MenuItemDelegate.cpp:67
MenuItemDelegate(MenuItem **itemArray, int items)
Definition: MenuItemDelegate.h:51