Exemplo n.º 1
0
 /** Draws this MenuItem to the current root menu's PGraphics object. */
 public synchronized void draw() {
   if (hidden) return;
   drawMyself();
   if (!isOpen()) return;
   if (needsZSort) {
     zSort();
     needsZSort = false;
   }
   /*
    * Here's where the zSorted items come in handy. Draw items in order of
    * the zSortedItems list, so that items on "top" (i.e. with the lowest z
    * value) draw last.
    */
   drawBefore();
   for (int i = 0; i < zSortedItems.size(); i++) {
     MenuItem seg = (MenuItem) zSortedItems.get(i);
     seg.draw();
   }
   drawAfter();
   drawnOnce = true;
 }
Exemplo n.º 2
0
  protected void drawMyself() {
    super.drawMyself();
    getValue();
    if (scrolling) {
      /*
       * Cause the menu to re-layout in case we've changed preferred size.
       */
      menu.layout();
    }

    float px = menu.getStyle().getF("f.padX");
    float py = menu.getStyle().getF("f.padY");

    float curX = x + px;
    MenuUtils.drawLeftText(this, getName() + ":", curX);
    curX += tWidth;

    curX = getX() + getWidth() - px - nWidth;
    if (shouldPerformFill()) MenuUtils.drawSingleGradientRect(this, curX, y, nWidth, height);
    /*
     * update the "value" object using Reflection.
     */
    MenuUtils.drawText(this, stringValue, true, true, curX, y, nWidth, height);
  }