Menu library for AIR
Pull request Compare This branch is even with destroytoday:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
build
lib
src/com/destroytoday/menu
test
.gitignore
LICENSE
README.textile
build.xml

README.textile

Menu

Overview

This is a library that eases the pain of AIR menus by introducing the concept of item groups.

Features

  • one-line menu item instantiation
  • menu separator as its own class
  • menu automatically inserts separators between groups
  • modifying groups automatically redraws menu

Usage

MenuItem

Instantiating a simple item.

new MenuItem('New');

Instantiating an item that has a hotkey.

new MenuItem('New', [Keyboard.COMMAND], 'n');

MenuGroup

Instantiating a group.

group = new MenuGroup();

newItem = group.addItem(new MenuItem('New', [Keyboard.COMMAND], 'n'));
openItem = group.addItem(new MenuItem('Open', [Keyboard.COMMAND], 'o'));
saveItem = group.addItem(new MenuItem('Save', [Keyboard.COMMAND], 's'));

SeparatedMenu

Using SeparatedMenu to recreate OSX’s Window menu.

menu = new SeparatedMenu();

// group with minimize and zoom items
singleWindowGroup = menu.addGroup(new SingleWindowMenuGroup());

// group with bring all to front item
multiWindowGroup = menu.addGroup(new MultiWindowMenuGroup());

// group with an item for each open window
windowListGroup = menu.addGroup(new WindowListMenuGroup());