tcMenu
src
extras
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
29
class
MenuItemDelegate
{
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
73
void
setChangedAndRemoteSend
();
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
MenuItems.h
In TcMenu, MenuItem storage is shared between program memory and RAM. Usually each MenuItem has assoc...
MenuItem
Definition:
MenuItems.h:329
tccore::MenuItemDelegate
Definition:
MenuItemDelegate.h:29
tccore::MenuItemDelegate::setChangedAndRemoteSend
void setChangedAndRemoteSend()
Definition:
MenuItemDelegate.cpp:44
tccore::MenuItemDelegate::isChanged
bool isChanged(AnyOrAll mode)
Definition:
MenuItemDelegate.cpp:71
tccore::MenuItemDelegate::isLocalOnly
bool isLocalOnly(AnyOrAll mode)
Definition:
MenuItemDelegate.cpp:63
tccore::MenuItemDelegate::AnyOrAll
AnyOrAll
Definition:
MenuItemDelegate.h:39
tccore::MenuItemDelegate::onEachItem
bool onEachItem(ItemDelegateFn itemDelegateFn, AnyOrAll modeAny)
Definition:
MenuItemDelegate.cpp:10
tccore::MenuItemDelegate::setChangedOnly
void setChangedOnly()
Definition:
MenuItemDelegate.cpp:52
tccore::MenuItemDelegate::ItemDelegateFn
bool(* ItemDelegateFn)(MenuItem *item, bool internalFlag)
Definition:
MenuItemDelegate.h:44
tccore::MenuItemDelegate::setVisible
void setVisible(bool visible)
Definition:
MenuItemDelegate.cpp:36
tccore::MenuItemDelegate::isReadOnly
bool isReadOnly(AnyOrAll mode)
Definition:
MenuItemDelegate.cpp:59
tccore::MenuItemDelegate::setLocalOnly
void setLocalOnly(bool localOnly)
Definition:
MenuItemDelegate.cpp:28
tccore::MenuItemDelegate::setReadOnly
void setReadOnly(bool readOnly)
Definition:
MenuItemDelegate.cpp:20
tccore::MenuItemDelegate::isVisible
bool isVisible(AnyOrAll mode)
Definition:
MenuItemDelegate.cpp:67
tccore::MenuItemDelegate::MenuItemDelegate
MenuItemDelegate(MenuItem **itemArray, int items)
Definition:
MenuItemDelegate.h:51