Ejemplo n.º 1
0
 protected final int[] getScroll() {
   // scroll bar
   int[] scroll =
       MyScrollBar.makeVertScroll(
           (getWidth() - scrollerWidth),
           bar.getHeight(),
           scrollerWidth,
           getContentHeight() + 1,
           getContentHeight(),
           getFullSize());
   if (null != scroll) {
     scroll[MyScrollBar.SCROLL_TOP_VALUE] = getTopOffset();
   }
   return scroll;
 }
Ejemplo n.º 2
0
  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);
    }
  }
Ejemplo n.º 3
0
 private void setTop(int item, int offset) {
   set_Top(item, offset);
   if (this == Jimm.getJimm().getDisplay().getNativeCanvas().getCanvas()) {
     MyScrollBar.showScroll();
   }
 }