static void draw (uih_context * c, void *data) { int x, y, w; int n = (int) data; if (c->messg.message[n] != NULL) { int h = xtextheight (c->font); y = c->messg.messagestart + h * n; w = xtextwidth (c->font, c->messg.message[n]); x = (c->image->width - w) / 2; if (c->messg.messagetype[n]) xprint (c->image, c->font, x, y, c->messg.message[n], (c->image->flags & AAIMAGE) ? BGCOLOR (c) : SELCOLOR (c), BGCOLOR (c), 0); else xprint (c->image, c->font, x, y, c->messg.message[n], (c->image->flags & AAIMAGE) ? BGCOLOR (c) : FGCOLOR (c), BGCOLOR (c), 0); } }
static void drawfile(uih_context * c, void *data) { int i; int ypos; int h = xtextheight(uih->image, uih->font); uih_drawborder(uih, filex + BORDERWIDTH, DIRSTART, filewidth - 2 * BORDERWIDTH, BUTTONHEIGHT, BORDER_PRESSED | BORDER_LIGHT); uih_drawborder(uih, filex + BORDERWIDTH, FILESTART, filewidth - 2 * BORDERWIDTH, BUTTONHEIGHT, BORDER_PRESSED | BORDER_LIGHT); ui_drawbutton("OK", (pressedbutton == 0), active == AOK && activebutton == 0, filex + BORDERWIDTH, filex + filewidth / 2 - BORDERWIDTH, OKSTART); ui_drawbutton(gettext("Cancel"), (pressedbutton == 1), active == AOK && activebutton == 1, filex + filewidth / 2 + BORDERWIDTH, filex + filewidth - BORDERWIDTH, OKSTART); uih_drawborder(uih, filex + BORDERWIDTH, LISTSTART, LISTWIDTH + 3 * BORDERWIDTH + SCROLLWIDTH, LISTEND - LISTSTART, BORDER_PRESSED); uih_drawborder(uih, filex + filewidth / 2 + BORDERWIDTH, LISTSTART, LISTWIDTH + 3 * BORDERWIDTH + SCROLLWIDTH, LISTEND - LISTSTART, BORDER_PRESSED); ypos = LISTSTART + BORDERHEIGHT; for (i = 0; ypos + h < LISTEND && i + namestart < nnames; i++) { if (i + namestart == selectedname) { xrectangle(uih->image, filex + 2 * BORDERWIDTH, ypos, LISTWIDTH, h, (uih->palette-> type & BITMAPS) ? BGCOLOR(uih) : LIGHTGRAYCOLOR(uih)); } if (uih->palette->type & BITMAPS) xprint(uih->image, uih->font, filex + 2 * BORDERWIDTH, ypos, snames[i + namestart], i + namestart == selectedname ? FGCOLOR(uih) : BGCOLOR(uih), BGCOLOR(uih), TEXT_PRESSED); else xprint(uih->image, uih->font, filex + 2 * BORDERWIDTH, ypos, snames[i + namestart], (i + namestart) == selectedname && active == AFILELIST ? SELCOLOR(uih) : FGCOLOR(uih), BGCOLOR(uih), 0); ypos += h; } if (nnames) { int xstart = (namestart) * (LISTEND - LISTSTART) / nnames; int xend = (namestart + NVISIBLE) * (LISTEND - LISTSTART) / nnames; if (xstart > (LISTEND - LISTSTART - 2 * BORDERHEIGHT)) xstart = LISTEND - LISTSTART - 2 * BORDERHEIGHT; if (xend > (LISTEND - LISTSTART - 2 * BORDERHEIGHT)) xend = LISTEND - LISTSTART - 2 * BORDERHEIGHT; uih_drawborder(uih, filex + LISTWIDTH + 3 * BORDERWIDTH, LISTSTART + xstart + BORDERHEIGHT, SCROLLWIDTH, xend - xstart, /*1|BORDER_LIGHT */ 0); } ypos = LISTSTART + BORDERHEIGHT; for (i = 0; ypos + h < LISTEND && i + dirstart < ndirs; i++) { if (i + dirstart == selecteddir) { xrectangle(uih->image, filex + filewidth / 2 + 2 * BORDERWIDTH, ypos, LISTWIDTH, h, (uih->palette->type & BITMAPS) ? BGCOLOR(uih) : LIGHTGRAYCOLOR(uih)); } if (uih->palette->type & BITMAPS) xprint(uih->image, uih->font, filex + filewidth / 2 + 2 * BORDERWIDTH, ypos, sdirs[i + dirstart], i + dirstart == selecteddir ? FGCOLOR(uih) : BGCOLOR(uih), BGCOLOR(uih), TEXT_PRESSED); else xprint(uih->image, uih->font, filex + filewidth / 2 + 2 * BORDERWIDTH, ypos, sdirs[i + dirstart], (i + dirstart) == selecteddir && active == ADIRLIST ? SELCOLOR(uih) : FGCOLOR(uih), BGCOLOR(uih), 0); ypos += h; } if (ndirs) { int xstart = (dirstart) * (LISTEND - LISTSTART) / ndirs; int xend = (dirstart + NVISIBLE) * (LISTEND - LISTSTART) / ndirs; if (xstart > (LISTEND - LISTSTART - 2 * BORDERHEIGHT)) xstart = LISTEND - LISTSTART - 2 * BORDERHEIGHT; if (xend > (LISTEND - LISTSTART - 2 * BORDERHEIGHT)) xend = LISTEND - LISTSTART - 2 * BORDERHEIGHT; uih_drawborder(uih, filex + filewidth / 2 + LISTWIDTH + 3 * BORDERWIDTH, LISTSTART + xstart + BORDERHEIGHT, SCROLLWIDTH, xend - xstart, /*1|BORDER_LIGHT */ 0); } ui_drawtext(filename, active == AFILE); ui_drawtext(dir, active == ADIR); }
static void draw (uih_context * c, void *data) { int num = (int) data; int flags = 0; int xmax, n, nr, i; int x = 0, y = 0; char *string; int fgcolor = 0, bgcolor = 0; if (c->text[num] == NULL) return; prepare (c, c->text[num], &xmax, &n); nr = n * xtextheight (c->font); switch (c->textcolor[num]) { case 0: fgcolor = FGCOLOR (c); bgcolor = BGCOLOR (c); break; case 1: fgcolor = BGCOLOR (c); bgcolor = BGCOLOR (c); flags = TEXT_PRESSED; break; case 2: fgcolor = SELCOLOR (c); bgcolor = BGCOLOR (c); break; default: x_fatalerror ("playtext:unknown color\n"); } if (c->image->flags & AAIMAGE) fgcolor = BGCOLOR (c); switch (num) { case 0: y = 0; break; case 1: y = (c->image->height - nr) / 2; break; case 2: y = c->image->height - nr; break; } string = c->text[num]; for (i = 0; i < n; i++) { xmax = xtextwidth (c->font, string); switch (c->textpos[num]) { case 0: x = 0; break; case 1: x = (c->image->width - xmax) / 2; break; case 2: x = c->image->width - xmax; break; } string += xprint (c->image, c->font, x, y, string, fgcolor, bgcolor, flags) + 1; y += xtextheight (c->font); } }