Esempio n. 1
0
 public MenuItem add(MenuItem item) {
   items.add(item);
   /*
    * Add this item to the zSortedList and re-sort.
    */
   zSortedItems.add(item);
   zSort();
   /*
    * Set the sub-item's parent to this item, and its menu to our menu.
    */
   item.setParent(this);
   //		item.setMenu(menu);
   /*
    * Layout the entire menu so things look nice.
    */
   if (menu != null) menu.layout();
   return item;
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 public void remove(MenuItem item) {
   items.remove(item);
   zSortedItems.remove(item);
   zSort();
   if (menu != null) menu.layout();
 }