void debrush_do_draw_string_default_bmf( DEBrush *brush, int x, int y, const char *str, int len, bool needfill, DEColourGroup *colours) { GC gc=brush->d->normal_gc; if(brush->d->font==NULL) return; XSetForeground(ioncore_g.dpy, gc, PIXEL(colours->fg)); if(!needfill){ if(brush->d->font->fontset!=NULL){ #ifdef CF_DE_USE_XUTF8 if(ioncore_g.enc_utf8) Xutf8DrawString(ioncore_g.dpy, brush->win, brush->d->font->fontset, gc, x, y, str, len); else #endif XmbDrawString(ioncore_g.dpy, brush->win, brush->d->font->fontset, gc, x, y, str, len); }else if(brush->d->font->fontstruct!=NULL){ if(ioncore_g.enc_utf8){ XChar2b *str16; int len16=0; toucs(str, len, &str16, &len16); XDrawString16(ioncore_g.dpy, brush->win, gc, x, y, str16, len16); free(str16); }else{ XDrawString(ioncore_g.dpy, brush->win, gc, x, y, str, len); } } }else{ XSetBackground(ioncore_g.dpy, gc, PIXEL(colours->bg)); if(brush->d->font->fontset!=NULL){ #ifdef CF_DE_USE_XUTF8 if(ioncore_g.enc_utf8) Xutf8DrawImageString(ioncore_g.dpy, brush->win, brush->d->font->fontset, gc, x, y, str, len); else #endif XmbDrawImageString(ioncore_g.dpy, brush->win, brush->d->font->fontset, gc, x, y, str, len); }else if(brush->d->font->fontstruct!=NULL){ if(ioncore_g.enc_utf8){ XChar2b *str16; int len16=0; toucs(str, len, &str16, &len16); XDrawImageString16(ioncore_g.dpy, brush->win, gc, x, y, str16, len16); free(str16); }else{ XDrawImageString(ioncore_g.dpy, brush->win, gc, x, y, str, len); } } } }
void TStatusPanel_STD::update(Status_Pack * sp) { TIMC * imc = sp->imc; XClearWindow(TWinMan::get_display(), id()); uint16_t x = 2; uint16_t y = fontset->ascent() + 2; if (imc == NULL){ im_desc.copy(sp->im_desc[0]); #ifdef MDK_PATCH char dummy[10]; im_desc.tombs(dummy, 4); XmbDrawString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, dummy, strlen(dummy)); #else XwcDrawString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, &im_desc[0], 1); #endif return; } if (!imc->enabled()){ #ifdef MDK_PATCH XmbDrawImageString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, "En", 2); #else XwcDrawImageString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, L"En", 2); #endif return; } if (imc->is_mb_input()){ //XFillArc(display, stat_win, stat_gc, space_width, space_heigth, font_width * 2, font_height, 0, (360 * 64)); XFillRectangle(TWinMan::get_display(), id(), stat_gc->id(), 2, 2, fontset->width() * 2 + 1, fontset->height() + 1); }else{ XPoint p[3]; p[0].x = 2; p[0].y = 2; p[1].x = fontset->width() * 2 + 3; p[1].y = 2; p[2].x = 2; p[2].y = fontset->height() + 3; //XFillArc(display, stat_win, stat_gc, space_width, space_heigth, font_width * 2, font_height, (45 * 64), (225 * 64)); XFillPolygon(TWinMan::get_display(), id(), stat_gc->id(), p, 3, Convex,CoordModeOrigin); } im_desc.copy(sp->im_desc[0]); #ifdef MDK_PATCH char dummy[10]; im_desc.tombs(dummy, 4); XmbDrawString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, dummy, strlen(dummy)); #else XwcDrawString(TWinMan::get_display(), id(), fontset->id(), gc->id(), x, y, &im_desc[0], 1); #endif }
static void gui_menusel_draw(gui_t *gui, winlist_t *win) { greq_win_t *gw = (greq_win_t *)(win->data); greq_menusel_t *info = (greq_menusel_t *)(gw->greq_data); int gcd_idx, gc_sel_idx; int i, j, h1, h2, len, max_len=0, max_len2, x, y, n_elem, n_sel; char buf[256], *selkeys; if ((win->winmode & WMODE_EXIT)) return; XRaiseWindow(gui->display, win->window); /* * Draw headers of the item lists. */ for (i=0, h1=info->head_item; i<win->c_height && h1<=info->n_item; i++, h1++) { len = wchs_to_mbs(buf, info->item[h1-1].title, 256); len = XmbTextEscapement(win->font->fontset, buf, len); if (max_len < len) max_len = len; y = i*(win->font->ef_height+LINE_STEP) + win->font->ef_ascent + LINE_STEP/2; gcd_idx = (h1 == info->focus_item) ? GCM_idx : GC_idx; XmbDrawImageString(gui->display, win->window, win->font->fontset, win->wingc[gcd_idx], FIELD_STEP, y, buf, strlen(buf)); } /* * Draw the grid lines. */ for (i=1; i<win->c_height; i++) { y = i * (win->font->ef_height+LINE_STEP); XDrawLine(gui->display, win->window, win->wingc[GCGRID_idx], 1, y, win->width, y); } x = max_len + FIELD_STEP*2; XDrawLine(gui->display, win->window, win->wingc[GCGRID_idx], x, 1, x, win->height); /* * Draw the item list. */ x += FIELD_STEP; if (info->selkeys) { selkeys = info->selkeys; n_sel = info->n_sel; } else { selkeys = default_selkeys; n_sel = (info->n_sel > DEFAULT_N_SEL) ? DEFAULT_N_SEL : info->n_sel; } for (i=0, h1=info->head_item; i<win->c_height && h1<=info->n_item; i++, h1++) { int xx = x; if (! info->item[h1-1].elements) continue; y = i*(win->font->ef_height+LINE_STEP) + win->font->ef_ascent + LINE_STEP/2; n_elem = (info->item[h1-1].elem_group) ? info->item[h1-1].elem_group[0] : info->item[h1-1].n_elem; for (j=0, h2=info->item[h1-1].head_idx; j<n_sel && h2<=n_elem; j++, h2++) { gc_sel_idx = GCM_idx; gcd_idx = GC_idx; if (info->enable_focus_elem && h1 == info->focus_item && h2 == info->focus_elem) gcd_idx = GCM_idx; get_elem(buf, 256, h2, info->item[h1-1].elements, info->item[h1-1].elem_group, selkeys); len = strlen(buf); max_len = XmbTextEscapement(win->font->fontset, selkeys+j, 1); max_len2 = XmbTextEscapement(win->font->fontset, buf, len); if (xx+max_len+max_len2+FIELD_STEP > win->width) break; XmbDrawImageString(gui->display, win->window, win->font->fontset, win->wingc[gc_sel_idx], xx, y, selkeys+j, 1); xx += (max_len + FIELD_STEP); XmbDrawImageString(gui->display, win->window, win->font->fontset, win->wingc[gcd_idx], xx, y, buf, len); xx += (max_len2 + FIELD_STEP*2); } info->item[h1-1].n_sel_return = j; } }