In Files

  • tk/lib/tk/menubar.rb

Parent

Methods

Included Modules

Class/Module Index [+]

Quicksearch

TkMenubar

Public Class Methods

new(parent = nil, spec = nil, options = {}) click to toggle source
 
               # File tk/lib/tk/menubar.rb, line 97
def initialize(parent = nil, spec = nil, options = {})
  if parent.kind_of? Hash
    options = parent
    parent = nil
    spec = (options.has_key?('spec'))? options.delete('spec'): nil
  end

  _symbolkey2str(options)
  menuspec_opt = {}
  TkMenuSpec::MENUSPEC_OPTKEYS.each{|key|
    menuspec_opt[key] = options.delete(key) if options.has_key?(key)
  }

  super(parent, options)

  @menus = []

  spec.each{|info| add_menu(info, menuspec_opt)} if spec

  options.each{|key, value| configure(key, value)} if options
end
            

Public Instance Methods

[](index) click to toggle source
 
               # File tk/lib/tk/menubar.rb, line 135
def [](index)
  return @menus[index]
end
            
add_menu(menu_info, menuspec_opt={}) click to toggle source
 
               # File tk/lib/tk/menubar.rb, line 119
def add_menu(menu_info, menuspec_opt={})
  mbtn, menu = _create_menubutton(@frame, menu_info, menuspec_opt)

  submenus = _get_cascade_menus(menu).flatten

  @menus.push([mbtn, menu])
  delegate('tearoff', menu, *submenus)
  delegate('foreground', mbtn, menu, *submenus)
  delegate('background', mbtn, menu, *submenus)
  delegate('disabledforeground', mbtn, menu, *submenus)
  delegate('activeforeground', mbtn, menu, *submenus)
  delegate('activebackground', mbtn, menu, *submenus)
  delegate('font', mbtn, menu, *submenus)
  delegate('kanjifont', mbtn, menu, *submenus)
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.