Changes in uspace/lib/ui/src/list.c [f9c4c433:28ca31ed] in mainline
- File:
-
- 1 edited
-
uspace/lib/ui/src/list.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/list.c
rf9c4c433 r28ca31ed 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 1652 1652 } 1653 1653 1654 /** Save list position for later.1655 *1656 * The position will be valid even if the list is cleaned and re-populated1657 * (it just counts position from the top.)1658 *1659 * @param list UI list1660 * @param pos Place to store position1661 */1662 void ui_list_save_pos(ui_list_t *list, ui_list_pos_t *pos)1663 {1664 pos->page_idx = list->page_idx;1665 pos->cursor_idx = list->cursor_idx;1666 }1667 1668 /** Restore saved list position.1669 *1670 * The position will be valid even if the list is cleaned and re-populated1671 * (it just counts position from the top.)1672 *1673 * @param list UI list1674 * @param pos Saved list position1675 */1676 void ui_list_restore_pos(ui_list_t *list, ui_list_pos_t *pos)1677 {1678 size_t idx, i;1679 ui_list_entry_t *entry, *next;1680 1681 idx = 0;1682 entry = ui_list_first(list);1683 1684 for (i = 0; i < pos->cursor_idx; i++) {1685 next = ui_list_next(entry);1686 if (next != NULL) {1687 entry = next;1688 ++idx;1689 }1690 }1691 1692 list->cursor = entry;1693 list->cursor_idx = idx;1694 1695 idx = 0;1696 entry = ui_list_first(list);1697 1698 for (i = 0; i < pos->page_idx; i++) {1699 next = ui_list_next(entry);1700 if (next != NULL) {1701 entry = next;1702 ++idx;1703 }1704 }1705 1706 list->page = entry;1707 list->page_idx = idx;1708 }1709 1710 1654 /** @} 1711 1655 */
Note:
See TracChangeset
for help on using the changeset viewer.
