home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / Livebrush / Install-LivebrushLite.air / livebrush.swf / scripts / com / livebrush / ui / ContextMenuView.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  1.7 KB  |  61 lines

  1. package com.livebrush.ui
  2. {
  3.    import flash.display.NativeMenu;
  4.    import flash.display.NativeMenuItem;
  5.    
  6.    public class ContextMenuView extends UIView
  7.    {
  8.       public var menu:NativeMenu;
  9.       
  10.       public function ContextMenuView(ui:UI)
  11.       {
  12.          super(ui);
  13.          init();
  14.       }
  15.       
  16.       override protected function createView() : void
  17.       {
  18.          this.createContextMenu();
  19.       }
  20.       
  21.       private function createContextMenu() : void
  22.       {
  23.          this.menu = new NativeMenu();
  24.          var testMenuItem:* = this.menu.addItem(new NativeMenuItem("Test Menu Item"));
  25.       }
  26.       
  27.       public function setMenuItemListState(itemList:Array, enabled:Boolean, checked:Boolean = false) : void
  28.       {
  29.          for(var i:int = 0; i < itemList.length; i++)
  30.          {
  31.             this.setItemState(itemList[i],enabled,checked);
  32.          }
  33.       }
  34.       
  35.       override protected function createController() : void
  36.       {
  37.          controller = new ContextMenuController(this);
  38.       }
  39.       
  40.       public function setMenuIndexListState(menu:NativeMenu, indexList:Array, enabled:Boolean, checked:Boolean = false) : void
  41.       {
  42.          for(var i:int = 0; i < indexList.length; i++)
  43.          {
  44.             this.setItemState(menu.items[indexList[i]],enabled,checked);
  45.          }
  46.       }
  47.       
  48.       public function setItemState(item:NativeMenuItem, enabled:Boolean, checked:Boolean = false) : void
  49.       {
  50.          item.checked = checked;
  51.          item.enabled = enabled;
  52.       }
  53.       
  54.       public function setMenuItemState(menu:NativeMenu, enabled:Boolean, checked:Boolean = false) : void
  55.       {
  56.          this.setMenuItemListState(menu.items,enabled,checked);
  57.       }
  58.    }
  59. }
  60.  
  61.