Class | Tk::BLT::PlotComponent::Element |
In: |
tk/lib/tkextlib/blt/component.rb
|
Parent: | TkObject |
ElementTypeName | = | 'element' |
ElementTypeToClass | = | { ElementTypeName=>self } |
ElementID_TBL | = | TkCore::INTERP.create_table |
OBJ_ID | = | ['blt_chart_element'.freeze, '00000'.taint].freeze |
OBJ_TBL | = | {} |
# File tk/lib/tkextlib/blt/component.rb, line 514 def Element.id2obj(chart, id) cpath = chart.path return id unless OBJ_TBL[cpath] OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id end
# File tk/lib/tkextlib/blt/component.rb, line 532 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') # @chart.element_create(@element, keys) tk_call(@chart, @typename, 'create', @element, keys) end end
# File tk/lib/tkextlib/blt/component.rb, line 520 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
# File tk/lib/tkextlib/blt/component.rb, line 510 def Element.type2class(type) ElementTypeToClass[type] end
# File tk/lib/tkextlib/blt/component.rb, line 581 def activate(*args) @chart.element_activate(@id, *args) end
# File tk/lib/tkextlib/blt/component.rb, line 563 def cget(option) # @chart.element_cget(@id, option) @chart.__send__(@typename + '_cget', @id, option) end
# File tk/lib/tkextlib/blt/component.rb, line 585 def closest(x, y, var, keys={}) # @chart.element_closest(x, y, var, @id, keys) @chart.__send__(@typename + '_closest', x, y, var, @id, keys) end
# File tk/lib/tkextlib/blt/component.rb, line 572 def configinfo(key=nil) # @chart.element_configinfo(@id, key) @chart.__send__(@typename + '_configinfo', @id, key) end
# File tk/lib/tkextlib/blt/component.rb, line 567 def configure(key, value=None) # @chart.element_configure(@id, key, value) @chart.__send__(@typename + '_configure', @id, key, value) self end
# File tk/lib/tkextlib/blt/component.rb, line 576 def current_configinfo(key=nil) # @chart.current_element_configinfo(@id, key) @chart.__send__('current_' << @typename << '_configinfo', @id, key) end
# File tk/lib/tkextlib/blt/component.rb, line 590 def deactivate @chart.element_deactivate(@id) self end