1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Markus Braun
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
24 #ifdef HAVE_LCD_BITMAP
29 void scrollbar(int x
, int y
, int width
, int height
, int items
, int min_shown
,
30 int max_shown
, int orientation
)
39 lcd_drawrect(x
, y
, width
, height
);
41 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
43 /* clear edge pixels */
45 lcd_drawpixel((x
+ width
- 1), y
);
46 lcd_drawpixel(x
, (y
+ height
- 1));
47 lcd_drawpixel((x
+ width
- 1), (y
+ height
- 1));
49 /* clear pixels in progress bar */
50 lcd_fillrect(x
+ 1, y
+ 1, width
- 2, height
- 2);
52 /* min should be min */
53 if(min_shown
< max_shown
) {
62 /* limit min and max */
73 if (orientation
== VERTICAL
)
74 inner_len
= height
- 2;
76 inner_len
= width
- 2;
79 while (items
> (INT_MAX
/ inner_len
)) {
85 /* calc start and end of the knob */
86 if (items
> 0 && items
> (max
- min
)) {
87 size
= inner_len
* (max
- min
) / items
;
88 if (size
== 0) { /* width of knob is null */
90 start
= (inner_len
- 1) * min
/ items
;
92 start
= (inner_len
- size
) * min
/ (items
- (max
- min
));
94 } else { /* if null draw full bar */
99 lcd_set_drawmode(DRMODE_SOLID
);
101 if(orientation
== VERTICAL
)
102 lcd_fillrect(x
+ 1, y
+ start
+ 1, width
- 2, size
);
104 lcd_fillrect(x
+ start
+ 1, y
+ 1, size
, height
- 2);
110 void checkbox(int x
, int y
, int width
, int height
, bool checked
)
113 lcd_drawrect(x
, y
, width
, height
);
115 /* clear inner area */
116 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
117 lcd_fillrect(x
+ 1, y
+ 1, width
- 2, height
- 2);
118 lcd_set_drawmode(DRMODE_SOLID
);
121 lcd_drawline(x
+ 2, y
+ 2, x
+ width
- 2 - 1 , y
+ height
- 2 - 1);
122 lcd_drawline(x
+ 2, y
+ height
- 2 - 1, x
+ width
- 2 - 1, y
+ 2);