2005-10-28 00:00:00 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2005-10-30 01:24:35 +00:00
|
|
|
* Copyright (C) 2005 by Kevin Ferrare
|
2005-10-28 00:00:00 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-10-28 00:00:00 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _GUI_LIST_H_
|
|
|
|
#define _GUI_LIST_H_
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "icon.h"
|
|
|
|
#include "screen_access.h"
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
#include "skin_engine/skin_engine.h"
|
2019-11-02 11:15:01 +00:00
|
|
|
#include "line.h"
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2009-08-17 22:41:22 +00:00
|
|
|
#define SCROLLBAR_WIDTH global_settings.scrollbar_width
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2006-11-06 10:11:51 +00:00
|
|
|
enum list_wrap {
|
|
|
|
LIST_WRAP_ON = 0,
|
|
|
|
LIST_WRAP_OFF,
|
|
|
|
LIST_WRAP_UNLESS_HELD,
|
|
|
|
};
|
|
|
|
|
2005-10-29 02:33:19 +00:00
|
|
|
/*
|
|
|
|
* The gui_list is based on callback functions, if you want the list
|
|
|
|
* to display something you have to provide it a function that
|
|
|
|
* tells it what to display.
|
2007-06-17 21:16:34 +00:00
|
|
|
* There are three callback function :
|
|
|
|
* one to get the text, one to get the icon and one to get the color
|
2005-11-16 02:12:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Icon callback
|
|
|
|
* - selected_item : an integer that tells the number of the item to display
|
2007-06-17 21:16:34 +00:00
|
|
|
* - data : a void pointer to the data you gave to the list when you
|
|
|
|
* initialized it
|
|
|
|
* Returns a pointer to the icon, the value inside it is used to display the
|
|
|
|
* icon after the function returns.
|
2005-11-16 02:12:25 +00:00
|
|
|
* Note : we use the ICON type because the real type depends of the plateform
|
|
|
|
*/
|
2007-04-16 09:14:36 +00:00
|
|
|
typedef enum themable_icons list_get_icon(int selected_item, void * data);
|
2005-11-16 02:12:25 +00:00
|
|
|
/*
|
2005-10-29 02:33:19 +00:00
|
|
|
* Text callback
|
|
|
|
* - selected_item : an integer that tells the number of the item to display
|
2007-06-17 21:16:34 +00:00
|
|
|
* - data : a void pointer to the data you gave to the list when you
|
|
|
|
* initialized it
|
2005-10-29 02:33:19 +00:00
|
|
|
* - buffer : a buffer to put the resulting text on it
|
|
|
|
* (The content of the buffer may not be used by the list, we use
|
|
|
|
* the return value of the function in all cases to avoid filling
|
|
|
|
* a buffer when it's not necessary)
|
2008-04-09 15:25:17 +00:00
|
|
|
* - buffer_len : length of the buffer
|
2005-10-29 02:33:19 +00:00
|
|
|
* Returns a pointer to a string that contains the text to display
|
|
|
|
*/
|
2009-08-20 16:47:44 +00:00
|
|
|
typedef const char * list_get_name(int selected_item, void * data,
|
|
|
|
char * buffer, size_t buffer_len);
|
2021-12-15 05:37:04 +00:00
|
|
|
/*
|
|
|
|
* Draw callback
|
|
|
|
* - display : functions supplied depends on the screen call originated from (typ: MAIN)
|
|
|
|
* - list_info : a pointer to an internal struct containing item display information
|
|
|
|
*/
|
|
|
|
/* owner drawn lists need to know this info */
|
|
|
|
struct list_putlineinfo_t {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int item_indent;
|
|
|
|
int item_offset;
|
|
|
|
int line;
|
|
|
|
|
|
|
|
int icon;
|
|
|
|
int icon_width;
|
|
|
|
|
|
|
|
struct screen *display;
|
|
|
|
struct viewport *vp;
|
|
|
|
struct line_desc *linedes;
|
|
|
|
struct gui_synclist * list;
|
|
|
|
char *dsp_text;
|
|
|
|
|
|
|
|
bool is_selected;
|
|
|
|
bool is_title;
|
|
|
|
bool show_cursor;
|
|
|
|
bool have_icons;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef void list_draw_item(struct list_putlineinfo_t *list_info);
|
2007-10-21 00:20:10 +00:00
|
|
|
/*
|
|
|
|
* Voice callback
|
|
|
|
* - selected_item : an integer that tells the number of the item to speak
|
|
|
|
* - data : a void pointer to the data you gave to the list when you
|
|
|
|
* initialized it
|
|
|
|
* Returns an integer, 0 means success, ignored really...
|
|
|
|
*/
|
|
|
|
typedef int list_speak_item(int selected_item, void * data);
|
2007-06-17 21:16:34 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
/*
|
|
|
|
* Color callback
|
|
|
|
* - selected_item : an integer that tells the number of the item to display
|
|
|
|
* - data : a void pointer to the data you gave to the list when you
|
|
|
|
* initialized it
|
|
|
|
* Returns an int with the lower 16 bits representing the color to display the
|
|
|
|
* selected item, negative value for default coloring.
|
|
|
|
*/
|
|
|
|
typedef int list_get_color(int selected_item, void * data);
|
2019-11-02 11:15:01 +00:00
|
|
|
|
|
|
|
struct list_selection_color
|
|
|
|
{
|
|
|
|
/* text color, in native lcd format
|
|
|
|
* (convert with LCD_RGBPACK() if necessary) */
|
|
|
|
unsigned text_color;
|
|
|
|
/* only STYLE_GRADIENT supported set line_color & line_end_color the same
|
|
|
|
* for solid color, in native
|
|
|
|
* lcd format (convert with LCD_RGBPACK() if necessary) */
|
|
|
|
unsigned line_color;
|
|
|
|
unsigned line_end_color;
|
|
|
|
/* viewport foreground and background, in native
|
|
|
|
* lcd format (convert with LCD_RGBPACK() if necessary) */
|
|
|
|
unsigned fg_color;
|
|
|
|
unsigned bg_color;
|
|
|
|
/* To enable:
|
|
|
|
* call gui_synclist_set_sel_color(gui_synclist*, list_selection_color*)
|
|
|
|
* If using the default viewport you should call
|
|
|
|
* gui_synclist_set_sel_color(gui_synclist*, NULL) when finished */
|
|
|
|
};
|
2007-06-17 21:16:34 +00:00
|
|
|
#endif
|
2005-11-16 02:12:25 +00:00
|
|
|
|
2007-12-17 02:37:21 +00:00
|
|
|
struct gui_synclist
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
2005-10-28 23:52:49 +00:00
|
|
|
/* defines wether the list should stop when reaching the top/bottom
|
|
|
|
* or should continue (by going to bottom/top) */
|
|
|
|
bool limit_scroll;
|
2006-07-02 12:28:27 +00:00
|
|
|
/* wether the text of the whole items of the list have to be
|
|
|
|
* scrolled or only for the selected item */
|
|
|
|
bool scroll_all;
|
2007-04-12 23:53:17 +00:00
|
|
|
int nb_items;
|
|
|
|
int selected_item;
|
2021-08-22 00:46:28 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
/* absolute Y coordinate, used for smooth scrolling */
|
|
|
|
int y_pos;
|
|
|
|
#endif
|
2007-12-17 02:37:21 +00:00
|
|
|
int start_item[NB_SCREENS]; /* the item that is displayed at the top of the screen */
|
2006-07-02 12:28:27 +00:00
|
|
|
/* the number of lines that are selected at the same time */
|
|
|
|
int selected_size;
|
2013-12-20 22:34:28 +00:00
|
|
|
/* the number of pixels each line occupies (including optional padding on touchscreen */
|
|
|
|
int line_height[NB_SCREENS];
|
2007-12-17 02:37:21 +00:00
|
|
|
int offset_position[NB_SCREENS]; /* the list's screen scroll placement in pixels */
|
2011-10-07 17:22:49 +00:00
|
|
|
long scheduled_talk_tick, last_talked_tick, dirty_tick;
|
2007-04-12 23:53:17 +00:00
|
|
|
|
|
|
|
list_get_icon *callback_get_item_icon;
|
|
|
|
list_get_name *callback_get_item_name;
|
2007-10-21 00:20:10 +00:00
|
|
|
list_speak_item *callback_speak_item;
|
2021-12-15 05:37:04 +00:00
|
|
|
list_draw_item *callback_draw_item;
|
2007-04-12 23:53:17 +00:00
|
|
|
|
|
|
|
/* The data that will be passed to the callback function YOU implement */
|
|
|
|
void * data;
|
|
|
|
/* The optional title, set to NULL for none */
|
2009-10-11 09:40:47 +00:00
|
|
|
char * title;
|
2006-08-23 20:02:06 +00:00
|
|
|
/* Optional title icon */
|
2007-04-16 09:14:36 +00:00
|
|
|
enum themable_icons title_icon;
|
2007-06-07 12:14:31 +00:00
|
|
|
bool show_selection_marker; /* set to true by default */
|
2007-06-17 21:16:34 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
int title_color;
|
|
|
|
list_get_color *callback_get_item_color;
|
2019-11-02 11:15:01 +00:00
|
|
|
struct list_selection_color *selection_color;
|
2007-06-17 21:16:34 +00:00
|
|
|
#endif
|
2008-03-05 09:58:30 +00:00
|
|
|
struct viewport *parent[NB_SCREENS];
|
2005-10-28 00:00:00 +00:00
|
|
|
};
|
|
|
|
|
2005-10-30 22:34:51 +00:00
|
|
|
|
2009-09-07 17:37:06 +00:00
|
|
|
extern void list_init(void);
|
2006-01-22 04:24:26 +00:00
|
|
|
/* parse global setting to static int */
|
|
|
|
extern void gui_list_screen_scroll_step(int ofs);
|
|
|
|
|
|
|
|
/* parse global setting to static bool */
|
|
|
|
extern void gui_list_screen_scroll_out_of_view(bool enable);
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2005-10-29 02:33:19 +00:00
|
|
|
extern void gui_synclist_init(
|
|
|
|
struct gui_synclist * lists,
|
2005-11-16 02:12:25 +00:00
|
|
|
list_get_name callback_get_item_name,
|
2006-07-02 12:28:27 +00:00
|
|
|
void * data,
|
|
|
|
bool scroll_all,
|
2008-03-26 03:35:24 +00:00
|
|
|
int selected_size,
|
|
|
|
struct viewport parent[NB_SCREENS] /* NOTE: new screens should NOT set this to NULL */
|
2005-10-29 02:33:19 +00:00
|
|
|
);
|
2005-10-28 00:00:00 +00:00
|
|
|
extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items);
|
2005-11-16 17:23:49 +00:00
|
|
|
extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback);
|
2007-10-21 00:20:10 +00:00
|
|
|
extern void gui_synclist_set_voice_callback(struct gui_synclist * lists, list_speak_item voice_callback);
|
2011-10-22 10:09:23 +00:00
|
|
|
extern void gui_synclist_set_viewport_defaults(struct viewport *vp, enum screen_type screen);
|
2008-03-05 09:58:30 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
extern void gui_synclist_set_color_callback(struct gui_synclist * lists, list_get_color color_callback);
|
2019-11-02 11:15:01 +00:00
|
|
|
extern void gui_synclist_set_sel_color(struct gui_synclist * lists, struct list_selection_color *list_sel_color);
|
2008-03-05 09:58:30 +00:00
|
|
|
#endif
|
2007-10-21 00:20:10 +00:00
|
|
|
extern void gui_synclist_speak_item(struct gui_synclist * lists);
|
2006-04-03 08:51:08 +00:00
|
|
|
extern int gui_synclist_get_nb_items(struct gui_synclist * lists);
|
2005-11-16 17:23:49 +00:00
|
|
|
|
2005-10-28 23:52:49 +00:00
|
|
|
extern int gui_synclist_get_sel_pos(struct gui_synclist * lists);
|
2005-10-29 02:33:19 +00:00
|
|
|
|
2005-10-28 00:00:00 +00:00
|
|
|
extern void gui_synclist_draw(struct gui_synclist * lists);
|
2010-02-11 10:41:06 +00:00
|
|
|
extern void gui_synclist_scroll_stop(struct gui_synclist *lists);
|
2005-10-28 00:00:00 +00:00
|
|
|
extern void gui_synclist_select_item(struct gui_synclist * lists,
|
|
|
|
int item_number);
|
|
|
|
extern void gui_synclist_add_item(struct gui_synclist * lists);
|
|
|
|
extern void gui_synclist_del_item(struct gui_synclist * lists);
|
2005-10-28 23:52:49 +00:00
|
|
|
extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
|
2009-10-11 09:40:47 +00:00
|
|
|
extern void gui_synclist_set_title(struct gui_synclist * lists, char * title,
|
2009-07-11 00:22:26 +00:00
|
|
|
enum themable_icons icon);
|
2007-06-07 12:14:31 +00:00
|
|
|
extern void gui_synclist_hide_selection_marker(struct gui_synclist *lists,
|
|
|
|
bool hide);
|
2019-02-09 00:59:57 +00:00
|
|
|
extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
|
|
|
|
enum screen_type screen, int item);
|
2012-01-12 11:28:36 +00:00
|
|
|
|
|
|
|
extern bool gui_synclist_keyclick_callback(int action, void* data);
|
2005-10-28 00:00:00 +00:00
|
|
|
/*
|
|
|
|
* Do the action implied by the given button,
|
2007-09-17 10:08:50 +00:00
|
|
|
* returns true if the action was handled.
|
|
|
|
* NOTE: *action may be changed regardless of return value
|
2005-10-28 00:00:00 +00:00
|
|
|
*/
|
2007-09-17 10:08:50 +00:00
|
|
|
extern bool gui_synclist_do_button(struct gui_synclist * lists,
|
2008-12-31 05:59:26 +00:00
|
|
|
int *action,
|
2006-11-06 10:11:51 +00:00
|
|
|
enum list_wrap);
|
2020-07-17 14:31:31 +00:00
|
|
|
#if !defined(PLUGIN)
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
struct listitem_viewport_cfg {
|
|
|
|
struct wps_data *data;
|
2012-02-21 13:33:42 +00:00
|
|
|
OFFSETTYPE(char *) label;
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int xmargin;
|
|
|
|
int ymargin;
|
|
|
|
bool tile;
|
|
|
|
struct skin_viewport selected_item_vp;
|
|
|
|
};
|
2012-06-13 21:07:49 +00:00
|
|
|
|
|
|
|
bool skinlist_get_item(struct screen *display, struct gui_synclist *list, int x, int y, int *item);
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
bool skinlist_draw(struct screen *display, struct gui_synclist *list);
|
|
|
|
bool skinlist_is_selected_item(void);
|
|
|
|
void skinlist_set_cfg(enum screen_type screen,
|
|
|
|
struct listitem_viewport_cfg *cfg);
|
2011-09-11 10:44:17 +00:00
|
|
|
const char* skinlist_get_item_text(int offset, bool wrap, char* buf, size_t buf_size);
|
2011-09-18 12:35:32 +00:00
|
|
|
int skinlist_get_item_number(void);
|
2012-02-25 01:34:23 +00:00
|
|
|
int skinlist_get_item_row(void);
|
|
|
|
int skinlist_get_item_column(void);
|
2011-09-11 10:44:17 +00:00
|
|
|
enum themable_icons skinlist_get_item_icon(int offset, bool wrap);
|
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though.
The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves).
Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern.
The UI viewport is used to bound the items (i.e %Vi() )
Scrolling is completly disabled in all items except the currently selected item.
This works well in combination with the %cs tag to show differently styled lists based on the current screen :)
New tags:
%LT - Get the current items text
%LI - Get the current items icon number
%Lc - Use as a conditional to determine if the current item is the selected item
%LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed
%Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list
example.sbs:
%?cs<%Lb(a,100,20)|>
%V(0,0,10,-,1)%Vf(aabbcc)
%?LB<%LB(0,0,10,185, invert)>
%Vi(-,10,0,-,-35,1)
%Vl(a,5,5,160,12,1)
%s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<>
%V(0,185,-,-,1)
%s%LT
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
2011-09-06 13:49:41 +00:00
|
|
|
bool skinlist_needs_scrollbar(enum screen_type screen);
|
|
|
|
void skinlist_get_scrollbar(int* nb_item, int* first_shown, int* last_shown);
|
|
|
|
int skinlist_get_line_count(enum screen_type screen, struct gui_synclist *list);
|
2020-07-17 14:31:31 +00:00
|
|
|
#endif /* !PLUGIN) */
|
2007-10-21 01:27:17 +00:00
|
|
|
|
2009-08-06 09:28:25 +00:00
|
|
|
#if defined(HAVE_TOUCHSCREEN)
|
|
|
|
/* this needs to be fixed if we ever get more than 1 touchscreen on a target */
|
2010-10-31 11:11:46 +00:00
|
|
|
extern unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list);
|
|
|
|
/* only for private use in gui/list.c */
|
2021-08-22 00:46:28 +00:00
|
|
|
extern void _gui_synclist_stop_kinetic_scrolling(struct gui_synclist * gui_list);
|
2009-08-06 09:28:25 +00:00
|
|
|
#endif
|
|
|
|
|
2007-10-21 01:27:17 +00:00
|
|
|
/* If the list has a pending postponed scheduled announcement, that
|
|
|
|
may become due before the next get_action tmieout. This function
|
|
|
|
adjusts the get_action timeout appropriately. */
|
|
|
|
extern int list_do_action_timeout(struct gui_synclist *lists, int timeout);
|
|
|
|
/* This one combines a get_action call (with timeout overridden by
|
|
|
|
list_do_action_timeout) with the gui_synclist_do_button call, for
|
|
|
|
convenience. */
|
|
|
|
extern bool list_do_action(int context, int timeout,
|
|
|
|
struct gui_synclist *lists, int *action,
|
|
|
|
enum list_wrap wrap);
|
|
|
|
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
/** Simplelist implementation.
|
|
|
|
USe this if you dont need to reimplement the list code,
|
|
|
|
and just need to show a list
|
|
|
|
**/
|
|
|
|
|
|
|
|
struct simplelist_info {
|
|
|
|
char *title; /* title to show on the list */
|
|
|
|
int count; /* number of items in the list, each item is selection_size high */
|
2010-01-05 21:15:20 +00:00
|
|
|
int selection_size; /* list selection size, usually 1 */
|
2007-10-20 12:32:55 +00:00
|
|
|
bool hide_selection;
|
|
|
|
bool scroll_all;
|
2019-11-02 11:15:01 +00:00
|
|
|
bool hide_theme;
|
|
|
|
bool speak_onshow; /* list speaks first item or 'empty list' */
|
2007-10-21 13:47:43 +00:00
|
|
|
int timeout;
|
2008-09-25 07:56:34 +00:00
|
|
|
int selection; /* the item to select when the list is first displayed */
|
|
|
|
/* when the list is exited, this will be set to the
|
2008-09-25 08:12:25 +00:00
|
|
|
index of the last item selected, or -1 if the list
|
|
|
|
was exited with ACTION_STD_CANCEL */
|
2007-10-20 12:32:55 +00:00
|
|
|
int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */
|
|
|
|
/* action_callback notes:
|
|
|
|
action == the action pressed by the user
|
|
|
|
_after_ gui_synclist_do_button returns.
|
2011-09-03 13:24:56 +00:00
|
|
|
lists == the lists struct so the callback can get selection and count etc. */
|
|
|
|
enum themable_icons title_icon;
|
2007-10-20 12:32:55 +00:00
|
|
|
list_get_icon *get_icon; /* can be NULL */
|
|
|
|
list_get_name *get_name; /* NULL if you're using simplelist_addline() */
|
2007-10-21 01:27:17 +00:00
|
|
|
list_speak_item *get_talk; /* can be NULL to not speak */
|
2011-09-03 13:24:56 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
list_get_color *get_color;
|
2019-11-02 11:15:01 +00:00
|
|
|
struct list_selection_color *selection_color;
|
2011-09-03 13:24:56 +00:00
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
void *callback_data; /* data for callbacks */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SIMPLELIST_MAX_LINES 32
|
2014-12-09 18:38:47 +00:00
|
|
|
#ifdef HAVE_ATA_SMART
|
|
|
|
#define SIMPLELIST_MAX_LINELENGTH 48
|
|
|
|
#else
|
2007-10-20 12:32:55 +00:00
|
|
|
#define SIMPLELIST_MAX_LINELENGTH 32
|
2014-12-09 18:38:47 +00:00
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
|
|
|
|
/** The next three functions are used if the text is mostly static.
|
|
|
|
These should be called in the action callback for the list.
|
|
|
|
**/
|
|
|
|
/* set the amount of lines shown in the list
|
|
|
|
Only needed if simplelist_info.get_name == NULL */
|
|
|
|
void simplelist_set_line_count(int lines);
|
|
|
|
/* get the current amount of lines shown */
|
|
|
|
int simplelist_get_line_count(void);
|
2013-02-12 09:35:11 +00:00
|
|
|
/* add a line in the list. */
|
|
|
|
void simplelist_addline(const char *fmt, ...);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
2007-10-21 01:27:17 +00:00
|
|
|
/* setup the info struct. members not setup in this function need to be assigned manually
|
|
|
|
members set in this function:
|
2007-10-21 06:42:52 +00:00
|
|
|
info.selection_size = 1;
|
2007-10-21 01:27:17 +00:00
|
|
|
info.hide_selection = false;
|
|
|
|
info.scroll_all = false;
|
2019-11-02 11:15:01 +00:00
|
|
|
info.hide_theme = false;
|
|
|
|
info.speak_onshow = true;
|
2007-10-21 01:27:17 +00:00
|
|
|
info.action_callback = NULL;
|
2011-09-03 13:24:56 +00:00
|
|
|
info.title_icon = Icon_NOICON;
|
2007-10-21 01:27:17 +00:00
|
|
|
info.get_icon = NULL;
|
|
|
|
info.get_name = NULL;
|
|
|
|
info.get_voice = NULL;
|
2011-09-03 13:24:56 +00:00
|
|
|
info.get_color = NULL;
|
2019-11-02 11:15:01 +00:00
|
|
|
info.list_selection_color = NULL;
|
2007-10-21 13:47:43 +00:00
|
|
|
info.timeout = HZ/10;
|
2008-09-25 07:56:34 +00:00
|
|
|
info.selection = 0;
|
2007-10-21 01:27:17 +00:00
|
|
|
*/
|
|
|
|
void simplelist_info_init(struct simplelist_info *info, char* title,
|
2007-10-21 06:42:52 +00:00
|
|
|
int count, void* data);
|
2010-02-16 11:59:37 +00:00
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
/* show a list.
|
|
|
|
if list->action_callback != NULL it is called with the action ACTION_REDRAW
|
|
|
|
before the list is dislplayed for the first time */
|
|
|
|
bool simplelist_show_list(struct simplelist_info *info);
|
2005-10-28 00:00:00 +00:00
|
|
|
|
|
|
|
#endif /* _GUI_LIST_H_ */
|