id2obj(chart, id)
click to toggle source
def Element.id2obj(chart, id)
cpath = chart.path
return id unless OBJ_TBL[cpath]
OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
end
new(chart, element=nil, keys={})
click to toggle source
def self.new(chart, element=nil, keys={})
if element.kind_of?(Hash)
keys = element
element = nil
end
OBJ_TBL[chart.path] = {} unless OBJ_TBL[chart.path]
if element && OBJ_TBL[chart.path][element]
return OBJ_TBL[chart.path][element]
end
super(chart, element, keys)
end
new(chart, element=nil, keys={})
click to toggle source
def initialize(chart, element=nil, keys={})
if element.kind_of?(Hash)
keys = element
element = nil
end
if element
@element = @id = element.to_s
else
@element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
OBJ_ID[1].succ!
end
@path = @id
@parent = @chart = chart
@cpath = @chart.path
@typename = self.class::ElementTypeName
Element::OBJ_TBL[@cpath][@element] = self
keys = _symbolkey2str(keys)
unless keys.delete('without_creating')
tk_call(@chart, @typename, 'create', @element, keys)
end
end
type2class(type)
click to toggle source
def Element.type2class(type)
ElementTypeToClass[type]
end
activate(*args)
click to toggle source
def activate(*args)
@chart.element_activate(@id, *args)
end
cget(option)
click to toggle source
def cget(option)
@chart.__send__(@typename + '_cget', @id, option)
end
closest(x, y, var, keys={})
click to toggle source
def closest(x, y, var, keys={})
@chart.__send__(@typename + '_closest', x, y, var, @id, keys)
end
configinfo(key=nil)
click to toggle source
def configinfo(key=nil)
@chart.__send__(@typename + '_configinfo', @id, key)
end
current_configinfo(key=nil)
click to toggle source
def current_configinfo(key=nil)
@chart.__send__('current_' << @typename << '_configinfo', @id, key)
end
deactivate()
click to toggle source
def deactivate
@chart.element_deactivate(@id)
self
end
delete()
click to toggle source
def delete
@chart.element_delete(@id)
self
end
exist?()
click to toggle source
def exist?
@chart.element_exist?(@id)
end
id()
click to toggle source
name()
click to toggle source
to_eval()
click to toggle source
type()
click to toggle source
def type
@chart.element_type(@id)
end