- win[WINDOW_TILEBORDER] = border = newwin(h, w, 0, 0);
- win[WINDOW_TILEFILL] = derwin(border, h-2, w-2, 1, 1);
-}
-
-/*
- * Given the toolbar function number (between 1 and 10, inclusive), and the
- * total width of the screen, return the character position for the start of
- * its label display.
- *
- * The intention is to divide the width of the screen into 10 roughly
- * equally-sized areas, spreading out the remainder so that the width of
- * each label is a monotone increasing function of the total width.
- *
- * The minimum size of a label is 6 characters (2 of which are used for the
- * number indicator)
- */
-static int toolbar_xpos(int i, int total_width)
-{
- int button_width = MAX(6, total_width/10);
- int rem = total_width - 10*button_width;
- int pos = (i-1)*button_width;
-
- switch (rem) {
- case 9: pos += i > 6;
- case 8: pos += i > 2;
- case 7: pos += i > 7;
- case 6: pos += i > 3;
- case 5: pos += i > 8;
- case 4: pos += i > 4;
- case 3: pos += i > 9;
- case 2: pos += i > 5;
- }
-
- return pos;
-}
-
-static void draw_toolbar(struct app_state *state)
-{
- WINDOW *toolbar = state->toolbar;
- int i, w, lw;
-
- getmaxyx(toolbar, i, w);
- werase(toolbar);
-
- lw = MAX(6, w/10);
- mvwprintw(toolbar, 0, toolbar_xpos( 1, w)+2, "%.*s", lw, "Help");
- mvwprintw(toolbar, 0, toolbar_xpos( 2, w)+2, "%.*s", lw, "NewGame");
- mvwprintw(toolbar, 0, toolbar_xpos(10, w)+2, "%.*s", lw, "Exit");
-
- mvwchgat(toolbar, 0, 0, -1, A_REVERSE, RR_COLOUR_TOOLBAR, 0);
- for (i = 1; i <= 10; i++)
- mvwprintw(toolbar, 0, toolbar_xpos(i, w), "%2d", i);
-
- wnoutrefresh(state->toolbar);