Module: WidgetWrapper::Menus::MenuBar
- Defined in:
- lib/wx_wrapper/menu.rb
Overview
Menu bar syntax (This code follows after a frame block):
. "&File" do |item|
item.add :new
item.add :open
item.separator
item.add :save
item.separator
item.add :quit
end
. "&Edit" do |item|
item.add :undo
item.add :redo
end
The & in the menu title (ie &File) is used underlined and used as a shortcut for referencing alt command navigation for windows. You can move the ampersand in front of a different letter if you would like another letter to be the shortcut for alt keys. (As of yet, I don’t know how this works in OS X if it has any effect at all).
Instance Method Summary collapse
-
#menu(title, options = {}) ⇒ Object
Creates a menu inside of the menu bar.
-
#menus ⇒ Object
Gets a list of menus in the menu bar.
Instance Method Details
#menu(title, options = {}) ⇒ Object
Creates a menu inside of the menu bar.
. "&File" do |item|
item.add :new
end
62 63 64 65 66 67 68 69 70 |
# File 'lib/wx_wrapper/menu.rb', line 62 def (title, = {}) = Wx::Menu.new if block_given? yield() end append(, title) end |
#menus ⇒ Object
Gets a list of menus in the menu bar
53 54 55 |
# File 'lib/wx_wrapper/menu.rb', line 53 def (0..(-1)).collect {|| ()} end |