diff options
Diffstat (limited to 'apps/status.c')
-rw-r--r-- | apps/status.c | 45 |
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 | ||
232 | static 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 | |||
254 | static char stored_caption1[8]; | ||
255 | static char stored_caption2[8]; | ||
256 | static char stored_caption3[8]; | ||
257 | |||
258 | void 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 | |||
268 | void 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 | ||