Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • tk/lib/tk/menu.rb

Parent

Class/Module Index [+]

Quicksearch

Tk::MenuClone

Public Class Methods

new(src_menu, *args) click to toggle source

begin

def initialize(parent, type=None)
  widgetname = nil
  if parent.kind_of? Hash
    keys = _symbolkey2str(parent)
    parent = keys.delete('parent')
    widgetname = keys.delete('widgetname')
    type = keys.delete('type'); type = None unless type
  end
  #unless parent.kind_of?(TkMenu)
  #  fail ArgumentError, "parent must be TkMenu"
  #end
  @parent = parent
  install_win(@parent.path, widgetname)
  tk_call_without_enc(@parent.path, 'clone', @path, type)
end

end

 
               # File tk/lib/tk/menu.rb, line 435
def initialize(src_menu, *args)
  widgetname = nil

  if args[0].kind_of?(TkWindow)  # parent window
    parent = args.shift
  else
    parent = src_menu
  end

  if args[0].kind_of?(String) || args[0].kind_of?(Symbol)  # menu type
    type = args.shift
  else
    type = None  # 'normal'
  end

  if args[0].kind_of?(Hash)
    keys = _symbolkey2str(args.shift)
    parent = keys.delete('parent') if keys.has_key?('parent')
    widgetname = keys.delete('widgetname')
    type = keys.delete('type') if keys.has_key?('type')
  else
    keys = nil
  end

  @src_menu = src_menu
  @parent = parent
  @type = type
  install_win(@parent.path, widgetname)
  tk_call_without_enc(@src_menu.path, 'clone', @path, @type)
  configure(keys) if keys && !keys.empty?
end
            

Public Instance Methods

source_menu() click to toggle source
 
               # File tk/lib/tk/menu.rb, line 467
def source_menu
  @src_menu
end