Rockbox mail archive
Subject: Misconception in the "simple list" API
Misconception in the "simple list" API
What I don't like about the simple list API (in apps/gui/list.h) is the
following. Before you show a list you should initialize a data structure
via a call to 'simplelist_info_init', passing the structure to be
initialized as the parameter.
Then, in the simplest and, I think, most frequently used case, you add
the list items via 'simplelist_addline'. Here, there's already a
discrepancy. The first call suggests that you could, for example,
initialize two list structures and then show them one after the other.
But that's not true because the list items are stored in a static array,
hence there can only exist one list at a time.
There are two solutions to this: either make all functions and data
structures for simple lists static, or make them non-static (i.e. place
the list items array into the simplelist struct).
Personally I'd prefer the latter. What do you think?
Received on 2010-04-08
Page was last modified "Jan 10 2012" The Rockbox Crew