public void drawItem(Graphics g, int offset, boolean selected, boolean drawsec) { // g.setColor(0); boolean ralign = false; boolean underline = false; // #if NICK_COLORS // # boolean nick=false; // #endif int w = offset; int dw; int imageYOfs = ((getVHeight() - imgHeight()) >> 1); // #if ALCATEL_FONT // # int fontYOfs=(( getVHeight()-font.getHeight() )>>1) +1; // #else int fontYOfs = ((getVHeight() - font.getHeight()) >> 1); // #endif int imgWidth = imgWidth(); g.setFont(font); for (int index = 0; index < elementCount; index++) { Object ob = elementData[index]; if (ob != null) { if (ob instanceof String) { // string element String s = (String) ob; // #if NICK_COLORS // # if (nick) { // # int color=g.getColor(); // # dw=0; // # int p1=0; // # while (p1<s.length()) { // # int p2=p1; // # char c1=s.charAt(p1); // # //processing the same cp // # while (p2<s.length()) { // # char c2=s.charAt(p2); // # if ( (c1&0xff00) != (c2 &0xff00) ) break; // # p2++; // # } // # g.setColor( (c1>255) ? ColorScheme.strong(color) : // color); // # dw=font.substringWidth(s, p1, p2-p1); // # if (ralign) w-=dw; // # g.drawSubstring( s, p1, p2-p1, // # w,fontYOfs,Graphics.LEFT|Graphics.TOP); // # if (!ralign) w+=dw; // # p1=p2; // # } // # // # g.setColor(color); // # } else { // #endif dw = font.stringWidth(s); if (ralign) w -= dw; g.drawString(s, w, fontYOfs, Graphics.LEFT | Graphics.TOP); if (underline) { int y = getVHeight() - 1; g.drawLine(w, y, w + dw, y); underline = false; } if (!ralign) w += dw; // #if NICK_COLORS // # } // #endif } else if ((ob instanceof Integer)) { // image element or color int i = ((Integer) ob).intValue(); switch (i & 0xff000000) { case IMAGE: if (imageList == null) break; if (ralign) w -= imgWidth; imageList.drawImage(g, ((Integer) ob).intValue(), w, imageYOfs); if (!ralign) w += imgWidth; break; case COLOR: g.setColor(0xFFFFFF & i); break; case RALIGN: ralign = true; w = g.getClipWidth() - 1; break; case UNDERLINE: underline = true; break; // #if NICK_COLORS // # case NICK_ON: // # nick=true; // # break; // # case NICK_OFF: // # nick=false; // # break; // #endif } } /* Integer*/ else if (ob instanceof VirtualElement) { int clipw = g.getClipWidth(); int cliph = g.getClipHeight(); ((VirtualElement) ob).drawItem(g, 0, false, false); g.setClip(g.getTranslateX(), g.getTranslateY(), clipw, cliph); // TODO: рисование не с нулевой позиции и вычисление ширины } } // if ob!=null } // for }