summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-03-26 03:35:24 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-03-26 03:35:24 +0000
commit5ca15399690a686646d4739b3f4c51c62cc88b68 (patch)
tree1c12dc34bae30aedcb38bf5ceed8a2fcedc250c8 /apps/gui
parentaf395f4db6ad7b83f9d9afefb1c0ceeedd140a45 (diff)
downloadrockbox-5ca15399690a686646d4739b3f4c51c62cc88b68.zip
rockbox-5ca15399690a686646d4739b3f4c51c62cc88b68.tar.gz
rockbox-5ca15399690a686646d4739b3f4c51c62cc88b68.tar.bz2
rockbox-5ca15399690a686646d4739b3f4c51c62cc88b68.tar.xz
the menu and list now accepts a parent viewport to draw in (and the menu can be told to not show status/button bars). This lays the groundwork to fix colour problems with plugin menus (see star.c for an example.) This hopefully fixes some button bar issues as well as theme problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16812 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/list.c19
-rw-r--r--apps/gui/list.h3
-rw-r--r--apps/gui/option_select.c3
-rw-r--r--apps/gui/viewport.c8
-rw-r--r--apps/gui/viewport.h3
5 files changed, 23 insertions, 13 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 86de0ae..1f0f0ff 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -107,12 +107,14 @@ bool list_display_title(struct gui_synclist *list, struct viewport *vp)
* - data : extra data passed to the list callback
* - scroll_all :
* - selected_size :
+ * - parent : the parent viewports to use. NULL means the full screen minus
+ * statusbar if enabled. NOTE: new screens should NOT set this to NULL.
*/
void gui_synclist_init(struct gui_synclist * gui_list,
list_get_name callback_get_item_name,
void * data,
bool scroll_all,
- int selected_size
+ int selected_size, struct viewport list_parent[NB_SCREENS]
)
{
int i;
@@ -128,7 +130,18 @@ void gui_synclist_init(struct gui_synclist * gui_list,
#ifdef HAVE_LCD_BITMAP
gui_list->offset_position[i] = 0;
#endif
- gui_list->parent[i] = &parent[i];
+ if (list_parent)
+ gui_list->parent[i] = &list_parent[i];
+ else
+ {
+ gui_list->parent[i] = &parent[i];
+ gui_list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
+ gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y;
+#ifdef HAS_BUTTONBAR
+ if (screens[i].has_buttonbar)
+ gui_list->parent[i]->height -= BUTTONBAR_HEIGHT;
+#endif
+ }
}
gui_list->limit_scroll = false;
gui_list->data=data;
@@ -811,7 +824,7 @@ bool simplelist_show_list(struct simplelist_info *info)
else
getname = simplelist_static_getname;
gui_synclist_init(&lists, getname, info->callback_data,
- info->scroll_all, info->selection_size);
+ info->scroll_all, info->selection_size, NULL);
if (info->title)
gui_synclist_set_title(&lists, info->title, NOICON);
if (info->get_icon)
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 48dd736..12f8817 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -142,7 +142,8 @@ extern void gui_synclist_init(
list_get_name callback_get_item_name,
void * data,
bool scroll_all,
- int selected_size
+ int selected_size,
+ struct viewport parent[NB_SCREENS] /* NOTE: new screens should NOT set this to NULL */
);
extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items);
extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback);
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index d9c594b..412a82d 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -373,7 +373,7 @@ bool option_screen(struct settings_list *setting,
}
else return false; /* only int/bools can go here */
gui_synclist_init(&lists, value_setting_get_name_cb,
- (void*)setting, false, 1);
+ (void*)setting, false, 1, NULL);
if (setting->lang_id == -1)
title = (char*)setting->cfg_vals;
else
@@ -460,6 +460,7 @@ bool option_screen(struct settings_list *setting,
gui_synclist_draw(&lists);
/* talk the item */
gui_synclist_speak_item(&lists);
+ gui_syncstatusbar_draw(&statusbars, false);
while (!done)
{
if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK,
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 8f26451..8a2e6bb 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -45,15 +45,13 @@ int viewport_get_nb_lines(struct viewport *vp)
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{
+ vp->xmargin = 0;
+ vp->ymargin = 0;
vp->x = 0;
vp->width = screens[screen].width;
vp->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
- vp->height = screens[screen].height - vp->y
-#ifdef HAS_BUTTONBAR
- - (screens[screen].has_buttonbar?BUTTONBAR_HEIGHT:0)
-#endif
- ;
+ vp->height = screens[screen].height - vp->y;
#ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID;
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 93059a4..1917b7b 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -21,9 +21,6 @@
#include "config.h"
#include "lcd.h"
#include "font.h"
-#include "sprintf.h"
-#include "string.h"
-#include "settings.h"
#include "kernel.h"
#include "system.h"
#include "misc.h"