示例#1
0
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);
}
示例#2
0
void MTPNP_PFAL_SetIdleScreenNetworkName(MTPNP_UCHAR * s)
{
    MTPNP_INT16 strlen, i, real_pos;
    MTPNP_INT8 start_flag = 0;

    real_pos = 0;
    strlen = (MTPNP_INT16) gui_strlen((UI_string_type) s) << 1;
    for (i = 0; i < strlen; i += 2)
    {
        if (s[i] != 0x20 || s[i + 1] != 0x00)
        {
            start_flag = 1;
        }
        if (start_flag == 1)
        {
            s[real_pos] = s[i];
            s[real_pos + 1] = s[i + 1];
            real_pos += 2;
        }
    }
    if (real_pos < strlen)
    {
        for (i = real_pos; i < strlen; i++)
        {
            s[i] = '\0';
        }
    }
    strlen = (MTPNP_INT16) gui_strlen((UI_string_type) s) << 1;
    for (i = strlen - 2; i > 0; i -= 2)
    {
        if (s[i] != 0x20 || s[i + 1] != 0x00)
        {
            break;
        }
        else
        {
            s[i] = '\0';
            s[i + 1] = '\0';
        }
    }
    g_slave_idle_screen_line1text = (UI_string_type) s;
}
示例#3
0
文件: agtk.c 项目: ufaith/d2imdev
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);
    }
}
示例#4
0
文件: aphoton.c 项目: Fomka/ufo2000
static void photon_draw_menu_item(MENU *m, int x, int y, int w, int h, int bar, int sel)
{
    int i, j, height;
    char buf[256], *tok;
    int rtm;

    if (!menu_done) {
	photon_do_draw_menu(last_x, last_y, last_w, last_h, bar);
	menu_done = TRUE;
    }

    if (ugetc(m->text)) {
	if (bar) {
	    if (sel) {
		rect(screen, x+6, y, x+w-4, y+h, container_black);
		hline(screen, x+7, y+1, x+w-5, white);
		vline(screen, x+7, y+1, y+h-2, white);
		hline(screen, x+7, y+h-1, x+w-5, check_gray1);
		vline(screen, x+w-5, y, y+h-1, check_gray1);
		rectgouraud(screen, x+8, y+2, x+w-6, y+h-2, &scrollbar_gray_range, FALSE);
	    }
	    else {
		hline(screen, x+6, y, x+w-4, white);
		hline(screen, x+6, y+h-1, x+w-4, check_gray1);
		rectgouraud(screen, x+6, y+1, x+w-4, y+h-2, &menu_gray_range, FALSE);
	    }
	}
	else {
	    if (!(m->flags & D_DISABLED)) {
		if (sel)
		    rectfill(screen, x+3, y+1, x+w-5, y+h-4, highlight);
		else
		    rectfill(screen, x+3, y+1, x+w-5, y+h-4, menu_gray_to);
	    }
	}

	rtm = text_mode(-1);

	i = 0;
	j = ugetc(m->text);

	while ((j) && (j != '\t')) {
	    i += usetc(buf+i, j);
	    j = ugetc(m->text+i);
	}

	usetc(buf+i, 0);

	if (bar)
	    photon_textout(screen, buf, x+9, y+1, m->flags, FALSE);
	else
	    photon_textout(screen, buf, x+4, y+1, m->flags, FALSE);

	if (j == '\t') {
	    tok = m->text+i + uwidth(m->text+i);
	    photon_textout(screen, tok, x+w-gui_strlen(tok)-15, y+1, m->flags, FALSE);
	}

	text_mode(rtm);

	if ((m->child) && (!bar))
	    draw_sprite(screen, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h-1)/2);
    }
    else {
	height = text_height(font);
	hline(screen, x, y+height/2-1, x+w-1, check_gray1);
	hline(screen, x, y+height/2, x+w-1, container_black);
	hline(screen, x, y+height/2+1, x+w-1, white);
    }

    if (m->flags & D_SELECTED) {
	height = text_height(font);
	line(screen, x+w-10, y+height/2, x+w-8, y+height, checked_gray);
	line(screen, x+w-8, y+height, x+w-5, y+1, checked_gray);
    }
}
示例#5
0
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);
	}
}