Skip to content
Alessandro Febretti edited this page Feb 8, 2014 · 6 revisions

module omegaToolkit wraps omegaTookit::ui::Menu

Represents a menu. Menus can contain buttons, sliders, checkboxes and sub menus

Methods

Method(s) Description
MenuItem addItem(type) Adds an item to the menu. Type can be one of MenuItem.Button, MenuItem.Checkbox, MenuItem.Slider, MenuItem.SubMenu, MenuItem.Label, MenuItem.Image, MenuItem.Container. See MenuItem.
MenuItem addButton(label, command) Convenience method for adding a button item and associating a command to it. Returns a reference to the created MenuItem
Menu addSubMenu(label) Convenience method for adding a sub menu. Returns a reference to the created Menu
MenuItem addLabel(text) Convenience method for adding a label. Returns a reference to the created MenuItem
MenuItem addImage(image) Convenience method for adding an image. Returns a reference to the created MenuItem. the image is a PixelData object
MenuItem addSlider(ticks, command) Convenience method for adding a slider. Returns a reference to the created MenuItem.
MenuItem addContainer() Convenience method for adding a container. Returns a reference to the created MenuItem.
show() Displays the menu
hide() Hides the menu
bool isVisible() Returns True if this menu is currently visible
placeOnWand(event) When 3d menus are enabled, places the menu on the wand ray. The argument must be an event containing ray information, like a Wand or Pointer event.
Container getContainer() Gets the 'Container' widget containing the items of this menu. See Container

Examples

Multi-column menu

# Add a bunch of buttons to the columns
# Column 1
b1c1 = Button.create(c1)
b2c1 = Button.create(c1)

 
# Column 2
b1c2 = Button.create(c2)
b2c2 = Button.create(c2)
b3c2 = Button.create(c2)
 
# Column 3
b1c3 = Button.create(c3)
b2c3 = Button.create(c3)
b3c3 = Button.create(c3)

# setup navigation
# vertical navigation for buttons will be set up automatically by the container.
# we set horizontal navigation manually

# Buttons on the first row
b1c1.setHorizontalNextWidget(b1c2)
b1c2.setHorizontalPrevWidget(b1c1)

b1c2.setHorizontalNextWidget(b1c3)
b1c3.setHorizontalPrevWidget(b1c2)

# Buttons on the second row
b2c1.setHorizontalNextWidget(b2c2)
b2c2.setHorizontalPrevWidget(b2c1)

b2c2.setHorizontalNextWidget(b2c3)
b2c3.setHorizontalPrevWidget(b2c2)

# Buttons on the third row
# since the first column does not have a third row, prev navigation
# from column 2 goes to the last button of column 1
b3c2.setHorizontalPrevWidget(b2c1)

b3c2.setHorizontalNextWidget(b3c3)
b3c3.setHorizontalPrevWidget(b3c2)
Clone this wiki locally