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 96
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 134
def [](index)
  return @menus[index]
end
            
add_menu(menu_info, menuspec_opt={}) click to toggle source
 
               # File tk/lib/tk/menubar.rb, line 118
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