static void gtk_draw_menu_item(MENU *m, int x, int y, int w, int h, int bar, int sel) { BITMAP *bmp = gui_get_screen(); int fg, bg; int i, j; char buf[256], *tok; if (m->flags & D_DISABLED) { fg = nshadow; bg = normal; } else { fg = black; bg = (sel) ? highlight : normal; } rectfill(bmp, x+1, y+1, x+w-3, y+h-4, bg); if (ugetc(m->text)) { i = 0; j = ugetc(m->text); while ((j) && (j != '\t')) { i += usetc(buf+i, j); j = ugetc(m->text+i); } usetc(buf+i, 0); gui_textout_ex(bmp, buf, x+8, y+1, fg, bg, FALSE); if (j == '\t') { tok = m->text+i + uwidth(m->text+i); gui_textout_ex(bmp, tok, x+w-gui_strlen(tok)-10, y+1, fg, bg, FALSE); } if ((m->child) && (!bar)) draw_sprite(bmp, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h)/2); } else { hline(bmp, x+4, y+text_height(font)/2+2, x+w-4, nshadow); hline(bmp, x+4, y+text_height(font)/2+3, x+w-4, highlight); } if (m->flags & D_SELECTED) { line(bmp, x+1, y+text_height(font)/2+1, x+3, y+text_height(font)+1, fg); line(bmp, x+3, y+text_height(font)+1, x+6, y+2, fg); } }
static void abitmap_draw_text (DIALOG *d, int what, int offx, int offy, int push, int halign, int valign) { int s = get_state (d); int x = d->x + offx; int y = d->y + offy; int w = gui_strlen (d->dp); int h = text_height (font); if (halign == 1) x = d->x + (d->w - offx) / 2 - w / 2; if (halign == 2) x = d->x + (d->w - offx) - w; if (valign == 1) y = d->y + (d->h - offy) / 2 - h / 2; if (valign == 2) y = d->y + (d->h - offy) - h; if (push && (d->flags & D_SELECTED)) { x += theme->textpushx; y += theme->textpushy; } gui_textout_ex(gui_get_screen(), d->dp, x, y, theme->bitmaps[what][s].color, -1, FALSE); }
void AllegroGUIRenderer::drawText(const std::string& text, int x, int y, FONT* font, const GUIColor& color, textAlignment alignment) { adjustPoint(x, y); FONT* tempFont=::font; ::font=font; gui_textout_ex(target, text.c_str(), x, y, color, -1, alignment==ta_center); ::font=tempFont; }
int d_agtk_check_proc(int msg, DIALOG *d, int c) { if (msg == MSG_DRAW) { BITMAP *bmp = gui_get_screen(); draw_base(bmp, d); gtk_bevel(bmp, d->x+3, d->y+d->h/2-5, 10, 10, (d->flags & D_SELECTED) ? 2 : 1); if (d->dp) { gui_textout_ex(bmp, (char *)d->dp, d->x+18, d->y+d->h/2-text_height(font)/2, (d->flags & D_DISABLED) ? nshadow : black, -1, FALSE); } return D_O_K; } return d_button_proc(msg, d, c); }
/* d1 used for group number. */ int d_agtk_radio_proc(int msg, DIALOG *d, int c) { if (msg == MSG_DRAW) { BITMAP *bmp = gui_get_screen(); draw_base(bmp, d); draw_sprite(bmp, (d->flags & D_SELECTED) ? radio_down_bmp : radio_up_bmp, d->x+3, d->y+d->h/2-5); if (d->dp) { gui_textout_ex(bmp, (char *)d->dp, d->x+18, d->y+d->h/2-text_height(font)/2, (d->flags & D_DISABLED) ? nshadow : black, -1, FALSE); } return D_O_K; } return d_radio_proc(msg, d, c); }
int st_ctext_proc(int msg, DIALOG *d, int c) { ASSERT(d); if (msg==MSG_DRAW) { int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg; FONT *oldfont = font; if (d->dp2) font = d->dp2; gui_textout_ex(screen, d->dp, d->x, d->y, fg, d->bg, TRUE); font = oldfont; } return D_O_K; }
int d_agtk_button_proc(int msg, DIALOG *d, int c) { if (msg == MSG_DRAW) { BITMAP *bmp = gui_get_screen(); int x; if (d->flags & D_SELECTED) x = 2; else if (d->flags & D_GOTFOCUS) x = 1; else x = 0; gtk_box(bmp, d->x, d->y, d->w, d->h, x, d->flags & D_GOTFOCUS); if (d->dp) { gui_textout_ex(bmp, (char *)d->dp, d->x+d->w/2, d->y+d->h/2-text_height(font)/2, (d->flags & D_DISABLED) ? nshadow : black, -1, TRUE); } return D_O_K; } return d_button_proc(msg, d, c); }
static void abitmap_draw_menu_item (MENU * m, int x, int y, int w, int h, int bar, int sel) { BITMAP *bmp = gui_get_screen(); int i, j; char buf[256], *tok; int c; int fg; int x2 = x, y2 = y, w2 = w, h2 = h; if (m->flags & D_DISABLED) c = 2; else c = 0; if (sel) c = 1; if (bar) { fg = theme->bitmaps[B_MENUBAR_ITEM][c].color; y2 -= 1; h2 += 3; } else { fg = theme->bitmaps[B_MENU_ITEM][c].color; x2 -= 1; w2 += 3; } /* See the previous function. */ if (!menu_done) { /* Draw the menu background. */ if (bar) abitmap_draw_bmp (bmp, &theme->bitmaps[B_MENUBAR][c], last_x, last_y, last_w, last_h); else abitmap_draw_bmp (bmp, &theme->bitmaps[B_MENU][c], last_x, last_y, last_w, last_h); menu_done = TRUE; } abitmap_draw_bmp (bmp, &theme->bitmaps[bar ? B_MENUBAR_ITEM : B_MENU_ITEM][c], x2, y2, w2, h2); if (m->flags & D_SELECTED) { /* checked menu item */ abitmap_draw_bmp (bmp, &theme->bitmaps[B_MENU_CHECK][c], x, y, 12, h); } if (ugetc (m->text)) { i = 0; j = ugetc (m->text); while ((j) && (j != '\t')) { i += usetc (buf + i, j); j = ugetc (m->text + i); } usetc (buf + i, 0); gui_textout_ex (bmp, buf, x + 8, y + 1, fg, -1, FALSE); if (j == '\t') { tok = m->text + i + uwidth (m->text + i); gui_textout_ex (bmp, tok, x + w - gui_strlen (tok) - 10, y + 1, fg, -1, FALSE); } if ((m->child) && (!bar)) { abitmap_draw_bmp (bmp, &theme->bitmaps[B_MENU_SUB][c], x + w - 12, y, 12, h); } } else { /* menu separator */ abitmap_draw_bmp (bmp, &theme->bitmaps[B_MENU_SEP][c], x, y, w, h); } }