Commit a591b26d authored by Projects's avatar Projects

menu & status_bar: Added a few defines for dimensions.

parent 2e5d111a
......@@ -32,10 +32,11 @@ static int selected_item = 0;
static int offset = 0;
static int menu_size = 0;
#define LINE_HEIGHT 17
#define LEFT_MARGIN 17
#define MENU_SCREEN_HEIGHT 107
#define MAX_ENTRIES (MENU_SCREEN_HEIGHT / LINE_HEIGHT)
#define LINE_HEIGHT 17
#define LEFT_MARGIN 17
#define MENU_SCREEN_HEIGHT 107
#define MENU_SCREEN_WIDTH 127
#define MAX_ENTRIES (MENU_SCREEN_HEIGHT / LINE_HEIGHT)
// store menu states to navigate between menus
static menu_list *menu_stack[8] = { &main_menu, NULL, };
......@@ -54,7 +55,7 @@ static void menu_screen_redraw(struct ui_widget *w)
// draw a white background for the selected entry
if(pos == selected_item) {
gfx_box(&w->dc, LEFT_MARGIN, i * LINE_HEIGHT,
127, (i + 1) * LINE_HEIGHT, 1);
MENU_SCREEN_WIDTH, (i + 1) * LINE_HEIGHT, 1);
}
menu_entry *ent = &(*current_menu)->entries[pos];
......@@ -107,7 +108,8 @@ static void menu_screen_event(struct ui_widget *w, const struct event *evt)
struct ui_widget menu_screen = {
menu_screen_redraw,
menu_screen_event,
{ 0, 20, 127, 20 + MENU_SCREEN_HEIGHT },
{ 0, STATUS_BAR_HEIGHT,
MENU_SCREEN_WIDTH, STATUS_BAR_HEIGHT + MENU_SCREEN_HEIGHT },
0,
WF_ACTIVE | WF_VISIBLE
};
......
......@@ -34,7 +34,7 @@ static void status_bar_event(struct ui_widget *w, const struct event *evt)
static void status_bar_redraw(struct ui_widget *w)
{
gfx_round_box(&w->dc, 30, -10, 127-30, 10, 9, COLOR_BLACK);
gfx_round_box(&w->dc, 30, -10, 127 - 30, 10, 9, COLOR_BLACK);
gfx_centered_text(&w->dc, &font_helv11, 0, "Home", 1);
}
......
......@@ -27,5 +27,8 @@
#include <gfx/ui.h>
///> Height of the status bar
#define STATUS_BAR_HEIGHT 20
struct ui_widget status_bar;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment