diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-15 14:13:36 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-08-15 14:13:36 +0000 |
commit | eda80390d5afc4346d2e64a256762df7df30bb17 (patch) | |
tree | b3f9fd726fdb1172b9f048cedb4bbb6808c03aa7 /apps/gui/scrollbar.c | |
parent | ac2c69ccae5db7d5e22acf976910cdf3be84fe5a (diff) | |
download | rockbox-eda80390d5afc4346d2e64a256762df7df30bb17.tar.gz rockbox-eda80390d5afc4346d2e64a256762df7df30bb17.zip |
A bunch of new features for the bar type tags (%pb, %pv, %bl, etc):
* the bar orientation (horiz/vert) is now chosen based on the width and heigt values (or can be forced).
* the fill direction can now be inverted (fill right to left, or top to bottom is considered inverted)
* It can now draw a slider type bar instead of a fill type (or indeed a slider with a fill type)
To configure the new bar, any (or all) of the following params can be used after the bmp filename (order makes no difference either):
invert - cause the bar to fill in the inverted direction
vertical - draw a vertical bar (not needed if the height > width)
horizontal - draw a horizontal bar (this is obviously the default)
nofill - dont draw the filling bar (this still draws the outline, obviously pointless without the slider param)
slider - draw an image for the slider. The next param MUST be the label of the image to draw. No option to use a subimage here, so the whole image needs to be the image you want on the slider.
example: %pb(0,0,-,-,-,nofill, slider, slider_image, invert) - draw a boring horizontal progressbar which doesnt fill and only draws the image "slider_image" which moves right to left.
the slider type might need some tweaking. let us know how it goes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27821 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/scrollbar.c')
-rw-r--r-- | apps/gui/scrollbar.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c index 317c55cdc7..8f431a4ff8 100644 --- a/apps/gui/scrollbar.c +++ b/apps/gui/scrollbar.c | |||
@@ -88,6 +88,12 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y, | |||
88 | int infill; | 88 | int infill; |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | if (flags & INVERTFILL) | ||
92 | { | ||
93 | min_shown = items - max_shown; | ||
94 | max_shown = items; | ||
95 | } | ||
96 | |||
91 | inner_x = x + 1; | 97 | inner_x = x + 1; |
92 | inner_y = y + 1; | 98 | inner_y = y + 1; |
93 | inner_wd = width - 2; | 99 | inner_wd = width - 2; |
@@ -178,11 +184,18 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x, | |||
178 | int start; | 184 | int start; |
179 | int size; | 185 | int size; |
180 | int inner_len; | 186 | int inner_len; |
187 | int startx = 0, starty = 0; | ||
181 | 188 | ||
182 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 189 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
183 | 190 | ||
184 | /* clear pixels in progress bar */ | 191 | /* clear pixels in progress bar */ |
185 | screen->fillrect(x, y, width, height); | 192 | screen->fillrect(x, y, width, height); |
193 | |||
194 | if (flags & INVERTFILL) | ||
195 | { | ||
196 | min_shown = items - max_shown; | ||
197 | max_shown = items; | ||
198 | } | ||
186 | 199 | ||
187 | if (flags & HORIZONTAL) | 200 | if (flags & HORIZONTAL) |
188 | inner_len = width; | 201 | inner_len = width; |
@@ -196,19 +209,23 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x, | |||
196 | if (flags & HORIZONTAL) { | 209 | if (flags & HORIZONTAL) { |
197 | x += start; | 210 | x += start; |
198 | width = size; | 211 | width = size; |
212 | if (flags & INVERTFILL) | ||
213 | startx = start; | ||
199 | } else { | 214 | } else { |
200 | y += start; | 215 | y += start; |
201 | height = size; | 216 | height = size; |
217 | if (flags & INVERTFILL) | ||
218 | starty = start; | ||
202 | } | 219 | } |
203 | 220 | ||
204 | #if LCD_DEPTH > 1 | 221 | #if LCD_DEPTH > 1 |
205 | if (bm->format == FORMAT_MONO) | 222 | if (bm->format == FORMAT_MONO) |
206 | #endif | 223 | #endif |
207 | screen->mono_bitmap_part(bm->data, 0, 0, | 224 | screen->mono_bitmap_part(bm->data, startx, starty, |
208 | bm->width, x, y, width, height); | 225 | bm->width, x, y, width, height); |
209 | #if LCD_DEPTH > 1 | 226 | #if LCD_DEPTH > 1 |
210 | else | 227 | else |
211 | screen->transparent_bitmap_part((fb_data *)bm->data, 0, 0, | 228 | screen->transparent_bitmap_part((fb_data *)bm->data, startx, starty, |
212 | STRIDE(screen->screen_type, | 229 | STRIDE(screen->screen_type, |
213 | bm->width, bm->height), | 230 | bm->width, bm->height), |
214 | x, y, width, height); | 231 | x, y, width, height); |