forked from len0rd/rockbox
skin_engine: New param "noborder" for the bar tags.
By specifying this param the bar will not have a border/box. Instead the inner part that fills up is maximized on the bar area. Note that this only affects bars using foreground and background colors, not those constructed with images. Change-Id: Ib8dd49ecbaf9e16b96de840f5f365871b73d4fa4
This commit is contained in:
parent
6e882b43b6
commit
3ae73433ab
5 changed files with 38 additions and 12 deletions
|
@ -94,11 +94,20 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
|
||||||
max_shown = items;
|
max_shown = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
inner_x = x + 1;
|
if (flags & BORDER_NOFILL)
|
||||||
inner_y = y + 1;
|
{
|
||||||
inner_wd = width - 2;
|
inner_x = x;
|
||||||
inner_ht = height - 2;
|
inner_y = y;
|
||||||
|
inner_wd = width;
|
||||||
|
inner_ht = height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inner_x = x + 1;
|
||||||
|
inner_y = y + 1;
|
||||||
|
inner_wd = width - 2;
|
||||||
|
inner_ht = height - 2;
|
||||||
|
}
|
||||||
/* Boundary check to make sure that height is reasonable, otherwise nothing
|
/* Boundary check to make sure that height is reasonable, otherwise nothing
|
||||||
* to do
|
* to do
|
||||||
*/
|
*/
|
||||||
|
@ -113,16 +122,18 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
|
||||||
scrollbar_helper(min_shown, max_shown, items, inner_len, &size, &start);
|
scrollbar_helper(min_shown, max_shown, items, inner_len, &size, &start);
|
||||||
|
|
||||||
/* draw box */
|
/* draw box */
|
||||||
|
if (!(flags & BORDER_NOFILL))
|
||||||
|
{
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
/* must avoid corners if case of (flags & FOREGROUND) */
|
/* must avoid corners if case of (flags & FOREGROUND) */
|
||||||
screen->hline(inner_x, x + inner_wd, y);
|
screen->hline(inner_x, x + inner_wd, y);
|
||||||
screen->hline(inner_x, x + inner_wd, y + height - 1);
|
screen->hline(inner_x, x + inner_wd, y + height - 1);
|
||||||
screen->vline(x, inner_y, y + inner_ht);
|
screen->vline(x, inner_y, y + inner_ht);
|
||||||
screen->vline(x + width - 1, inner_y, y + inner_ht);
|
screen->vline(x + width - 1, inner_y, y + inner_ht);
|
||||||
#else
|
#else
|
||||||
screen->drawrect(x, y, width, height);
|
screen->drawrect(x, y, width, height);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
|
screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum orientation {
|
||||||
HORIZONTAL = 0x0001, /* Horizontal orientation */
|
HORIZONTAL = 0x0001, /* Horizontal orientation */
|
||||||
INVERTFILL = 0x0002, /* Invert the fill direction */
|
INVERTFILL = 0x0002, /* Invert the fill direction */
|
||||||
INNER_NOFILL = 0x0004, /* Do not fill inner part */
|
INNER_NOFILL = 0x0004, /* Do not fill inner part */
|
||||||
|
BORDER_NOFILL = 0x0008, /* Do not fill border part */
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
FOREGROUND = 0x0020, /* Do not clear background pixels */
|
FOREGROUND = 0x0020, /* Do not clear background pixels */
|
||||||
INNER_FILL = 0x0040, /* Fill inner part even if FOREGROUND */
|
INNER_FILL = 0x0040, /* Fill inner part even if FOREGROUND */
|
||||||
|
|
|
@ -202,6 +202,11 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
|
||||||
flags |= INNER_NOFILL;
|
flags |= INNER_NOFILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pb->noborder)
|
||||||
|
{
|
||||||
|
flags |= BORDER_NOFILL;
|
||||||
|
}
|
||||||
|
|
||||||
if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider))
|
if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider))
|
||||||
{
|
{
|
||||||
struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider);
|
struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider);
|
||||||
|
|
|
@ -901,6 +901,7 @@ static int parse_progressbar_tag(struct skin_element* element,
|
||||||
pb->vp = PTRTOSKINOFFSET(skin_buffer, vp);
|
pb->vp = PTRTOSKINOFFSET(skin_buffer, vp);
|
||||||
pb->follow_lang_direction = follow_lang_direction > 0;
|
pb->follow_lang_direction = follow_lang_direction > 0;
|
||||||
pb->nofill = false;
|
pb->nofill = false;
|
||||||
|
pb->noborder = false;
|
||||||
pb->nobar = false;
|
pb->nobar = false;
|
||||||
pb->image = PTRTOSKINOFFSET(skin_buffer, NULL);
|
pb->image = PTRTOSKINOFFSET(skin_buffer, NULL);
|
||||||
pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL);
|
pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL);
|
||||||
|
@ -978,6 +979,8 @@ static int parse_progressbar_tag(struct skin_element* element,
|
||||||
pb->invert_fill_direction = true;
|
pb->invert_fill_direction = true;
|
||||||
else if (!strcmp(text, "nofill"))
|
else if (!strcmp(text, "nofill"))
|
||||||
pb->nofill = true;
|
pb->nofill = true;
|
||||||
|
else if (!strcmp(text, "noborder"))
|
||||||
|
pb->noborder = true;
|
||||||
else if (!strcmp(text, "nobar"))
|
else if (!strcmp(text, "nobar"))
|
||||||
pb->nobar = true;
|
pb->nobar = true;
|
||||||
else if (!strcmp(text, "slider"))
|
else if (!strcmp(text, "slider"))
|
||||||
|
@ -1051,6 +1054,11 @@ static int parse_progressbar_tag(struct skin_element* element,
|
||||||
|
|
||||||
if (image_filename)
|
if (image_filename)
|
||||||
{
|
{
|
||||||
|
/* noborder is incompatible together with image. There is no border
|
||||||
|
* anyway. */
|
||||||
|
if (pb->noborder)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
pb->image = PTRTOSKINOFFSET(skin_buffer,
|
pb->image = PTRTOSKINOFFSET(skin_buffer,
|
||||||
skin_find_item(image_filename, SKIN_FIND_IMAGE, wps_data));
|
skin_find_item(image_filename, SKIN_FIND_IMAGE, wps_data));
|
||||||
if (!SKINOFFSETTOPTR(skin_buffer, pb->image)) /* load later */
|
if (!SKINOFFSETTOPTR(skin_buffer, pb->image)) /* load later */
|
||||||
|
|
|
@ -120,6 +120,7 @@ struct progressbar {
|
||||||
|
|
||||||
bool invert_fill_direction;
|
bool invert_fill_direction;
|
||||||
bool nofill;
|
bool nofill;
|
||||||
|
bool noborder;
|
||||||
bool nobar;
|
bool nobar;
|
||||||
OFFSETTYPE(struct gui_img *) slider;
|
OFFSETTYPE(struct gui_img *) slider;
|
||||||
bool horizontal;
|
bool horizontal;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue