summaryrefslogtreecommitdiff
path: root/apps/status.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-11-04 13:17:29 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-11-04 13:17:29 +0000
commit1e781eab6c7177df33e016d01dbd78ae25b36e2f (patch)
tree9a230531ebb5e79f09d8ab82909f30b060c6fb13 /apps/status.c
parent6afd0a7a083fa470c62cc2189f30ae4c63c534f7 (diff)
downloadrockbox-1e781eab6c7177df33e016d01dbd78ae25b36e2f.tar.gz
rockbox-1e781eab6c7177df33e016d01dbd78ae25b36e2f.zip
Generic F-key buttonbar functionality
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4013 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/status.c')
-rw-r--r--apps/status.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/apps/status.c b/apps/status.c
index f0445c3901..a1e01106bc 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -31,6 +31,7 @@
31#endif 31#endif
32#ifdef HAVE_LCD_BITMAP 32#ifdef HAVE_LCD_BITMAP
33#include "icons.h" 33#include "icons.h"
34#include "font.h"
34#endif 35#endif
35#include "powermgmt.h" 36#include "powermgmt.h"
36 37
@@ -227,3 +228,47 @@ void status_draw(bool force_redraw)
227 228
228} 229}
229 230
231#ifdef HAVE_LCD_BITMAP
232static void draw_buttonbar_btn(int num, char* caption)
233{
234 int xpos, ypos, button_width, text_width;
235 int fw, fh;
236
237 lcd_setfont(FONT_SYSFIXED);
238 lcd_getstringsize("M", &fw, &fh);
239
240 button_width = LCD_WIDTH/3;
241 xpos = num * button_width;
242 ypos = LCD_HEIGHT - fh;
243
244 if(caption)
245 {
246 /* center the text */
247 text_width = fw * strlen(caption);
248 lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption);
249 }
250
251 lcd_invertrect(xpos, ypos, button_width - 1, fh);
252}
253
254static char stored_caption1[8];
255static char stored_caption2[8];
256static char stored_caption3[8];
257
258void set_buttonbar(char* caption1, char *caption2, char *caption3)
259{
260 strncpy(stored_caption1, caption1, 7);
261 stored_caption1[7] = 0;
262 strncpy(stored_caption2, caption2, 7);
263 stored_caption2[7] = 0;
264 strncpy(stored_caption3, caption3, 7);
265 stored_caption3[7] = 0;
266}
267
268void draw_buttonbar(void)
269{
270 draw_buttonbar_btn(0, stored_caption1);
271 draw_buttonbar_btn(1, stored_caption2);
272 draw_buttonbar_btn(2, stored_caption3);
273}
274#endif