tcMenu
testFixtures.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 _TESTFIXTURES_H_
7 #define _TESTFIXTURES_H_
8 
9 #include <PlatformDetermination.h>
10 #include "../tcMenu.h"
11 #include "../RuntimeMenuItem.h"
12 
19 //
20 // Complete structure containing most types:
21 // root: menuVolume
22 //
23 
24 #ifndef PRESSMECALLBACK
25 #define PRESSMECALLBACK NULL
26 #endif // PRESSMECALLBACK
27 
28 const PROGMEM AnalogMenuInfo minfoCaseTemp = { "Case Temp", 103, 0xffff, 255, NO_CALLBACK, 0, 2, "C" };
29 AnalogMenuItem menuCaseTemp(&minfoCaseTemp, 0, NULL);
30 
31 const PROGMEM FloatMenuInfo minfoFloatItem = { "FloatItem", 102, 0xffff, 4, NO_CALLBACK };
32 FloatMenuItem menuFloatItem(&minfoFloatItem, NULL);
33 const PROGMEM AnyMenuInfo minfoPressMe = { "Press Me", 101, 0xffff, 0, PRESSMECALLBACK };
34 ActionMenuItem menuPressMe(&minfoPressMe, &menuFloatItem);
35 
36 RENDERING_CALLBACK_NAME_INVOKE(backSubSecondLevelFn, backSubItemRenderFn, "Second Level", 0xffff, NULL)
37 BackMenuItem menuBackSecondLevel(backSubSecondLevelFn, &menuPressMe);
38 const PROGMEM SubMenuInfo minfoSecondLevel = { "SecondLevel", 100, 0xffff, 0, NO_CALLBACK };
39 SubMenuItem menuSecondLevel(&minfoSecondLevel, &menuBackSecondLevel, &menuCaseTemp);
40 
41 const PROGMEM AnalogMenuInfo minfoRHSTemp = { "R HS Temp", 8, 0xffff, 255, NO_CALLBACK, 0, 2, "C" };
42 AnalogMenuItem menuRHSTemp(&minfoRHSTemp, 0, &menuSecondLevel);
43 const PROGMEM AnalogMenuInfo minfoLHSTemp = { "L HS Temp", 7, 0xffff, 255, NO_CALLBACK, 0, 2, "C" };
44 AnalogMenuItem menuLHSTemp(&minfoLHSTemp, 0, &menuRHSTemp);
45 RENDERING_CALLBACK_NAME_INVOKE(backSubStatusFn, backSubItemRenderFn, "Status", 0xffff, NULL)
46 BackMenuItem menuBackStatus(backSubStatusFn, &menuLHSTemp);
47 const PROGMEM SubMenuInfo minfoStatus = { "Status", 5, 0xffff, 0, NO_CALLBACK };
48 SubMenuItem menuStatus(&minfoStatus, &menuBackStatus, NULL);
49 const PROGMEM AnalogMenuInfo minfoContrast = { "Contrast", 10, 6, 255, NO_CALLBACK, 0, 2, "" };
50 AnalogMenuItem menuContrast(&minfoContrast, 0, NULL);
51 const PROGMEM BooleanMenuInfo minfo12VStandby = { "12V Standby", 4, 0xffff, 1, NO_CALLBACK, NAMING_YES_NO };
52 BooleanMenuItem menu12VStandby(&minfo12VStandby, false, &menuContrast);
53 RENDERING_CALLBACK_NAME_INVOKE(backSubSettingsFn, backSubItemRenderFn, "Settings", 0xffff, NULL)
54 BackMenuItem menuBackSettings(backSubSettingsFn, &menu12VStandby);
55 const PROGMEM SubMenuInfo minfoSettings = { "Settings", 3, 0xffff, 0, NO_CALLBACK };
56 SubMenuItem menuSettings(&minfoSettings, &menuBackSettings, &menuStatus);
57 const char enumStrChannel_0[] PROGMEM = "CD Player";
58 const char enumStrChannel_1[] PROGMEM = "Turntable";
59 const char enumStrChannel_2[] PROGMEM = "Computer";
60 const char* const enumStrChannel[] PROGMEM = { enumStrChannel_0, enumStrChannel_1, enumStrChannel_2 };
61 const PROGMEM EnumMenuInfo minfoChannel = { "Channel", 2, 4, 2, NO_CALLBACK, enumStrChannel };
62 EnumMenuItem menuChannel(&minfoChannel, 0, &menuSettings);
63 const PROGMEM AnalogMenuInfo minfoVolume = { "Volume", 1, 2, 255, NO_CALLBACK, -190, 2, "dB" };
64 AnalogMenuItem menuVolume(&minfoVolume, 0, &menuChannel);
65 
66 
67 //
68 // A second very simple menu with no submenus and only two analog items.
69 // root: menuSimple1
70 //
71 
72 const PROGMEM AnalogMenuInfo minfoSimple2 = { "simple2", 1, 2, 255, NO_CALLBACK, -190, 2, "dB" };
73 AnalogMenuItem menuSimple2(&minfoSimple2, 0, NULL);
74 const PROGMEM AnalogMenuInfo minfoSimple1 = { "simple1", 1, 2, 255, NO_CALLBACK, -190, 2, "dB" };
75 AnalogMenuItem menuSimple1(&minfoSimple1, 0, &menuSimple2);
76 
77 #endif //_TESTFIXTURES_H_
@ NAMING_YES_NO
Definition: MenuItems.h:140
Definition: MenuItems.h:71
Definition: MenuItems.h:51
Definition: MenuItems.h:151
Definition: MenuItems.h:108
Definition: MenuItems.h:182
int backSubItemRenderFn(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
Definition: RuntimeMenuItem.cpp:344
Definition: MenuItems.h:672
Definition: MenuItems.h:476
Definition: RuntimeMenuItem.h:116
Definition: MenuItems.h:597
Definition: MenuItems.h:566
Definition: MenuItems.h:625
Definition: RuntimeMenuItem.h:149