summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-04-28 22:20:27 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-04-28 22:20:27 +0000
commitbd3d297b3186185d43dff5924f80545f736db446 (patch)
tree0c34dc230305b5af5329cf0e6ac8f56a04eb6f6e /apps
parentfc2fc47d016e3042a19c6dda5d79a6bf0c445f87 (diff)
downloadrockbox-bd3d297b3186185d43dff5924f80545f736db446.zip
rockbox-bd3d297b3186185d43dff5924f80545f736db446.tar.gz
rockbox-bd3d297b3186185d43dff5924f80545f736db446.tar.bz2
rockbox-bd3d297b3186185d43dff5924f80545f736db446.tar.xz
A checkbox widget
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4559 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h5
-rw-r--r--apps/recorder/widgets.c25
-rw-r--r--apps/recorder/widgets.h1
4 files changed, 33 insertions, 1 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index cdb787a..3258dad 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -185,6 +185,9 @@ static struct plugin_api rockbox_api = {
#ifndef SIMULATOR
ata_sleep,
#endif
+#ifdef HAVE_LCD_BITMAP
+ checkbox,
+#endif
};
int plugin_load(char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index e017247..720e4b2 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -50,7 +50,7 @@
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
-#define PLUGIN_MIN_API_VERSION 9
+#define PLUGIN_MIN_API_VERSION 10
/* plugin return codes */
enum plugin_status {
@@ -207,6 +207,9 @@ struct plugin_api {
#ifndef SIMULATOR
int (*ata_sleep)(void);
#endif
+#ifdef HAVE_LCD_BITMAP
+ void (*checkbox)(int x, int y, int width, int height, bool checked);
+#endif
};
/* defined by the plugin loader (plugin.c) */
diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c
index 9925749..4008d2b 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 18f59a8..de8e785 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__ */