summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_parser.c25
-rw-r--r--apps/gui/skin_engine/skin_tokens.c13
-rw-r--r--apps/gui/skin_engine/wps_internals.h5
3 files changed, 40 insertions, 3 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 0db19645bc..dd34d84e9f 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -485,6 +485,27 @@ static int parse_viewport_gradient_setup(struct skin_element *element,
}
#endif
+static int parse_listitem(struct skin_element *element,
+ struct wps_token *token,
+ struct wps_data *wps_data)
+{
+ (void)wps_data;
+ struct listitem *li = (struct listitem *)skin_buffer_alloc(sizeof(struct listitem));
+ if (!li)
+ return 1;
+ token->value.data = li;
+ if (element->params_count == 0)
+ li->offset = 0;
+ else
+ {
+ li->offset = element->params[0].data.number;
+ if (element->params_count > 1)
+ li->wrap = strcasecmp(element->params[1].data.text, "nowrap") != 0;
+ else
+ li->wrap = true;
+ }
+ return 0;
+}
static int parse_listitemviewport(struct skin_element *element,
struct wps_token *token,
@@ -1827,6 +1848,10 @@ static int skin_element_callback(struct skin_element* element, void* data)
case SKIN_TOKEN_TRACK_ENDING:
function = parse_timeout_tag;
break;
+ case SKIN_TOKEN_LIST_ITEM_TEXT:
+ case SKIN_TOKEN_LIST_ITEM_ICON:
+ function = parse_listitem;
+ break;
#ifdef HAVE_LCD_BITMAP
case SKIN_TOKEN_DISABLE_THEME:
case SKIN_TOKEN_ENABLE_THEME:
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 371db46017..a4f0814945 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -922,14 +922,21 @@ const char *get_token_value(struct gui_wps *gwps,
snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type));
return buf;
case SKIN_TOKEN_LIST_ITEM_TEXT:
- return skinlist_get_item_text();
+ {
+ struct listitem *li = (struct listitem *)token->value.data;
+ return skinlist_get_item_text(li->offset, li->wrap, buf, buf_size);
+ }
case SKIN_TOKEN_LIST_ITEM_IS_SELECTED:
return skinlist_is_selected_item()?"s":"";
case SKIN_TOKEN_LIST_ITEM_ICON:
+ {
+ struct listitem *li = (struct listitem *)token->value.data;
+ int icon = skinlist_get_item_icon(li->offset, li->wrap);
if (intval)
- *intval = skinlist_get_item_icon();
- snprintf(buf, buf_size, "%d",skinlist_get_item_icon());
+ *intval = icon;
+ snprintf(buf, buf_size, "%d", icon);
return buf;
+ }
case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : "";
#endif
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 7d7afe95b1..244d08595e 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -294,6 +294,11 @@ struct substring {
struct wps_token *token;
};
+struct listitem {
+ bool wrap;
+ short offset;
+};
+
#ifdef HAVE_SKIN_VARIABLES
struct skin_var {
const char *label;