Merge remote-tracking branch 'OFW/dev' into dev

This commit is contained in:
MX 2024-05-15 18:25:03 +03:00
commit 548d370ab9
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
2 changed files with 28 additions and 0 deletions

View file

@ -338,6 +338,26 @@ void submenu_change_item_label(Submenu* submenu, uint32_t index, const char* lab
true);
}
void submenu_change_item_label(Submenu* submenu, uint32_t index, const char* label) {
furi_check(submenu);
furi_check(label);
with_view_model(
submenu->view,
SubmenuModel * model,
{
SubmenuItemArray_it_t it;
for(SubmenuItemArray_it(it, model->items); !SubmenuItemArray_end_p(it);
SubmenuItemArray_next(it)) {
if(index == SubmenuItemArray_cref(it)->index) {
furi_string_set_str(SubmenuItemArray_cref(it)->label, label);
break;
}
}
},
true);
}
void submenu_reset(Submenu* submenu) {
furi_check(submenu);
view_set_orientation(submenu->view, ViewOrientationHorizontal);

View file

@ -81,6 +81,14 @@ void submenu_add_lockable_item(
*/
void submenu_change_item_label(Submenu* submenu, uint32_t index, const char* label);
/** Change label of an existing item
*
* @param submenu Submenu instance
* @param index The index of the item
* @param label The new label
*/
void submenu_change_item_label(Submenu* submenu, uint32_t index, const char* label);
/** Remove all items from submenu
*
* @param submenu Submenu instance