From bd3d297b3186185d43dff5924f80545f736db446 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 28 Apr 2004 22:20:27 +0000 Subject: A checkbox widget git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4559 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/widgets.c | 25 +++++++++++++++++++++++++ apps/recorder/widgets.h | 1 + 2 files changed, 26 insertions(+) (limited to 'apps/recorder') diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c index 99257495cf..4008d2b4c2 100644 --- a/apps/recorder/widgets.c +++ b/apps/recorder/widgets.c @@ -210,4 +210,29 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown, } } } + +/* + * Print a checkbox + */ +void checkbox(int x, int y, int width, int height, bool checked) +{ + /* check position and dimensions */ + if((x < 0) || (x + width > LCD_WIDTH) || + (y < 0) || (y + height > LCD_HEIGHT) || + (width < 4 ) || (height < 4 )) + { + return; + } + + lcd_drawrect(x, y, width, height); + + if (checked){ + lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1); + lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2); + } else { + /* be sure to clear box */ + lcd_clearrect(x + 1, y + 1, width - 2, height - 2); + } +} + #endif diff --git a/apps/recorder/widgets.h b/apps/recorder/widgets.h index 18f59a8893..de8e78520f 100644 --- a/apps/recorder/widgets.h +++ b/apps/recorder/widgets.h @@ -38,5 +38,6 @@ enum { extern void progressbar(int x, int y, int width, int height, int percent, int direction); extern void slidebar(int x, int y, int width, int height, int percent, int direction); extern void scrollbar(int x, int y, int width, int height, int items, int min_shown, int max_shown, int orientation); +extern void checkbox(int x, int y, int width, int height, bool checked); #endif /* HAVE_LCD_BITMAP */ #endif /* __WIDGETS_H__ */ -- cgit v1.2.3