summaryrefslogtreecommitdiffstats
path: root/apps
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
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')
-rw-r--r--apps/recorder/keyboard.c11
-rw-r--r--apps/status.c45
-rw-r--r--apps/status.h2
3 files changed, 52 insertions, 6 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 9edf24694d..95b2cb3386 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -55,7 +55,7 @@ static void kbd_setupkeys(char* line[KEYBOARD_LINES], int page)
break;
}
}
-
+#if 0
static void kbd_draw_statusbar_button(int num, char* caption, int y, int fw)
{
int x, x2, tw, cx;
@@ -67,7 +67,7 @@ static void kbd_draw_statusbar_button(int num, char* caption, int y, int fw)
lcd_putsxy((x + (cx/2)) - (tw/2), y, caption);
lcd_invertrect(x, y - 1, (x2-x)-1, LCD_HEIGHT-y+1);
}
-
+#endif
int kbd_input(char* text, int buflen)
{
bool done = false;
@@ -168,10 +168,9 @@ int kbd_input(char* text, int buflen)
lcd_drawline(curpos, main_y, curpos, main_y + font_h);
/* draw the status bar */
- kbd_draw_statusbar_button(0, "Shift", status_y1, font_w);
- kbd_draw_statusbar_button(1, "OK", status_y1, font_w);
- kbd_draw_statusbar_button(2, "Del", status_y1, font_w);
-
+ set_buttonbar("Shift", "OK", "Del");
+ draw_buttonbar();
+
/* highlight the key that has focus */
lcd_invertrect(font_w * x, font_h * y, font_w, font_h);
lcd_update();
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 @@
#endif
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
+#include "font.h"
#endif
#include "powermgmt.h"
@@ -227,3 +228,47 @@ void status_draw(bool force_redraw)
}
+#ifdef HAVE_LCD_BITMAP
+static void draw_buttonbar_btn(int num, char* caption)
+{
+ int xpos, ypos, button_width, text_width;
+ int fw, fh;
+
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_getstringsize("M", &fw, &fh);
+
+ button_width = LCD_WIDTH/3;
+ xpos = num * button_width;
+ ypos = LCD_HEIGHT - fh;
+
+ if(caption)
+ {
+ /* center the text */
+ text_width = fw * strlen(caption);
+ lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption);
+ }
+
+ lcd_invertrect(xpos, ypos, button_width - 1, fh);
+}
+
+static char stored_caption1[8];
+static char stored_caption2[8];
+static char stored_caption3[8];
+
+void set_buttonbar(char* caption1, char *caption2, char *caption3)
+{
+ strncpy(stored_caption1, caption1, 7);
+ stored_caption1[7] = 0;
+ strncpy(stored_caption2, caption2, 7);
+ stored_caption2[7] = 0;
+ strncpy(stored_caption3, caption3, 7);
+ stored_caption3[7] = 0;
+}
+
+void draw_buttonbar(void)
+{
+ draw_buttonbar_btn(0, stored_caption1);
+ draw_buttonbar_btn(1, stored_caption2);
+ draw_buttonbar_btn(2, stored_caption3);
+}
+#endif
diff --git a/apps/status.h b/apps/status.h
index 203c7a80d7..1331351523 100644
--- a/apps/status.h
+++ b/apps/status.h
@@ -34,6 +34,8 @@ void status_init(void);
void status_set_playmode(enum playmode mode);
#ifdef HAVE_LCD_BITMAP
bool statusbar(bool state);
+void set_buttonbar(char* caption1, char* caption2, char* caption3);
+void draw_buttonbar(void);
#endif
void status_draw(bool force_redraw);