From 65f9df3083623484efccf502c33ecc959555d247 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 5 Jul 2012 22:44:13 +1000 Subject: skin_engine: Allow the %St() (setting) skin tag be used as a bar %St() or %St(, setting, ) Change-Id: I71396d683634d4d1ad2357018c4029ecb4229677 --- apps/gui/option_select.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'apps/gui/option_select.c') diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index ca206b86da..f85570d699 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -575,3 +575,28 @@ bool option_screen(const struct settings_list *setting, return false; } +int get_setting_info_for_bar(int setting_id, int *count, int *val) +{ + const struct settings_list *setting = &settings[setting_id]; + int var_type = setting->flags&F_T_MASK; + void (*function)(int) = NULL; + int oldvalue; + + if (var_type == F_T_INT || var_type == F_T_UINT) + { + oldvalue = *(int*)setting->setting; + } + else if (var_type == F_T_BOOL) + { + oldvalue = *(bool*)setting->setting?1:0; + } + else + { + *val = 0; + *count = 1; + return false; /* only int/bools can go here */ + } + + val_to_selection(setting, oldvalue, count, val, &function); + return true; +} -- cgit v1.2.3