private void drawBack(GraphicsEx g, int top, int width, int height) { // Fill background g.setThemeColor(CanvasEx.THEME_BACKGROUND); g.fillRect(0, top, width, height); g.setClip(0, top, width, height); if (null != Scheme.backImage) { int offset = 0; if (0 < getSize()) { offset = Math.max(0, Scheme.backImage.getHeight() - height) * getTopOffset() / getFullSize(); } g.drawImage(Scheme.backImage, 0, top - offset, Graphics.LEFT | Graphics.TOP); } }
private void drawItems(GraphicsEx g, int top_y, int itemWidth, int height) { int size = getSize(); int bottom = height + top_y; if (0 == size) { drawEmptyItems(g, top_y); return; } boolean showCursor = false; int currentY = 0; int currentIndex = isCurrentItemSelectable() ? getCurrItem() : -1; // #sijapp cond.if modules_TOUCH is "true"# if (touchUsed && !touchPressed) currentIndex = -1; // #sijapp cond.end# { // background int offset = topOffset; int y = top_y; for (int i = topItem; i < size; ++i) { int itemHeight = getItemHeight(i); int realHeight = Math.min(itemHeight - offset, bottom - y + 1); g.setClip(0, y, itemWidth, realHeight + 1); g.setStrokeStyle(Graphics.SOLID); if (i == currentIndex) { currentY = y - offset; if (g.notEqualsColor(CanvasEx.THEME_BACKGROUND, CanvasEx.THEME_SELECTION_BACK)) { g.setThemeColor(CanvasEx.THEME_SELECTION_BACK); g.fillRect(0, currentY, itemWidth - 1, itemHeight); } drawItemBack(g, i, 2, y - offset, itemWidth - 4, itemHeight, offset, realHeight); showCursor = true; } else { drawItemBack(g, i, 2, y - offset, itemWidth - 4, itemHeight, offset, realHeight); } y += itemHeight - offset; if (y >= bottom) break; offset = 0; } if (0 < MyScrollBar.showScroll) { g.setClip(0, top_y, itemWidth, bottom - top_y); MyScrollBar.paint(g, this, CanvasEx.THEME_SCROLL_BACK); } } { // Draw items g.setColor(0); int offset = topOffset; int y = top_y; for (int i = topItem; i < size; ++i) { int itemHeight = getItemHeight(i); int realHeight = Math.min(itemHeight, bottom - y + 1); g.setClip(0, y, itemWidth, realHeight + 1); g.setStrokeStyle(Graphics.SOLID); drawItemData(g, i, 2, y - offset, itemWidth - 4, itemHeight, offset, realHeight); y += itemHeight - offset; if (y >= bottom) break; offset = 0; } } if (showCursor) { int itemHeight = getItemHeight(currentIndex); g.setClip(0, currentY, itemWidth, itemHeight + 1); g.setThemeColor(CanvasEx.THEME_SELECTION_RECT); g.setStrokeStyle(Graphics.SOLID); g.drawSimpleRect(0, currentY, itemWidth - 1, itemHeight); } }