Class: CloneMenu (Ruby 2.3.4)

In Files

  • tk/lib/tk/menu.rb

Parent

Class/Module Index [+]

Quicksearch

CloneMenu

Public Class Methods

new(src_menu, *args)

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

 
               # File tk/lib/tk/menu.rb, line 436
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()
 
               # File tk/lib/tk/menu.rb, line 468
def source_menu
  @src_menu
end