summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_engine.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-03-07 12:45:45 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-03-07 12:45:45 +0000
commit343001b5f86f61a48b8520c9a1eb2790f50a8b27 (patch)
treebc1cf0e7451adb10668e9c1cff90e76cbbf55e3d /apps/gui/skin_engine/skin_engine.c
parent4cc2cc430c026ce59d089f76c678202d977bad37 (diff)
downloadrockbox-343001b5f86f61a48b8520c9a1eb2790f50a8b27.tar.gz
rockbox-343001b5f86f61a48b8520c9a1eb2790f50a8b27.zip
Merge a bunch of code which is 99% identical so it makes it easier to add more of these later
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29535 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_engine.c')
-rw-r--r--apps/gui/skin_engine/skin_engine.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index fbedbb96fd..61a41d9bc3 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -259,3 +259,65 @@ void skin_request_full_update(enum skinnable_screens skin)
FOR_NB_SCREENS(i)
skins[skin][i].needs_full_update = true;
}
+
+
+void *skin_find_item(const char *label, enum skin_find_what what,
+ struct wps_data *data)
+{
+ const char *itemlabel = NULL;
+ union {
+ struct skin_token_list *linkedlist;
+ struct skin_element *vplist;
+ } list;
+ bool isvplist = false;
+ void *ret = NULL;
+ switch (what)
+ {
+ case SKIN_FIND_UIVP:
+ case SKIN_FIND_VP:
+ list.vplist = data->tree;
+ isvplist = true;
+ break;
+ case SKIN_FIND_IMAGE:
+ list.linkedlist = data->images;
+ break;
+#ifdef HAVE_TOUCHSCREEN
+ case SKIN_FIND_TOUCHREGION:
+ list.linkedlist = data->touchregions;
+ break;
+#endif
+ }
+
+ while (list.linkedlist)
+ {
+ bool skip = false;
+ switch (what)
+ {
+ case SKIN_FIND_UIVP:
+ case SKIN_FIND_VP:
+ ret = list.vplist->data;
+ itemlabel = ((struct skin_viewport *)ret)->label;
+ skip = !(((struct skin_viewport *)ret)->is_infovp ==
+ (what==SKIN_FIND_UIVP));
+ break;
+ case SKIN_FIND_IMAGE:
+ ret = list.linkedlist->token->value.data;
+ itemlabel = ((struct gui_img *)ret)->label;
+ break;
+#ifdef HAVE_TOUCHSCREEN
+ case SKIN_FIND_TOUCHREGION:
+ ret = list.linkedlist->token->value.data;
+ itemlabel = ((struct touchregion *)ret)->label;
+ break;
+#endif
+ }
+ if (!skip && itemlabel && !strcmp(itemlabel, label))
+ return ret;
+
+ if (isvplist)
+ list.vplist = list.vplist->next;
+ else
+ list.linkedlist = list.linkedlist->next;
+ }
+ return NULL;
+}