This commit is contained in:
kraus 2021-09-19 15:58:55 +02:00
parent ec80b4ecd7
commit 3571b53203
4 changed files with 54 additions and 7 deletions

View File

@ -271,3 +271,4 @@ https://github.com/olikraus/u8g2 ChangeLog
* Bugfix drawButtonUTF8 (added C++ code, issue 1577)
2021-09-19 v2.31.1 olikraus@gmail.com
* Added icons from https://app.streamlinehq.com/icons/pixel (issue 1589)
2021-xx-x v2.xx.xx olikraus@gmail.com

View File

@ -1096,7 +1096,7 @@ uint8_t mui_u8g2_u8_opt_child_mse_common(mui_t *ui, uint8_t msg)
}
uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
uint8_t mui_u8g2_u8_opt_radio_child_wm_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
@ -1141,7 +1141,7 @@ uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
}
uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg)
uint8_t mui_u8g2_u8_opt_radio_child_w1_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
@ -1186,6 +1186,48 @@ uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg)
return 0;
}
uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
uint8_t *value = (uint8_t *)muif_get_data(ui->uif);
uint8_t arg = ui->arg; // remember the arg value, because it might be overwritten
switch(msg)
{
case MUIF_MSG_DRAW:
{
u8g2_uint_t w = 0;
u8g2_uint_t x = mui_get_x(ui); // if mui_GetSelectableFieldTextOption is called, then field vars are overwritten, so get the value
u8g2_uint_t y = mui_get_y(ui); // if mui_GetSelectableFieldTextOption is called, then field vars are overwritten, so get the value
uint8_t flags = 0;
uint8_t is_focus = mui_IsCursorFocus(ui);
if ( ui->text[0] == '\0' )
{
/* if the text is not provided, then try to get the text from the previous (saved) element, assuming that this contains the selection */
/* this will overwrite all ui member functions, so we must not access any ui members (except ui->text) any more */
mui_GetSelectableFieldTextOption(ui, ui->last_form_id, ui->last_form_cursor_focus_position, arg + ui->form_scroll_top);
}
if ( is_focus )
{
flags = U8G2_BTN_INV;
}
if ( ui->text[0] != '\0' )
{
u8g2_DrawButtonUTF8(u8g2, x, y, flags, w, 1, 1, ui->text);
}
}
break;
default:
return mui_u8g2_u8_opt_child_mse_common(ui, msg);
}
return 0;
}
/*
data: mui_u8g2_list_t *
*/

View File

@ -130,8 +130,9 @@ uint8_t mui_u8g2_u8_opt_line_wa_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_line_wa_mud_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_parent_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_radio_child_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_radio_child_w1_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_child_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_opt_child_w1_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_chkbox_wm_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_radio_wm_pi(mui_t *ui, uint8_t msg);

View File

@ -218,7 +218,7 @@ muif_t muif_list[] MUI_PROGMEM = {
//MUIF("OC",MUIF_CFLAG_IS_CURSOR_SELECTABLE,&color_input,mui_u8g2_u8_opt_child_w1_mse_pi),
//MUIF("OC",MUIF_CFLAG_IS_CURSOR_SELECTABLE,&color_input,mui_u8g2_u8_opt_child_w1_mse_pi),
//MUIF("OC",MUIF_CFLAG_IS_CURSOR_SELECTABLE,&color_input,mui_u8g2_u8_opt_child_w1_mse_pi),
MUIF_VARIABLE("OC",&color_input,mui_u8g2_u8_opt_child_w1_mse_pi),
MUIF_VARIABLE("OC",&color_input,mui_u8g2_u8_opt_radio_child_w1_mse_pi),
MUIF_VARIABLE("ID",&food_input,mui_u8g2_u8_opt_parent_wm_mse_pi),
MUIF_VARIABLE("OD",&food_input,mui_u8g2_u8_opt_child_wm_mse_pi),
@ -468,9 +468,12 @@ MUI_STYLE(1)
MUI_LABEL(5,10, "Food & Drink Selection")
MUI_XY("HR", 0,13)
MUI_STYLE(3)
MUI_XYA("OD", 5, 30, 0)
MUI_XYA("OD", 5, 42, 1)
MUI_XYA("OD", 5, 54, 2)
MUI_XYA("OD", 3, 45, 0)
MUI_XYA("OD", 28, 45, 1)
MUI_XYA("OD", 53, 45, 2)
MUI_XYA("OD", 78, 45, 3)
MUI_XYA("OD", 103, 45, 4)
/* minimal example */