mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
3dd3b2136b
* ext/tk/lib/tk.rb, ext/tk/lib/tk/canvas.rb, ext/tk/lib/tk/entry.rb, ext/tk/lib/tk/frame.rb, ext/tk/lib/tk/image.rb, ext/tk/lib/tk/itemconfig.rb, ext/tk/lib/tk/labelframe.rb, ext/tk/lib/tk/listbox.rb, ext/tk/lib/tk/menu.rb, ext/tk/lib/tk/radiobutton.rb, ext/tk/lib/tk/scale.rb, ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tk/text.rb, ext/tk/lib/tk/toplevel.rb: improve conversion of option values. * ext/tk/lib/tkextlib/*: ditto. * ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2. * ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3. * ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2. * ext/tk/lib/tkextlib/vu/*: support vu 2.3.0. * ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
128 lines
3.3 KiB
Ruby
128 lines
3.3 KiB
Ruby
#
|
|
# tk/frame.rb : treat frame widget
|
|
#
|
|
require 'tk'
|
|
|
|
class TkFrame<TkWindow
|
|
TkCommandNames = ['frame'.freeze].freeze
|
|
WidgetClassName = 'Frame'.freeze
|
|
WidgetClassNames[WidgetClassName] = self
|
|
|
|
################# old version
|
|
# def initialize(parent=nil, keys=nil)
|
|
# if keys.kind_of? Hash
|
|
# keys = keys.dup
|
|
# @classname = keys.delete('classname') if keys.key?('classname')
|
|
# @colormap = keys.delete('colormap') if keys.key?('colormap')
|
|
# @container = keys.delete('container') if keys.key?('container')
|
|
# @visual = keys.delete('visual') if keys.key?('visual')
|
|
# end
|
|
# super(parent, keys)
|
|
# end
|
|
#
|
|
# def create_self
|
|
# s = []
|
|
# s << "-class" << @classname if @classname
|
|
# s << "-colormap" << @colormap if @colormap
|
|
# s << "-container" << @container if @container
|
|
# s << "-visual" << @visual if @visual
|
|
# tk_call 'frame', @path, *s
|
|
# end
|
|
#################
|
|
|
|
def __boolval_optkeys
|
|
super() << 'container'
|
|
end
|
|
private :__boolval_optkeys
|
|
|
|
def initialize(parent=nil, keys=nil)
|
|
my_class_name = nil
|
|
if self.class < WidgetClassNames[self.class::WidgetClassName]
|
|
my_class_name = self.class.name
|
|
my_class_name = nil if my_class_name == ''
|
|
end
|
|
if parent.kind_of? Hash
|
|
keys = _symbolkey2str(parent)
|
|
else
|
|
if keys
|
|
keys = _symbolkey2str(keys)
|
|
keys['parent'] = parent
|
|
else
|
|
keys = {'parent'=>parent}
|
|
end
|
|
end
|
|
if keys.key?('classname')
|
|
keys['class'] = keys.delete('classname')
|
|
end
|
|
@classname = keys['class']
|
|
@colormap = keys['colormap']
|
|
@container = keys['container']
|
|
@visual = keys['visual']
|
|
if !@classname && my_class_name
|
|
keys['class'] = @classname = my_class_name
|
|
end
|
|
if @classname.kind_of? TkBindTag
|
|
@db_class = @classname
|
|
@classname = @classname.id
|
|
elsif @classname
|
|
@db_class = TkDatabaseClass.new(@classname)
|
|
else
|
|
@db_class = self.class
|
|
@classname = @db_class::WidgetClassName
|
|
end
|
|
super(keys)
|
|
end
|
|
|
|
#def create_self(keys)
|
|
# if keys and keys != None
|
|
# tk_call_without_enc('frame', @path, *hash_kv(keys))
|
|
# else
|
|
# tk_call_without_enc( 'frame', @path)
|
|
# end
|
|
#end
|
|
#private :create_self
|
|
|
|
def database_classname
|
|
@classname
|
|
end
|
|
|
|
def self.database_class
|
|
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
|
self
|
|
else
|
|
TkDatabaseClass.new(self.name)
|
|
end
|
|
end
|
|
def self.database_classname
|
|
self.database_class.name
|
|
end
|
|
|
|
def self.bind(*args, &b)
|
|
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
|
super(*args, &b)
|
|
else
|
|
TkDatabaseClass.new(self.name).bind(*args, &b)
|
|
end
|
|
end
|
|
def self.bind_append(*args, &b)
|
|
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
|
super(*args, &b)
|
|
else
|
|
TkDatabaseClass.new(self.name).bind_append(*args, &b)
|
|
end
|
|
end
|
|
def self.bind_remove(*args)
|
|
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
|
super(*args)
|
|
else
|
|
TkDatabaseClass.new(self.name).bind_remove(*args)
|
|
end
|
|
end
|
|
def self.bindinfo(*args)
|
|
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
|
super(*args)
|
|
else
|
|
TkDatabaseClass.new(self.name).bindinfo(*args)
|
|
end
|
|
end
|
|
end
|