This commit is contained in:
kraus 2021-10-17 23:14:45 +02:00
parent cd911cc831
commit 76d3e5ab02
3 changed files with 153 additions and 15 deletions

View File

@ -1442,7 +1442,7 @@ uint8_t mui_u8g2_u16_list_parent_wm_mse_pi(mui_t *ui, uint8_t msg)
switch(msg)
{
case MUIF_MSG_DRAW:
mui_u8g2_draw_button_pi(ui, ui->arg, 1, element_cb(data, *selection));
mui_u8g2_draw_button_pi(ui, 0, 1, element_cb(data, *selection));
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), ui->arg, 1, MUI_U8G2_V_PADDING, element_cb(data, *selection));
break;
case MUIF_MSG_FORM_START:

View File

@ -148,26 +148,29 @@ uint8_t mui_u8g2_u8_char_wm_mud_pi(mui_t *ui, uint8_t msg); /* MUIF_VARIABLE
(void *)((mui_u8g2_u8_min_max_t [] ) {{ (valptr) MUI_U8G2_COMMA (min) MUI_U8G2_COMMA (max)}}), \
(muif))
uint8_t mui_u8g2_u8_min_max_wm_mse_pi(mui_t *ui, uint8_t msg); // data: mui_u8g2_u8_min_max_t *
uint8_t mui_u8g2_u8_min_max_wm_mud_pi(mui_t *ui, uint8_t msg); // data: mui_u8g2_u8_min_max_t *
uint8_t mui_u8g2_u8_min_max_wm_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U8_MIN_MAX, MUI_XY */
uint8_t mui_u8g2_u8_min_max_wm_mud_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U8_MIN_MAX, MUI_XY */
uint8_t mui_u8g2_u8_min_max_wm_mse_pf(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_min_max_wm_mud_pf(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_min_max_wm_mse_pf(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U8_MIN_MAX, MUI_XY */
uint8_t mui_u8g2_u8_min_max_wm_mud_pf(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U8_MIN_MAX, MUI_XY */
/*===== data = mui_u8g2_list_t* =====*/
/* similar to mui_u8g2_u8_opt_line, but u16 and dynamic list */
#define MUIF_U8G2_U16_LIST(id, valptr, dataptr, getcb, cntcb, muif) \
MUIF(id, MUIF_CFLAG_IS_CURSOR_SELECTABLE, \
(void *)((mui_u8g2_list_t [] ) {{ (valptr) MUI_U8G2_COMMA (dataptr) MUI_U8G2_COMMA (getcb) MUI_U8G2_COMMA (cntcb)}}), \
(muif))
uint8_t mui_u8g2_u16_list_line_wa_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_line_wa_mud_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_line_wa_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=pixel fieldsize */
uint8_t mui_u8g2_u16_list_line_wa_mud_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=pixel fieldsize */
uint8_t mui_u8g2_u16_list_parent_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_child_w1_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u16_list_parent_wm_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=subform */
uint8_t mui_u8g2_u16_list_child_w1_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=sub element number */
uint8_t mui_u8g2_u16_list_goto_w1_mse_pi(mui_t *ui, uint8_t msg); /* first char of the string denotes the target form */
uint8_t mui_u8g2_u16_list_goto_w1_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST first char of the string denotes the target form */
#ifdef __cplusplus

View File

@ -26,6 +26,10 @@ uint8_t color_input = 0;
uint8_t food_input = 0;
uint8_t text_input[4] = { ' ',' ',' ',' '} ;
uint16_t list_selection_1 = 0;
uint16_t list_selection_2 = 0;
uint16_t list_selection_3 = 0;
uint8_t number_input = 2; // variable where the user can input a number between 0 and 9
uint8_t number_input2 = 100; // variable where the user can input a number between 0 and 9
@ -46,6 +50,22 @@ uint8_t array_led_on_time[4] = { 10, 5, 3, 1};
uint8_t led_on_time = 0;
/*=================================================*/
/* user element access functions */
static const char *animals[] = { "Bird", "Bison", "Cat", "Crow", "Dog", "Elephant", "Fish", "Gnu", "Horse", "Koala", "Lion", "Mouse", "Owl", "Rabbit", "Spider", "Turtle", "Zebra" };
uint16_t animals_get_cnt(void *data)
{
return sizeof(animals)/sizeof(*animals); /* number of animals */
}
const char *animals_get_str(void *data, uint16_t index)
{
return animals[index];
}
/*=================================================*/
/* style */
@ -56,8 +76,8 @@ uint8_t mui_style_helv_r_08(mui_t *ui, uint8_t msg)
switch(msg)
{
case MUIF_MSG_DRAW:
u8g2_SetFont(u8g2, u8g2_font_helvR08_tr);
break;
}
return 0;
@ -69,6 +89,7 @@ uint8_t mui_style_helv_b_08(mui_t *ui, uint8_t msg)
switch(msg)
{
case MUIF_MSG_DRAW:
u8g2_SetFont(u8g2, u8g2_font_helvB08_tr);
break;
}
@ -128,6 +149,18 @@ uint8_t mui_style_streamline_interface_essential_login(mui_t *ui, uint8_t msg)
}
uint8_t mui_style_glasstown(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
switch(msg)
{
case MUIF_MSG_DRAW:
u8g2_SetFont(u8g2, u8g2_font_glasstown_nbp_tr);
break;
}
return 0;
}
/*=================================================*/
@ -240,6 +273,10 @@ muif_t muif_list[] MUI_PROGMEM = {
/* monospaced font, good for mui_u8g2_u8_char_wm_mud_pi */
MUIF_STYLE(5, mui_style_monospaced),
/* smaller replacement for style 0 */
MUIF_STYLE(6, mui_style_glasstown),
/* horizontal line (hrule) */
MUIF_RO("HR", mui_hrule),
@ -283,6 +320,12 @@ muif_t muif_list[] MUI_PROGMEM = {
MUIF_VARIABLE("T2", text_input+2, mui_u8g2_u8_char_wm_mud_pi),
MUIF_VARIABLE("T3", text_input+3, mui_u8g2_u8_char_wm_mud_pi),
/* Form 70: One of many selection within the same field */
MUIF_U8G2_U16_LIST("A1", &list_selection_1, NULL, animals_get_str, animals_get_cnt, mui_u8g2_u16_list_line_wa_mse_pi),
MUIF_U8G2_U16_LIST("A2", &list_selection_2, NULL, animals_get_str, animals_get_cnt, mui_u8g2_u16_list_line_wa_mud_pi),
MUIF_U8G2_U16_LIST("AP", &list_selection_3, NULL, animals_get_str, animals_get_cnt, mui_u8g2_u16_list_parent_wm_mse_pi),
MUIF_U8G2_U16_LIST("AC", &list_selection_3, NULL, animals_get_str, animals_get_cnt, mui_u8g2_u16_list_child_w1_mse_pi),
};
@ -301,8 +344,8 @@ MUI_DATA("GP",
MUI_40 "uint8 Cycle Options|"
MUI_50 "uint8 ParentChild Select|"
MUI_60 "uint8 Char/Text Input|"
MUI_16 "Single Line Selection|"
MUI_17 "List Line Selection|"
MUI_70 "uint16 Cycle Options|"
MUI_80 "uint16 ParentChild Select|"
MUI_18 "Parent/Child List|"
MUI_20 "Array Edit")
MUI_XYA("GC", 5, 25, 0)
@ -553,8 +596,8 @@ MUI_LABEL(1,25, "Child: Show selectable options")
MUI_XY("HR", 0,26)
MUI_STYLE(0)
MUI_XYA("ca", 5, 38, 0)
MUI_XYA("ca", 5, 48, 1)
MUI_XYA("ca", 5, 58, 2)
MUI_XYA("ca", 5, 49, 1)
MUI_XYA("ca", 5, 60, 2)
MUI_FORM(53)
MUI_STYLE(2)
@ -615,6 +658,98 @@ MUI_XY("T3",64, 40)
MUI_STYLE(0)
MUI_GOTO(64, 59, 60, " Ok ")
MUI_FORM(70)
MUI_STYLE(1)
MUI_LABEL(5,10, "uint16 Cycle Options")
MUI_XY("HR", 0,13)
MUI_STYLE(0)
MUI_DATA("GP",
MUI_71 "u16_list_line_wa_mse_pi|"
MUI_72 "u16_list_line_wa_mud_pi|"
MUI_1 "Back to Main Menu" )
MUI_XYA("GC", 5, 25, 0)
MUI_XYA("GC", 5, 37, 1)
MUI_XYA("GC", 5, 49, 2)
MUI_XYA("GC", 5, 61, 3)
MUI_FORM(71)
MUI_STYLE(2)
MUI_LABEL(1,5, "mui_u8g2_u16_list_line_wa_mse_pi")
MUI_LABEL(1,12, "MUIF_U8G2_U16_LIST")
MUI_LABEL(1,19, "MUI_XYA")
MUI_LABEL(1,25, "Cycle through options")
MUI_XY("HR", 0,26)
MUI_STYLE(0)
MUI_LABEL(5,40, "Animal:")
MUI_XYA("A1",45, 40, 50)
MUI_GOTO(64, 59, 70, " Ok ")
MUI_FORM(72)
MUI_STYLE(2)
MUI_LABEL(1,5, "mui_u8g2_u16_list_line_wa_mud_pi")
MUI_LABEL(1,12, "MUIF_U8G2_U16_LIST")
MUI_LABEL(1,19, "MUI_XYA")
MUI_LABEL(1,25, "Cycle through options")
MUI_XY("HR", 0,26)
MUI_STYLE(0)
MUI_LABEL(5,40, "Animal:")
MUI_XYA("A2",45, 40, 50)
MUI_GOTO(64, 59, 70, " Ok ")
//uint8_t mui_u8g2_u16_list_parent_wm_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=subform */
//uint8_t mui_u8g2_u16_list_child_w1_mse_pi(mui_t *ui, uint8_t msg); /* MUIF_U8G2_U16_LIST, MUI_XYA, arg=sub element number */
MUI_FORM(80)
MUI_STYLE(1)
MUI_LABEL(0,10, "uint8 ParentChild Select")
MUI_XY("HR", 0,13)
MUI_STYLE(6)
MUI_DATA("GP",
MUI_81 "u16_list_parent_wm_mse_pi|"
MUI_1 "Back to Main Menu" )
MUI_XYA("GC", 0, 25, 0)
MUI_XYA("GC", 0, 37, 1)
MUI_XYA("GC", 0, 49, 2)
//MUI_XYA("GC", 5, 61, 3)
MUI_FORM(81)
MUI_STYLE(2)
MUI_LABEL(1,5, "..._u16_list_parent_wm_mse_pi")
MUI_LABEL(1,12, "MUIF_U8G2_U16_LIST")
MUI_LABEL(1,19, "MUI_XYA")
MUI_LABEL(1,25, "Parent: Show selected option")
MUI_XY("HR", 0,26)
MUI_STYLE(0)
MUI_LABEL(5,40, "Animal:")
MUI_XYA("AP",50, 40, 82) /* jump to sub form 19 */
MUI_GOTO(64, 59, 80, " Ok ")
MUI_FORM(82)
MUI_STYLE(2)
MUI_LABEL(1,5, "...u16_list_child_w1_mse_pi")
MUI_LABEL(1,12, "MUIF_U8G2_U16_LIST")
MUI_LABEL(1,19, "MUI_XYA")
MUI_LABEL(1,25, "Child: Show selectable options")
MUI_XY("HR", 0,26)
MUI_STYLE(0)
MUI_XYA("AC", 5, 38, 0)
MUI_XYA("AC", 5, 49, 1)
MUI_XYA("AC", 5, 60, 2)
/*
MUIF_VARIABLE("P1",&color_input,mui_u8g2_u8_opt_parent_wm_mse_pi),
MUIF_VARIABLE("c1",&color_input,mui_u8g2_u8_opt_radio_child_w1_mse_pi),